Adding certifications; messed up adding certification_users so not staging those
This commit is contained in:
29
app/views/certifications/_form.html.erb
Normal file
29
app/views/certifications/_form.html.erb
Normal 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 %>
|
||||
6
app/views/certifications/edit.html.erb
Normal file
6
app/views/certifications/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<h1>Editing certification</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Show', @certification %> |
|
||||
<%= link_to 'Back', certifications_path %>
|
||||
15
app/views/certifications/index.html.erb
Normal file
15
app/views/certifications/index.html.erb
Normal 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 />
|
||||
|
||||
5
app/views/certifications/new.html.erb
Normal file
5
app/views/certifications/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<h1>New certification</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', certifications_path %>
|
||||
20
app/views/certifications/show.html.erb
Normal file
20
app/views/certifications/show.html.erb
Normal 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 %>
|
||||
Reference in New Issue
Block a user