De-duplicating cert view

This commit is contained in:
Will Bradley 2013-08-26 22:32:08 -07:00
parent ae031838dc
commit 810ff6b034
3 changed files with 6 additions and 9 deletions

View File

@ -6,7 +6,7 @@ class UserCertificationsController < ApplicationController
# Load users and certs based on current ability # Load users and certs based on current ability
before_filter :only => [:new, :edit, :create, :update] do before_filter :only => [:new, :edit, :create, :update] do
@users = User.where(:hidden => false).accessible_by(current_ability).sort_by(&:name) @users = User.where(:hidden => [false,nil]).accessible_by(current_ability).sort_by(&:name)
@certifications = Certification.accessible_by(current_ability).sort_by(&:name) @certifications = Certification.accessible_by(current_ability).sort_by(&:name)
end end

View File

@ -8,13 +8,10 @@
<%= simple_format @certification.description %> <%= simple_format @certification.description %>
</p> </p>
<b>Certified Users:</b> <p>
<ul> <b>Certified Users:</b>
<% @certification_users.each do |user| %> <%= link_to "Click Here", user_certifications_path %>
<li><%= link_to user.name, user %></li> </p>
<% end %>
<% if @certification_users.blank? then %><li>n/a</li><% end %>
</ul>
<% if can? :update, @certification %><%= link_to 'Edit', edit_certification_path(@certification) %> |<% end %> <% if can? :update, @certification %><%= link_to 'Edit', edit_certification_path(@certification) %> |<% end %>
<%= link_to 'Back', certifications_path %> <%= link_to 'Back', certifications_path %>

View File

@ -1,6 +1,6 @@
<p> <p>
<b>User:</b> <b>User:</b>
<%= @user_certification.user.name %> <%= link_to @user_certification.user.name, @user_certification.user %>
</p> </p>
<p> <p>