[phase-9]add attributes to term

This commit is contained in:
Toru Takahashi 2018-05-24 08:26:17 +09:00 committed by TAKAHASHI,Toru
parent 7ebd27c74d
commit c63ac32052
6 changed files with 50 additions and 1 deletions

View File

@ -48,7 +48,8 @@ class GlossaryTermsController < ApplicationController
def glossary_term_params def glossary_term_params
params.require(:glossary_term).permit( params.require(:glossary_term).permit(
:name, :description, :category_id :name, :description, :category_id,
:name_en, :rubi, :abbr_whole, :datatype, :codename
) )
end end
end end

View File

@ -1,5 +1,10 @@
<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.text_field :name_en, size: 80 %></p>
<p><%= form.text_field :rubi, size: 80 %></p>
<p><%= form.text_field :abbr_whole, size: 80 %></p>
<p><%= form.text_field :datatype, size: 80 %></p>
<p><%= form.text_field :codename, size: 80 %></p>
<p><%= form.select :category_id, GlossaryCategory.pluck(:name, :id), include_blank: true %></p> <p><%= form.select :category_id, GlossaryCategory.pluck(:name, :id), include_blank: true %></p>
<p><%= form.text_area :description, size: "80x10", required: false %></p> <p><%= form.text_area :description, size: "80x10", required: false %></p>
</div> </div>

View File

@ -15,6 +15,26 @@
<h3><%= @term.name %></h3> <h3><%= @term.name %></h3>
<table> <table>
<tr>
<th><%=l :field_name_en %></th>
<td><%= @term.name_en %></td>
</tr>
<tr>
<th><%=l :field_rubi %></th>
<td><%= @term.rubi %></td>
</tr>
<tr>
<th><%=l :field_abbr_whole %></th>
<td><%= @term.abbr_whole %></td>
</tr>
<tr>
<th><%=l :field_datatype %></th>
<td><%= @term.datatype %></td>
</tr>
<tr>
<th><%=l :field_codename %></th>
<td><%= @term.codename %></td>
</tr>
<tr> <tr>
<th><%=l :field_category %></th> <th><%=l :field_category %></th>
<td><%= @term.category.try!(:name) %> <td><%= @term.category.try!(:name) %>

View File

@ -22,3 +22,10 @@ en:
permission_view_glossary: View glossary permission_view_glossary: View glossary
permission_manage_glossary: Manage glossary permission_manage_glossary: Manage glossary
field_name_en: English
field_abbr_whole: Whole word for Abbreviation
field_datatype: Data type for coding
field_codename: Abbreviation for coding
field_rubi: Ruby

View File

@ -14,3 +14,10 @@ ja:
permission_view_glossary: 用語集の閲覧 permission_view_glossary: 用語集の閲覧
permission_manage_glossary: 用語集の管理 permission_manage_glossary: 用語集の管理
field_name_en: 英語名
field_abbr_whole: 略語の展開名称
field_datatype: データ型
field_codename: コーディング用名称例
field_rubi: ふりがな

View File

@ -0,0 +1,9 @@
class AddColumnsToGlossaryTerms < ActiveRecord::Migration[5.1]
def change
add_column :glossary_terms, :name_en, :string, default: ''
add_column :glossary_terms, :rubi, :string, default: ''
add_column :glossary_terms, :abbr_whole, :string, default: ''
add_column :glossary_terms, :datatype, :string, default: ''
add_column :glossary_terms, :codename, :string, default: ''
end
end