[phase-11]add index by rubi
This commit is contained in:
parent
de8ef224d4
commit
f78775ac43
@ -5,8 +5,12 @@ class GlossaryTermsController < ApplicationController
|
||||
|
||||
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
|
||||
|
@ -6,4 +6,8 @@ class GlossaryTerm < ActiveRecord::Base
|
||||
where 'name like ?', "#{sanitize_sql_like(keyword)}%"
|
||||
}
|
||||
|
||||
scope :search_by_rubi, -> (keyword) {
|
||||
where 'rubi like ?', "#{sanitize_sql_like(keyword)}%"
|
||||
}
|
||||
|
||||
end
|
||||
|
@ -35,4 +35,15 @@
|
||||
</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 %>
|
||||
|
@ -23,6 +23,9 @@ en:
|
||||
S T U V W X
|
||||
Y Z
|
||||
|
||||
index_rubi: |
|
||||
|
||||
|
||||
permission_view_glossary: View glossary
|
||||
permission_manage_glossary: Manage glossary
|
||||
|
||||
|
@ -15,6 +15,19 @@ ja:
|
||||
label_grouping: グループ化
|
||||
label_categorized: カテゴリで分類
|
||||
|
||||
index_rubi: |
|
||||
あ い う え お
|
||||
か き く け こ
|
||||
さ し す せ そ
|
||||
た ち つ て と
|
||||
な に ぬ ね の
|
||||
は ひ ふ へ ほ
|
||||
ま み む め も
|
||||
や ゆ よ
|
||||
ら り る れ ろ
|
||||
わ を ん
|
||||
|
||||
|
||||
permission_view_glossary: 用語集の閲覧
|
||||
permission_manage_glossary: 用語集の管理
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user