diff --git a/app/views/glossary_terms/_index_in_category.html.erb b/app/views/glossary_terms/_index_in_category.html.erb new file mode 100644 index 0000000..81015f8 --- /dev/null +++ b/app/views/glossary_terms/_index_in_category.html.erb @@ -0,0 +1,28 @@ + + + + + + + + + + + <% terms.each do |term| %> + + + + + + + <% end %> + +
#<%=l :field_name %><%=l :field_category %><%=l :field_description %>
+ <%= term.id %> + + <%= link_to term.name, [@project, term] %> + + <%= term.category.try!(:name) %> + + <%= term.description %> +
diff --git a/app/views/glossary_terms/index.html.erb b/app/views/glossary_terms/index.html.erb index a9d6326..3e237a8 100644 --- a/app/views/glossary_terms/index.html.erb +++ b/app/views/glossary_terms/index.html.erb @@ -8,31 +8,15 @@ <%= render partial: 'sidebar' %> - - - - - - - - - - - <% @glossary_terms.each do |term| %> - - - - - - - <% end %> - -
#<%=l :field_name %><%=l :field_category %><%=l :field_description %>
- <%= term.id %> - - <%= link_to term.name, [@project, term] %> - - <%= term.category.try!(:name) %> - - <%= term.description %> -
+<% categorized_terms = @glossary_terms.reject { |t| t.category_id.nil? } %> +<% uncategorized_terms = @glossary_terms.where(category_id: nil) %> + +<% categorized_terms.group_by(&:category).each do |category, terms| %> +

<%= category.name %>

+ <%= render partial: 'index_in_category', locals: {terms: terms} %> +<% end %> + +

<%=l :label_not_categorized %>

+<%= render 'index_in_category', terms: uncategorized_terms %> + + diff --git a/config/locales/en.yml b/config/locales/en.yml index 22d97eb..238ea40 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -12,7 +12,8 @@ en: label_view: View label_glossary_index: index - + label_not_categorized: Not categorized + index_en: | A B C D E F G H I J K L diff --git a/config/locales/ja.yml b/config/locales/ja.yml index ebc1266..d997de3 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -10,7 +10,8 @@ ja: project_module_glossary: 用語集 label_view: 表示 - label_glossary_index: 索引 + label_glossary_index: 索引 + label_not_categorized: 未分類 permission_view_glossary: 用語集の閲覧 permission_manage_glossary: 用語集の管理