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 ability to create "Status" boards globally
Aaron Contreras127d9ec77fd1
diff --git a/modules/boards/app/services/boards/global_create_service.rb b/modules/boards/app/services/boards/global_create_service.rbindex ea27540e118..e6d2cc0313a 100644--- a/modules/boards/app/services/boards/global_create_service.rb+++ b/modules/boards/app/services/boards/global_create_service.rb@@ -54,16 +54,22 @@ module Boardsdef query_name(params){- 'basic' => 'Unnamed list'+ 'basic' => 'Unnamed list',+ 'status' => default_status.name}.fetch(params[:attribute])enddef query_filters(params){- 'basic' => [{ manual_sort: { operator: 'ow', values: [] } }]+ 'basic' => [{ manual_sort: { operator: 'ow', values: [] } }],+ 'status' => [{ status_id: { operator: '=', values: [default_status.id] } }]}.fetch(params[:attribute])end+ def default_status+ @default_status ||= ::Status.default+ end+def options_for_grid(params){}.tap do |options|options[:attribute] = params[:attribute]@@ -89,6 +95,19 @@ module Boards"filters" => query_filters(params)})+ ],+ 'status' => [+ Grids::Widget.new(+ start_row: 1,+ start_column: 1,+ end_row: 2,+ end_column: 2,+ identifier: "work_package_query",+ options: {+ "queryId" => params[:query_id],+ "filters" => query_filters(params)+ }+ )]}.fetch(params[:attribute])enddiff --git a/modules/boards/app/views/boards/boards/_form.html.erb b/modules/boards/app/views/boards/boards/_form.html.erbindex 7d360c361de..0c280ec5ee9 100644--- a/modules/boards/app/views/boards/boards/_form.html.erb+++ b/modules/boards/app/views/boards/boards/_form.html.erb@@ -67,5 +67,13 @@ See COPYRIGHT and LICENSE files for more details.no_label: true,container_class: '-wide'%></div>++ <div class="form--field">+ <%= f.label 'attribute', t('boards.board_type_attributes.status'), value: 'status' %>+ <%= styled_radio_button_tag 'boards_grid[attribute]',+ 'status',+ no_label: true,+ container_class: '-wide'%>+ </div></div></section>diff --git a/modules/boards/spec/features/boards_global_create_spec.rb b/modules/boards/spec/features/boards_global_create_spec.rbindex 83c1e632e97..8cc4f00bcf4 100644--- a/modules/boards/spec/features/boards_global_create_spec.rb+++ b/modules/boards/spec/features/boards_global_create_spec.rb@@ -63,6 +63,22 @@ RSpec.describe 'Boards',expect(page).to have_text "Gotham Renewal Board"endend++ context 'when creating a "Status" board' do+ before do+ new_board_page.set_board_type 'Status'+ new_board_page.click_on_submit++ wait_for_reload+ end++ it 'creates the board and redirects me to it' do+ expect(page).to have_text(I18n.t(:notice_successful_create))+ expect(page).to have_current_path("/projects/#{project.identifier}/boards/#{Boards::Grid.last.id}")+ expect(page).to have_text "Gotham Renewal Board"+ expect(page).to have_selector("[data-query-name='#{status.name}']")+ end+ endendendend