OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
move exporting into modal component
ulfertsa036d5cc2e83
diff --git a/app/components/projects/export_list_modal_component.html.erb b/app/components/projects/export_list_modal_component.html.erbnew file mode 100644index 00000000000..4d338159009--- /dev/null+++ b/app/components/projects/export_list_modal_component.html.erb@@ -0,0 +1,21 @@+<%= render(Primer::Alpha::Dialog.new(title: t('js.label_export'),+ id: MODAL_ID)) do |d| %>+ <% d.with_header(variant: :large) %>+ <% d.with_body do %>+ <ul class="op-export-options"+ data-controller="params-from-query"+ data-application-target="dynamic"+ data-params-from-query-all-anchors-value="true"+ data-params-from-query-allowed-value='["query_id", "filters", "sortBy", "columns"]'>+ <% helpers.supported_export_formats.each do |key| %>+ <li class="op-export-options--option">+ <%= link_to url_for(action: 'index', format: key),+ class: 'op-export-options--option-link' do %>+ <%= helpers.op_icon("icon-big icon-export-#{key}") %>+ <span class="op-export-options--option-label"><%= t("export.format.#{key}") %></span>+ <% end %>+ </li>+ <% end %>+ </ul>+ <% end %>+<% end %>diff --git a/app/components/projects/export_list_modal_component.rb b/app/components/projects/export_list_modal_component.rbnew file mode 100644index 00000000000..601cc29649a--- /dev/null+++ b/app/components/projects/export_list_modal_component.rb@@ -0,0 +1,35 @@+# frozen_string_literal: true++# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2010-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# 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.+#+# See COPYRIGHT and LICENSE files for more details.+# ++++class Projects::ExportListModalComponent < ApplicationComponent # rubocop:disable OpenProject/AddPreviewForViewComponent+ MODAL_ID = 'op-project-list-export-dialog'++ options :query+enddiff --git a/app/components/projects/index_page_header_component.html.erb b/app/components/projects/index_page_header_component.html.erbindex 55bce5bffac..465ef939906 100644--- a/app/components/projects/index_page_header_component.html.erb+++ b/app/components/projects/index_page_header_component.html.erb@@ -44,7 +44,7 @@menu.with_item(label: t('js.label_export'),- content_arguments: { 'data-show-dialog-id': EXPORT_MODAL_ID }+ content_arguments: { 'data-show-dialog-id': Projects::ExportListModalComponent::MODAL_ID }) do |item|item.with_leading_visual_icon(icon: 'sign-out')end@@ -87,15 +87,7 @@<% end %><% if show_state? %>- <%# TODO: move into a component %>- <%= render(Primer::Alpha::Dialog.new(title: t('js.label_export'),- id: EXPORT_MODAL_ID)) do |d|- d.with_header(variant: :large)- d.with_body do- render partial: '/projects/project_export_modal'- end- end %>-<%= render(Projects::ConfigureViewModalComponent.new(query:)) %><%= render(Projects::DeleteListModalComponent.new(query:)) if query.persisted? %>+ <%= render(Projects::ExportListModalComponent.new(query:)) %><% end %>diff --git a/app/components/projects/index_page_header_component.rb b/app/components/projects/index_page_header_component.rbindex e6c1c4bcbeb..f0eb2863617 100644--- a/app/components/projects/index_page_header_component.rb+++ b/app/components/projects/index_page_header_component.rb@@ -38,7 +38,6 @@ class Projects::IndexPageHeaderComponent < ApplicationComponent:paramsBUTTON_MARGIN_RIGHT = 2- EXPORT_MODAL_ID = 'op-project-list-export-dialog'STATE_DEFAULT = :showSTATE_EDIT = :editdiff --git a/app/views/projects/_project_export_modal.html.erb b/app/views/projects/_project_export_modal.html.erbdeleted file mode 100644index cc000ec3482..00000000000--- a/app/views/projects/_project_export_modal.html.erb+++ /dev/null@@ -1,44 +0,0 @@-<%#-- copyright-OpenProject is an open source project management software.-Copyright (C) 2012-2024 the OpenProject GmbH--This program is free software; you can redistribute it and/or-modify it under the terms of the GNU General Public License version 3.--OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-Copyright (C) 2006-2013 Jean-Philippe Lang-Copyright (C) 2010-2013 the ChiliProject Team--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.--See COPYRIGHT and LICENSE files for more details.--++#%>--<ul class="op-export-options"- data-controller="params-from-query"- data-application-target="dynamic"- data-params-from-query-all-anchors-value="true"- data-params-from-query-allowed-value='["query_id", "filters", "sortBy", "columns"]'>- <% supported_export_formats.each do |key| %>- <li class="op-export-options--option">- <%= link_to url_for(action: 'index', format: key),- class: 'op-export-options--option-link' do %>- <%= op_icon("icon-big icon-export-#{key}") %>- <span class="op-export-options--option-label"><%= t("export.format.#{key}") %></span>- <% end %>- </li>- <% end %>-</ul>