[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
|
||||
params.require(:glossary_term).permit(
|
||||
:name, :description
|
||||
:name, :description, :category_id
|
||||
)
|
||||
end
|
||||
end
|
||||
|
@ -1,4 +1,5 @@
|
||||
<div class="box tabular">
|
||||
<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>
|
||||
</div>
|
||||
|
@ -7,16 +7,24 @@
|
||||
<table class="list">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th><%=l :field_name %></th>
|
||||
<th><%=l :field_category %></th>
|
||||
<th><%=l :field_description %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @glossary_terms.each do |term| %>
|
||||
<tr>
|
||||
<td class="id">
|
||||
<%= term.id %>
|
||||
</td>
|
||||
<td class="name">
|
||||
<%= link_to term.name, term %>
|
||||
</td>
|
||||
<td class="roles">
|
||||
<%= term.category.try!(:name) %>
|
||||
</td>
|
||||
<td class="description">
|
||||
<%= term.description %>
|
||||
</td>
|
||||
|
@ -9,6 +9,10 @@
|
||||
<h3><%= @term.name %></h3>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th><%=l :field_category %></th>
|
||||
<td><%= @term.category.try!(:name) %>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%=l :field_description %></th>
|
||||
<td><%= @term.description %></td>
|
||||
|
Loading…
Reference in New Issue
Block a user