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
[52149] Clean menu structure on project lists page (#14724)
Behrokh Satarnejad26fd028c3698
diff --git a/app/components/projects/index_page_header_component.html.erb b/app/components/projects/index_page_header_component.html.erbindex 252b436344b..d0a68460ecb 100644--- a/app/components/projects/index_page_header_component.html.erb+++ b/app/components/projects/index_page_header_component.html.erb@@ -3,40 +3,6 @@<% header.with_title(variant: :large, data: { 'test-selector': 'project-query-name'}) { page_title } %><% header.with_actions do %>- <%= render(- Primer::Beta::Button.new(- tag: :a,- href: activities_path,- size: :medium,- type: :submit,- aria: { label: t(:label_overall_activity) },- mr: BUTTON_MARGIN_RIGHT- )- ) do- t(:label_overall_activity)- end- %>-- <%= render(- Primer::Beta::Button.new(- tag: :a,- href: gantt_portfolio_query_link,- size: :medium,- disabled: gantt_portfolio_project_ids.empty?,- type: :submit,- aria: { label: t('projects.index.open_as_gantt') },- mr: BUTTON_MARGIN_RIGHT,- id: 'projects-index-open-as-gantt',- target: '_blank'- )- ) do |button|- button.with_leading_visual_icon(icon: 'op-view-timeline')- button.with_trailing_visual_icon(icon: 'link-external')- button.with_tooltip(text: gantt_portfolio_title)-- t('projects.index.open_as_gantt')- end %>-<%= render(Primer::Alpha::ActionMenu.new) do |menu|menu.with_show_button(icon: 'op-kebab-vertical', 'aria-label': t(:label_more), data: { 'test-selector': 'project-more-dropdown-menu' })@@ -56,16 +22,6 @@endend- if current_user.admin?- menu.with_item(- label: t('button_configure'),- href: admin_settings_projects_path,- content_arguments: { target: '_blank' }- ) do |item|- item.with_leading_visual_icon(icon: :gear)- end- end-menu.with_item(label: t('js.label_export'),content_arguments: { 'data-show-dialog-id': EXPORT_MODAL_ID }@@ -73,6 +29,26 @@item.with_leading_visual_icon(icon: 'op-file-download')end+ menu.with_item(+ tag: :a,+ label: t(:label_overall_activity),+ href: activities_path+ )++ if gantt_portfolio_project_ids.any?+ menu.with_item(+ tag: :a,+ label: t('projects.index.open_as_gantt'),+ href: gantt_portfolio_query_link,+ id: 'projects-index-open-as-gantt',+ content_arguments: { target: '_blank' }+ ) do |item|+ item.with_leading_visual_icon(icon: 'op-view-timeline')+ item.with_trailing_visual_icon(icon: 'link-external')+ item.with_tooltip(text: gantt_portfolio_title)+ end+ end+if query.persisted?menu.with_item(label: t(:button_delete),diff --git a/spec/features/projects/projects_portfolio_spec.rb b/spec/features/projects/projects_portfolio_spec.rbindex 6f349325dd5..86637c489dd 100644--- a/spec/features/projects/projects_portfolio_spec.rb+++ b/spec/features/projects/projects_portfolio_spec.rb@@ -45,23 +45,24 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,enddescribe 'with no projects on index' do- it 'disables the button' do+ it 'does not show the Gantt menu entry' dovisit projects_pathprojects_page.open_filtersprojects_page.filter_by_active('yes')+ page.find('[data-test-selector="project-more-dropdown-menu"]').click- projects_page.expect_gantt_button(disabled: true)+ projects_page.expect_gantt_menu_entry(visible: false)endenddescribe 'with only an archived project on index' dolet!(:project) { create(:project, active: false) }- it 'disables the button' do+ it 'does not show the Gantt menu entry' dovisit projects_path-- projects_page.expect_gantt_button(disabled: true)+ page.find('[data-test-selector="project-more-dropdown-menu"]').click+ projects_page.expect_gantt_menu_entry(visible: false)endend@@ -129,7 +130,8 @@ RSpec.describe 'Projects index page', :js, :with_cuprite,# Go to project pagevisit projects_path- # Click the gantt button+ # Click the gantt from more menu button+ page.find('[data-test-selector="project-more-dropdown-menu"]').clicknew_window = window_opened_by { click_on 'Open as Gantt view' }switch_to_window new_windowdiff --git a/spec/support/pages/projects/index.rb b/spec/support/pages/projects/index.rbindex 32748cf07d5..dcc49337958 100644--- a/spec/support/pages/projects/index.rb+++ b/spec/support/pages/projects/index.rb@@ -122,9 +122,12 @@ module Pagesexpect(page).to have_no_css('[data-test-selector="project-new-button"]')end- def expect_gantt_button(disabled: false)- expect(page).to have_css("button#{disabled ? '[disabled]' : ''}",- text: 'Open as Gantt view')+ def expect_gantt_menu_entry(visible: false)+ if visible+ expect(page).to have_link('Open as Gantt view')+ else+ expect(page).to have_no_link('Open as Gantt view')+ endenddef filter_by_active(value)@@ -239,7 +242,7 @@ module Pagesdef click_more_menu_item(item)page.find('[data-test-selector="project-more-dropdown-menu"]').click- find('.ActionListItem', text: item).click+ page.find('.ActionListItem', text: item, exact_text: true).clickenddef click_menu_item_of(title, project)