Adding certifications; messed up adding certification_users so not staging those

This commit is contained in:
2013-01-25 03:12:25 -07:00
parent fe283b051f
commit 43d949dc1d
20 changed files with 264 additions and 4 deletions

View File

@@ -0,0 +1,29 @@
<%= form_for(@certification) do |f| %>
<% if @certification.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@certification.errors.count, "error") %> prohibited this certification from being saved:</h2>
<ul>
<% @certification.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :description %><br />
<%= f.text_area :description %>
</div>
<% f.fields_for :users do |u| %>
<%= u.label :user %><br />
<%= collection_select(:certifications_users, :user_id, User.all.sort_by(&:name), :id, :name) %>
<% end %>
<div class="actions">
<%= f.submit %>
</div>
<% end %>

View File

@@ -0,0 +1,6 @@
<h1>Editing certification</h1>
<%= render 'form' %>
<%= link_to 'Show', @certification %> |
<%= link_to 'Back', certifications_path %>

View File

@@ -0,0 +1,15 @@
<h1>Listing certifications</h1>
<%= link_to 'New Certification', new_certification_path if can? :create, Certification %>
<ul>
<% @certifications.each do |certification| %>
<li><%= link_to certification.name, certification %>
<% if can? :update, certification %> | <%= link_to 'Edit', edit_certification_path(certification) %><% end %>
<% if can? :delete, certification %> | <%= link_to 'Destroy', certification, :confirm => 'Are you sure?', :method => :delete %><% end %>
</li>
<% end %>
</ul>
<br />

View File

@@ -0,0 +1,5 @@
<h1>New certification</h1>
<%= render 'form' %>
<%= link_to 'Back', certifications_path %>

View File

@@ -0,0 +1,20 @@
<p>
<b>Name:</b>
<%= @certification.name %>
</p>
<p>
<b>Description:</b>
<%= simple_format @certification.description %>
</p>
<b>Certified Users:</b>
<ul>
<% @certification.users.each do |user| %>
<% unless user.name.blank? %><li><%= user.name %></li><% end %>
<% end %>
<% if @certification.users.blank? then %><li>n/a</li><% end %>
</ul>
<% if can? :update, @certification %><%= link_to 'Edit', edit_certification_path(@certification) %> |<% end %>
<%= link_to 'Back', certifications_path %>