リビジョン f78775ac
| app/controllers/glossary_terms_controller.rb | ||
|---|---|---|
|
|
||
|
def index
|
||
|
@glossary_terms = GlossaryTerm.where(project_id: @project.id)
|
||
|
@glossary_terms = @glossary_terms.search_by_name(params[:index]) unless params[:index].nil?
|
||
|
@grouping = params[:grouping]
|
||
|
if not params[:index].nil?
|
||
|
@glossary_terms = @glossary_terms.search_by_name(params[:index])
|
||
|
elsif not params[:index_rubi].nil?
|
||
|
@glossary_terms = @glossary_terms.search_by_rubi(params[:index_rubi])
|
||
|
end
|
||
|
@grouping = params[:grouping] unless params[:grouping].nil?
|
||
|
end
|
||
|
|
||
|
def new
|
||
| app/models/glossary_term.rb | ||
|---|---|---|
|
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
||
|
}
|
||
|
|
||
|
scope :search_by_rubi, -> (keyword) {
|
||
|
where 'rubi like ?', "#{sanitize_sql_like(keyword)}%"
|
||
|
}
|
||
|
|
||
|
end
|
||
| app/views/glossary_terms/_sidebar.html.erb | ||
|---|---|---|
|
</tr>
|
||
|
<% end %>
|
||
|
</table>
|
||
|
<table>
|
||
|
<% l(:index_rubi).each_line do |line| %>
|
||
|
<tr>
|
||
|
<% line.split(" ").each do |char| %>
|
||
|
<td>
|
||
|
<%= link_to char, project_glossary_terms_path(index_rubi: char) %>
|
||
|
</td>
|
||
|
<% end %>
|
||
|
</tr>
|
||
|
<% end %>
|
||
|
</table>
|
||
|
<% end %>
|
||
| config/locales/en.yml | ||
|---|---|---|
|
S T U V W X
|
||
|
Y Z
|
||
|
|
||
|
index_rubi: |
|
||
|
|
||
|
|
||
|
permission_view_glossary: View glossary
|
||
|
permission_manage_glossary: Manage glossary
|
||
|
|
||
| config/locales/ja.yml | ||
|---|---|---|
|
label_grouping: グループ化
|
||
|
label_categorized: カテゴリで分類
|
||
|
|
||
|
index_rubi: |
|
||
|
あ い う え お
|
||
|
か き く け こ
|
||
|
さ し す せ そ
|
||
|
た ち つ て と
|
||
|
な に ぬ ね の
|
||
|
は ひ ふ へ ほ
|
||
|
ま み む め も
|
||
|
や ゆ よ
|
||
|
ら り る れ ろ
|
||
|
わ を ん
|
||
|
|
||
|
|
||
|
permission_view_glossary: 用語集の閲覧
|
||
|
permission_manage_glossary: 用語集の管理
|
||
|
|
||
[phase-11]add index by rubi