From 5a76aeee7fdff496330147a0eba9d6ccc3973ad7 Mon Sep 17 00:00:00 2001 From: tohosaku Date: Sun, 20 Mar 2022 03:15:06 +0000 Subject: [PATCH 3/5] Support expand/collapse with svg icons --- app/controllers/icon_sets_controller.rb | 35 ++++++ app/views/calendars/show.html.erb | 2 +- app/views/gantts/show.html.erb | 4 +- app/views/imports/_issues_mapping.html.erb | 2 +- app/views/issues/_list.html.erb | 2 +- app/views/layouts/base.html.erb | 1 + app/views/projects/_list.html.erb | 2 +- app/views/queries/_query_form.html.erb | 4 +- .../repositories/_dir_list_content.html.erb | 16 +-- app/views/roles/permissions.html.erb | 4 +- app/views/search/index.html.erb | 2 +- app/views/timelog/_list.html.erb | 2 +- app/views/trackers/fields.html.erb | 4 +- app/views/wiki/show.html.erb | 2 +- app/views/workflows/edit.html.erb | 4 +- app/views/workflows/permissions.html.erb | 4 +- config/routes.rb | 3 + public/javascripts/application.js | 107 ++++++++++++++++-- 18 files changed, 165 insertions(+), 35 deletions(-) create mode 100644 app/controllers/icon_sets_controller.rb diff --git a/app/controllers/icon_sets_controller.rb b/app/controllers/icon_sets_controller.rb new file mode 100644 index 000000000..f2a1efa55 --- /dev/null +++ b/app/controllers/icon_sets_controller.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Redmine - project management software +# Copyright (C) 2006-2022 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class IconSetsController < ApplicationController + def show + icons = fetch(params[:id]) + if icons.present? + render :json => icons, :content_type => 'application/json' + else + render_404 + end + end + + private + + def fetch(name) + IconSet.fetch(name) + end +end diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 76513f50e..a95cd6f2e 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -8,7 +8,7 @@
"> - "><%= l(:label_filter_plural) %> + <%= tag.legend l(:label_filter_plural), onclick: "toggleFieldset(this);", class: collapsible(@query.new_record?) %>
"> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>
diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index e3bfa02ae..442fc71ea 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -14,14 +14,14 @@
"> - "><%= l(:label_filter_plural) %> + <%= tag.legend l(:label_filter_plural), onclick: 'toggleFieldset(this);', class: collapsible(@query.new_record?) %>
"> <%= render :partial => 'queries/filters', :locals => {:query => @query} %>