リビジョン 1378a95a
| app/controllers/glossary_terms_controller.rb | ||
|---|---|---|
|
|
||
|
def glossary_term_params
|
||
|
params.require(:glossary_term).permit(
|
||
|
:name, :description
|
||
|
:name, :description, :category_id
|
||
|
)
|
||
|
end
|
||
|
end
|
||
| app/views/glossary_terms/_form.html.erb | ||
|---|---|---|
|
<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>
|
||
| app/views/glossary_terms/index.html.erb | ||
|---|---|---|
|
<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="name">
|
||
|
<%= link_to term.name, term %>
|
||
|
</td>
|
||
|
<td class="description">
|
||
|
<%= term.description %>
|
||
|
</td>
|
||
|
</tr>
|
||
|
<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>
|
||
|
</tr>
|
||
|
<% end %>
|
||
|
</tbody>
|
||
|
</table>
|
||
| app/views/glossary_terms/show.html.erb | ||
|---|---|---|
|
<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>
|
||
[phase-5]add category field to term index/detail view, and edit form