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
Style radio buttons as tiles
Aaron Contreras7b571d0f4074
diff --git a/frontend/src/global_styles/content/_index.sass b/frontend/src/global_styles/content/_index.sassindex eea1f9a0652..ca11404f0dc 100644--- a/frontend/src/global_styles/content/_index.sass+++ b/frontend/src/global_styles/content/_index.sass@@ -14,6 +14,7 @@@import custom_logo@import toast@import toast_mobile+@import tiles@import links@import loading_indicator@import enterprisediff --git a/frontend/src/global_styles/content/_tiles.sass b/frontend/src/global_styles/content/_tiles.sassnew file mode 100644index 00000000000..bdec05bcbac--- /dev/null+++ b/frontend/src/global_styles/content/_tiles.sass@@ -0,0 +1,84 @@+//-- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2023 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.+//++++.form--field+ &.-align-start+ align-items: start++.op-tile-block+ $block: &+ display: grid+ grid-template-rows: repeat(minmax(200px, auto))+ grid-template-columns: auto auto+ grid-gap: 1rem++ &--tile+ border-radius: 10px+ display: grid+ grid-template: auto / 1fr auto+ grid-row-gap: 5px+ justify-items: left+ background: #f7fafc+ min-height: 150px+ padding: 1rem+ border: 1px solid var(--button--border-color)++ &:disabled+ background: #fafafa++ &:hover+ text-decoration: none+ border: 1px solid grey+ border-radius: 10px !important+ cursor: pointer++ &--content+ display: flex+ column-gap: 0.75rem++ .form--radio-button+ margin-top: 0.75rem++ &--image+ display: block+ margin-top: auto+ margin-bottom: auto++ &--title+ padding-top: 0+ padding-bottom: 5px+ color: var(--primary-color-dark)+ display: block+ text-align: left+ font-weight: bolder+ font-size: large++ &--description+ text-align: left+ width: 90%+ font-weight: normaldiff --git a/modules/boards/app/controllers/boards/boards_controller.rb b/modules/boards/app/controllers/boards/boards_controller.rbindex 3b6e7677ca6..1ea820ac258 100644--- a/modules/boards/app/controllers/boards/boards_controller.rb+++ b/modules/boards/app/controllers/boards/boards_controller.rb@@ -1,5 +1,7 @@module ::Boardsclass BoardsController < BaseController+ include ::BoardsHelper+before_action :find_optional_projectbefore_action :build_board_grid, only: %i[new]diff --git a/modules/boards/app/helpers/boards_helper.rb b/modules/boards/app/helpers/boards_helper.rbnew file mode 100644index 00000000000..89aebf6fae1--- /dev/null+++ b/modules/boards/app/helpers/boards_helper.rb@@ -0,0 +1,23 @@+# frozen_string_literal: true++module BoardsHelper+ BoardTypeAttributes = Struct.new(:radio_button_value, :title, :description, :image_path)++ def board_types+ [+ build_board_type_attributes('basic', 'lists'),+ build_board_type_attributes('status', 'status'),+ build_board_type_attributes('assignee', 'assignees'),+ build_board_type_attributes('version', 'version'),+ build_board_type_attributes('subproject', 'subproject'),+ build_board_type_attributes('subtasks', 'parent-child')+ ]+ end++ def build_board_type_attributes(type_name, image_name)+ BoardTypeAttributes.new(type_name,+ I18n.t("boards.board_type_attributes.#{type_name}"),+ I18n.t("boards.board_type_descriptions.#{type_name}"),+ "assets/images/board_creation_modal/#{image_name}.svg")+ end+enddiff --git a/modules/boards/app/services/boards/base_create_service.rb b/modules/boards/app/services/boards/base_create_service.rbindex 26ec585049e..227a359d673 100644--- a/modules/boards/app/services/boards/base_create_service.rb+++ b/modules/boards/app/services/boards/base_create_service.rb@@ -26,8 +26,8 @@ module Boards{}.tap do |grid_params|grid_params[:name] = params[:name]grid_params[:options] = options_for_grid(params)- grid_params[:row_count] = 1- grid_params[:column_count] = column_count_for_grid(params)+ grid_params[:row_count] = row_count_for_board+ grid_params[:column_count] = column_count_for_boardgrid_params[:widgets] = options_for_widgets(params)endenddiff --git a/modules/boards/app/views/boards/boards/_form.html.erb b/modules/boards/app/views/boards/boards/_form.html.erbindex fb8fd545905..a4e496a7314 100644--- a/modules/boards/app/views/boards/boards/_form.html.erb+++ b/modules/boards/app/views/boards/boards/_form.html.erb@@ -57,56 +57,32 @@ See COPYRIGHT and LICENSE files for more details.</div></div>- <div class="form--field -required">- <label class="form--label-with-radio-button" for="board_type"><%= t('boards.label_board_type') %>:</label>-- <div class="form--field">- <%= f.label 'attribute', t('boards.board_type_attributes.basic'), value: 'basic' %>- <%= styled_radio_button_tag 'boards_grid[attribute]',- 'basic',- 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 class="form--field">- <%= f.label 'attribute', t('boards.board_type_attributes.assignee'), value: 'assignee' %>- <%= styled_radio_button_tag 'boards_grid[attribute]',- 'assignee',- no_label: true,- container_class: '-wide'%>- </div>-- <div class="form--field">- <%= f.label 'attribute', t('boards.board_type_attributes.version'), value: 'version' %>- <%= styled_radio_button_tag 'boards_grid[attribute]',- 'version',- no_label: true,- container_class: '-wide'%>- </div>-- <div class="form--field">- <%= f.label 'attribute', t('boards.board_type_attributes.subproject'), value: 'subproject' %>- <%= styled_radio_button_tag 'boards_grid[attribute]',- 'subproject',- no_label: true,- container_class: '-wide'%>- <%= %>- </div>-- <div class="form--field">- <%= f.label 'attribute', t('boards.board_type_attributes.subtasks'), value: 'subtasks' %>- <%= styled_radio_button_tag 'boards_grid[attribute]',- 'subtasks',- no_label: true,- container_class: '-wide'%>+ <div class="form--field -required -align-start">+ <label class="form--label" for="board_type"><%= t('boards.label_board_type') %></label>+ <div class="form--field-container">+ <div class="op-tile-block">+ <% board_types.each do |board_type| %>+ <label class="op-tile-block--tile form--radio-button-container -wide"+ for="boards_grid_attribute_<%= board_type.radio_button_value %>"+ data-qa-selector="op-tile-block">+ <div class="op-tile-block--content">+ <%= styled_radio_button_tag 'boards_grid[attribute]',+ board_type.radio_button_value,+ no_label: true,+ class: 'radio-button' %>+ <div>+ <span data-qa-selector="op-tile-block-title" class="op-tile-block--title">+ <%= board_type.title %>+ </span>+ <p class="op-tile-block--description"><%= board_type.description %></p>+ </div>+ </div>++ <img src="<%= frontend_asset_path board_type.image_path %>"+ class="op-tile-block--image"/>+ </label>+ <% end %>+ </div></div></div></section>diff --git a/modules/boards/config/locales/en.yml b/modules/boards/config/locales/en.ymlindex b8306e55957..03e4b2efd38 100644--- a/modules/boards/config/locales/en.yml+++ b/modules/boards/config/locales/en.yml@@ -19,3 +19,21 @@ en:subproject: Subprojectsubtasks: Parent-childbasic: Basic+ board_type_descriptions:+ basic: >+ Start from scratch with a blank board.+ Manually add cards and columns to this board.+ status: >+ Basic kanban style board with columns for status such as To Do, In Progress, Done.+ assignee: >+ Board with automated columns based on assigned users.+ Ideal for dispatching work packages.+ version: >+ Board with automated columns based on the version attribute.+ Ideal for planning product development.+ subproject: >+ Board with automated columns for subprojects.+ Dragging work packages to other lists updates the (sub-)project accordingly.+ subtasks: >+ Board with automated columns for sub-elements.+ Dragging work packages to other lists updates the parent accordingly.diff --git a/modules/boards/spec/features/support/board_global_create_page.rb b/modules/boards/spec/features/support/board_global_create_page.rbindex db2b9a697c5..15bbc6c9e2f 100644--- a/modules/boards/spec/features/support/board_global_create_page.rb+++ b/modules/boards/spec/features/support/board_global_create_page.rb@@ -30,7 +30,7 @@ module Pagesenddef set_board_type(board_type)- choose board_type+ choose board_type, match: :firstenddef click_on_submit