diff --git a/app/controllers/glossary_terms_controller.rb b/app/controllers/glossary_terms_controller.rb index 6292367..12aa62b 100644 --- a/app/controllers/glossary_terms_controller.rb +++ b/app/controllers/glossary_terms_controller.rb @@ -6,6 +6,7 @@ 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] end def new diff --git a/app/views/glossary_terms/_index_in_category.html.erb b/app/views/glossary_terms/_index_terms.html.erb similarity index 100% rename from app/views/glossary_terms/_index_in_category.html.erb rename to app/views/glossary_terms/_index_terms.html.erb diff --git a/app/views/glossary_terms/_sidebar.html.erb b/app/views/glossary_terms/_sidebar.html.erb index dda5e16..4232024 100644 --- a/app/views/glossary_terms/_sidebar.html.erb +++ b/app/views/glossary_terms/_sidebar.html.erb @@ -1,6 +1,17 @@ <% content_for :sidebar do %>
<%= link_to_if_authorized l(:label_glossary_term_new), { controller: :glossary_terms, action: :new, project_id: @project }, diff --git a/app/views/glossary_terms/index.html.erb b/app/views/glossary_terms/index.html.erb index 3e237a8..5d5a996 100644 --- a/app/views/glossary_terms/index.html.erb +++ b/app/views/glossary_terms/index.html.erb @@ -8,15 +8,19 @@ <%= render partial: 'sidebar' %> -<% categorized_terms = @glossary_terms.reject { |t| t.category_id.nil? } %> -<% uncategorized_terms = @glossary_terms.where(category_id: nil) %> +<% if @grouping == '1' %> + <% 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| %> -