[phase-5]add category field to term index/detail view, and edit form
This commit is contained in:
parent
b36e22c972
commit
1378a95aa4
@ -47,7 +47,7 @@ class GlossaryTermsController < ApplicationController
|
|||||||
|
|
||||||
def glossary_term_params
|
def glossary_term_params
|
||||||
params.require(:glossary_term).permit(
|
params.require(:glossary_term).permit(
|
||||||
:name, :description
|
:name, :description, :category_id
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<div class="box tabular">
|
<div class="box tabular">
|
||||||
<p><%= form.text_field :name, size: 80, required: true %></p>
|
<p><%= form.text_field :name, size: 80, required: true %></p>
|
||||||
|
<p><%= form.collection_select :category_id, GlossaryCategory.all, :id, :name, include_blank: true %>
|
||||||
<p><%= form.text_area :description, size: "80x10", required: false %></p>
|
<p><%= form.text_area :description, size: "80x10", required: false %></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,20 +7,28 @@
|
|||||||
<table class="list">
|
<table class="list">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
<th><%=l :field_name %></th>
|
<th><%=l :field_name %></th>
|
||||||
|
<th><%=l :field_category %></th>
|
||||||
<th><%=l :field_description %></th>
|
<th><%=l :field_description %></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @glossary_terms.each do |term| %>
|
<% @glossary_terms.each do |term| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="name">
|
<td class="id">
|
||||||
<%= link_to term.name, term %>
|
<%= term.id %>
|
||||||
</td>
|
</td>
|
||||||
<td class="description">
|
<td class="name">
|
||||||
<%= term.description %>
|
<%= link_to term.name, term %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
<td class="roles">
|
||||||
|
<%= term.category.try!(:name) %>
|
||||||
|
</td>
|
||||||
|
<td class="description">
|
||||||
|
<%= term.description %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
<h3><%= @term.name %></h3>
|
<h3><%= @term.name %></h3>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th><%=l :field_category %></th>
|
||||||
|
<td><%= @term.category.try!(:name) %>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th><%=l :field_description %></th>
|
<th><%=l :field_description %></th>
|
||||||
<td><%= @term.description %></td>
|
<td><%= @term.description %></td>
|
||||||
|
Loading…
Reference in New Issue
Block a user