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
Add link to project activity page when clicking on menu item
Mir Bhatia6d7413fc1319
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rbindex 7f9c61425dd..25f700d4af2 100644--- a/app/helpers/projects_helper.rb+++ b/app/helpers/projects_helper.rb@@ -96,7 +96,7 @@ module ProjectsHelperif project.enabled_module_names.include?('activity')[t(:label_project_activity),- project_activity_index_path(project),+ project_activity_index_path(project, event_types: ['project_attributes']),{ class: 'icon-context icon-checkmark',title: t(:label_project_activity) }]diff --git a/spec/features/projects/projects_index_spec.rb b/spec/features/projects/projects_index_spec.rbindex 692dc787455..c690ffc8360 100644--- a/spec/features/projects/projects_index_spec.rb+++ b/spec/features/projects/projects_index_spec.rb@@ -31,13 +31,13 @@ require 'spec_helper'describe 'Projects index page',js: true,with_settings: { login_required?: false } do- shared_let(:admin) { create :admin }+ shared_let(:admin) { create(:admin) }- shared_let(:manager) { create :role, name: 'Manager' }- shared_let(:developer) { create :role, name: 'Developer' }+ shared_let(:manager) { create(:role, name: 'Manager') }+ shared_let(:developer) { create(:role, name: 'Developer') }- shared_let(:custom_field) { create :project_custom_field }- shared_let(:invisible_custom_field) { create :project_custom_field, visible: false }+ shared_let(:custom_field) { create(:project_custom_field) }+ shared_let(:invisible_custom_field) { create(:project_custom_field, visible: false) }shared_let(:project) docreate(:project,@@ -263,9 +263,9 @@ describe 'Projects index page',# Results should be filtered and ordered ASC by nameexpect(page).to have_text(development_project.name)- expect(page).to have_no_text(project.name) # as it filtered away+ expect(page).not_to have_text(project.name) # as it filtered awayexpect(page).to have_text('Next') # as the result set is larger than 1- expect(page).to have_no_text(public_project.name) # as it is on the second page+ expect(page).not_to have_text(public_project.name) # as it is on the second page# Changing the page size to 5 and back to 1 should not change the filters (which we test later on the second page)SeleniumHubWaiter.wait@@ -277,9 +277,9 @@ describe 'Projects index page',# On page 2 you should see the second page of the filtered set ordered ASC by nameexpect(page).to have_text(public_project.name)- expect(page).to have_no_text(project.name) # Filtered away- expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.- expect(page).to have_no_text(development_project.name) # That one should be on page 1+ expect(page).not_to have_text(project.name) # Filtered away+ expect(page).not_to have_text('Next') # Filters kept active, so there is no third page.+ expect(page).not_to have_text(development_project.name) # That one should be on page 1# Sorts DESC by nameSeleniumHubWaiter.wait@@ -287,9 +287,9 @@ describe 'Projects index page',# On page 2 the same filters should still be intact but the order should be DESC on nameexpect(page).to have_text(development_project.name)- expect(page).to have_no_text(project.name) # Filtered away- expect(page).to have_no_text('Next') # Filters kept active, so there is no third page.- expect(page).to have_no_text(public_project.name) # That one should be on page 1+ expect(page).not_to have_text(project.name) # Filtered away+ expect(page).not_to have_text('Next') # Filters kept active, so there is no third page.+ expect(page).not_to have_text(public_project.name) # That one should be on page 1expect(page).to have_selector('.sort.desc', text: 'NAME')# Sending the filter form again what implies to compose the request freshly@@ -299,8 +299,8 @@ describe 'Projects index page',# We should see page 1, resetting pagination, as it is a new filter, but keeping the DESC order on the project# nameexpect(page).to have_text(public_project.name)- expect(page).to have_no_text(development_project.name) # as it is on the second page- expect(page).to have_no_text(project.name) # as it filtered away+ expect(page).not_to have_text(development_project.name) # as it is on the second page+ expect(page).not_to have_text(project.name) # as it filtered awayexpect(page).to have_text('Next') # as the result set is larger than 1expect(page).to have_selector('.sort.desc', text: 'NAME')end@@ -321,7 +321,7 @@ describe 'Projects index page',expect(page).to have_text(development_project.name)expect(page).to have_text(public_project.name)- expect(page).to have_no_text(project.name)+ expect(page).not_to have_text(project.name)# Filter on model attribute 'identifier'SeleniumHubWaiter.wait@@ -335,8 +335,8 @@ describe 'Projects index page',click_on 'Apply'expect(page).to have_text(project.name)- expect(page).to have_no_text(development_project.name)- expect(page).to have_no_text(public_project.name)+ expect(page).not_to have_text(development_project.name)+ expect(page).not_to have_text(public_project.name)enddescribe 'Active or archived' do@@ -368,9 +368,9 @@ describe 'Projects index page',projects_page.click_menu_item_of('Archive', parent_project)projects_page.accept_alert_dialog!- expect(page).to have_no_text(parent_project.name)+ expect(page).not_to have_text(parent_project.name)# The child project gets archived automatically- expect(page).to have_no_text(child_project.name)+ expect(page).not_to have_text(child_project.name)expect(page).to have_text('Plain project')expect(page).to have_text('Development project')expect(page).to have_text('Public project')@@ -416,7 +416,7 @@ describe 'Projects index page',projects_page.filter_by_active('yes')expect(page).to have_text(parent_project.name)- expect(page).to have_no_text(child_project.name)+ expect(page).not_to have_text(child_project.name)expect(page).to have_text('Plain project')expect(page).to have_text('Development project')expect(page).to have_text('Public project')@@ -513,8 +513,8 @@ describe 'Projects index page',describe 'other filter types' doinclude ActiveSupport::Testing::TimeHelpers- shared_let(:list_custom_field) { create :list_project_custom_field }- shared_let(:date_custom_field) { create :date_project_custom_field }+ shared_let(:list_custom_field) { create(:list_project_custom_field) }+ shared_let(:date_custom_field) { create(:date_project_custom_field) }shared_let(:datetime_of_this_week) dotoday = Date.current# Ensure that the date is not today but still in the middle of the week to not run into week-start-issues here.@@ -737,7 +737,7 @@ describe 'Projects index page',click_on 'Apply'expect(page).to have_text(project_created_on_today.name)- expect(page).to have_no_text(project_created_on_fixed_date.name)+ expect(page).not_to have_text(project_created_on_fixed_date.name)endpending "NOT WORKING YET: Date vs. DateTime issue: Selecting same date for from and to value shows projects of that date"@@ -754,7 +754,7 @@ describe 'Projects index page',projects_page.filter_by_public('no')expect(page).to have_text(project.name)- expect(page).to have_no_text(public_project.name)+ expect(page).not_to have_text(public_project.name)load_and_open_filters admin@@ -762,17 +762,17 @@ describe 'Projects index page',projects_page.filter_by_public('yes')expect(page).to have_text(public_project.name)- expect(page).to have_no_text(project.name)+ expect(page).not_to have_text(project.name)endendenddescribe 'Non-admins with role with permission' doshared_let(:can_copy_projects_role) do- create :role, name: 'Can Copy Projects Role', permissions: [:copy_projects]+ create(:role, name: 'Can Copy Projects Role', permissions: [:copy_projects])endshared_let(:can_add_subprojects_role) do- create :role, name: 'Can Add Subprojects Role', permissions: [:add_subprojects]+ create(:role, name: 'Can Add Subprojects Role', permissions: [:add_subprojects])endshared_let(:parent_project) do@@ -806,6 +806,7 @@ describe 'Projects index page',project.update(created_at: 7.days.ago)+ parent_project.enabled_module_names -= ["activity"]newsend@@ -861,15 +862,15 @@ describe 'Projects index page',# Test admin only properties are invisiblewithin('#project-table') doexpect(page)- .to have_no_selector('th', text: 'REQUIRED DISK STORAGE')+ .not_to have_selector('th', text: 'REQUIRED DISK STORAGE')expect(page)- .to have_no_selector('th', text: 'CREATED ON')+ .not_to have_selector('th', text: 'CREATED ON')expect(page)- .to have_no_selector('td', text: project.created_at.strftime('%m/%d/%Y'))+ .not_to have_selector('td', text: project.created_at.strftime('%m/%d/%Y'))expect(page)- .to have_no_selector('th', text: 'LATEST ACTIVITY AT')+ .not_to have_selector('th', text: 'LATEST ACTIVITY AT')expect(page)- .to have_no_selector('td', text: news.created_at.strftime('%m/%d/%Y'))+ .not_to have_selector('td', text: news.created_at.strftime('%m/%d/%Y'))endendend@@ -1011,19 +1012,13 @@ describe 'Projects index page',describe 'project activity menu item' docontext 'for projects with activity module enabled' doshared_let(:project_with_activity_enabled) { project }- shared_let(:can_copy_projects_role) do- create(:role, name: 'Can Copy Projects Role', permissions: [:copy_projects])- end- shared_let(:can_copy_projects_manager) do- create(:user,- member_in_project: project_with_activity_enabled,- member_through_role: can_copy_projects_role)- end+ shared_let(:work_packages_viewer) { create(:role, name: 'Viewer', permissions: [:view_work_packages]) }shared_let(:simple_member) docreate(:user,member_in_project: project_with_activity_enabled,- member_through_role: developer)+ member_through_role: work_packages_viewer)end+ shared_let(:work_package) { create(:work_package, project: project_with_activity_enabled) }before doproject_with_activity_enabled.enabled_module_names += ["activity"]@@ -1031,10 +1026,7 @@ describe 'Projects index page',endit 'is displayed' do- # For a simple project member the 'More' menu is not visible.- # that's why we're using a user with can_copy_projects_role permission- # TODO: use simple_member instead and ensure the test still passes- login_as(can_copy_projects_manager)+ login_as(simple_member)visit projects_pathexpect(page).to have_text(project.name)@@ -1048,15 +1040,23 @@ describe 'Projects index page',page.find('tbody tr .icon-show-more-horizontal').clickmenu = page.find('tbody tr .project-actions')- # expect(menu).to have_text('Copy')expect(menu).to have_text(I18n.t(:label_project_activity))end- end- it 'redirects to project activity page with only project attributes visible'- end+ it 'redirects to project activity page with only project attributes visible' do+ login_as(simple_member)+ visit projects_path++ page.find('tbody tr').hover+ page.find('tbody tr .icon-show-more-horizontal').click- context 'for projects with activity module disabled' do- it 'is not displayed'+ menu = page.find('tbody tr .project-actions')+ menu.find_link(text: I18n.t(:label_project_activity)).click++ expect(page).to have_current_path(project_activity_index_path(project_with_activity_enabled), ignore_query: true)+ expect(page).to have_checked_field(id: 'event_types_project_attributes')+ expect(page).to have_unchecked_field(id: 'event_types_work_packages')+ end+ endendend