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
WIP: first steps introducing project attributes on project overview page, primerized project attribute editing via dialog
Jonas Jabari2a905987b234
diff --git a/app/models/project.rb b/app/models/project.rbindex 38c30f42c6f..e61525c2b03 100644--- a/app/models/project.rb+++ b/app/models/project.rb@@ -41,6 +41,8 @@ class Project < ApplicationRecord# reserved identifiersRESERVED_IDENTIFIERS = %w(new).freeze+ # belongs_to :project_type ---> mimic `work_package -> type -> custom_fields` structure ?+has_many :members, -> {# TODO: check whether this should# remain to be limited to User onlydiff --git a/app/models/project_custom_field.rb b/app/models/project_custom_field.rbindex 26e2d21eaa0..101be6f0a38 100644--- a/app/models/project_custom_field.rb+++ b/app/models/project_custom_field.rb@@ -27,6 +27,8 @@#++class ProjectCustomField < CustomField+ # belongs_to :project_custom_field_section+def type_name:label_project_pluralenddiff --git a/frontend/src/app/features/overview/overview.component.ts b/frontend/src/app/features/overview/overview.component.tsindex 93b900c79c2..139b1d753fd 100644--- a/frontend/src/app/features/overview/overview.component.ts+++ b/frontend/src/app/features/overview/overview.component.ts@@ -13,6 +13,18 @@ export class OverviewComponent extends GridPageComponent {return 'overviews';}+ protected isTurboFrameSidebarEnabled():boolean {+ return true;+ }++ protected turboFrameSidebarSrc():string {+ return `${this.pathHelper.staticBase}/projects/${this.currentProject.identifier!}/attributes_sidebar`;+ }++ protected turboFrameSidebarId():string {+ return "project-attributes-sidebar";+ }+protected gridScopePath():string {return this.pathHelper.projectPath(this.currentProject.identifier!);}diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.htmlindex 7a98248adcb..202bcfc39fd 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.html@@ -21,6 +21,23 @@</ul></div>- <grid *ngIf="grid" [grid]="grid"></grid>+ <div class="d-flex">+ <div class="flex-1">+ <grid *ngIf="grid" [grid]="grid"></grid>+ </div>+ <div *ngIf="isTurboFrameSidebarEnabled()" class="op-grid-page--sidebar hidden-for-mobile hidden-for-tablet">+ <turbo-frame [src]="turboFrameSidebarSrc()" [id]="turboFrameSidebarId()">+ <op-content-loader viewBox="0 0 100 100">+ <svg:rect x="0" y="0" width="70" height="5" rx="1" />++ <svg:rect x="75" y="0" width="25" height="5" rx="1" />++ <svg:rect x="0" y="10" width="100" height="8" rx="1" />++ <svg:rect x="0" y="25" width="100" height="12" rx="1" />+ </op-content-loader>+ </turbo-frame>+ </div>+ </div></div>diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.sass b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.sassindex c9a867a68b6..f0353432f68 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.sass+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.sass@@ -13,6 +13,11 @@&--toolbar-itemspadding-right: 20px+ &--sidebar+ margin-top: 20px+ margin-right: 20px+ width: 324px+@media only screen and (max-width: $breakpoint-sm).op-grid-page--title-containermargin-left: 0diff --git a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.tsindex b8a738012aa..56cf054414d 100644--- a/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts+++ b/frontend/src/app/shared/components/grids/grid/page/grid-page.component.ts@@ -30,6 +30,10 @@ export abstract class GridPageComponent implements OnInit, OnDestroy {public grid:GridResource;+ protected isTurboFrameSidebarEnabled():boolean {+ return false;+ }+ngOnInit() {this.renderer.addClass(document.body, 'widget-grid-layout');thisdiff --git a/lib/primer/open_project/forms/autocompleter.html.erb b/lib/primer/open_project/forms/autocompleter.html.erbindex 9eb7bbcf65f..bcd50431ed4 100644--- a/lib/primer/open_project/forms/autocompleter.html.erb+++ b/lib/primer/open_project/forms/autocompleter.html.erb@@ -2,8 +2,8 @@<% if decorated_select? %><%= render partial: '/augmented/autocomplete_select_decoration',locals: {- input_name: builder.field_name(@input.name),- input_id: builder.field_id(@input.name),+ input_name: @autocomplete_options.fetch(:inputName) { |key| builder.field_name(@input.name) },+ input_id: @autocomplete_options.fetch(:inputId) { |key| builder.field_id(@input.name) },select_options: select_options.map(&:to_h),multiple: @autocomplete_options.fetch(:multiple, false),key: @autocomplete_options.fetch(:resource, '')@@ -13,8 +13,8 @@data: @autocomplete_options.delete(:data) { {} },inputs: @autocomplete_options.merge(classes: "ng-select--primerized #{@input.invalid? ? '-error' : ''}",- inputName: builder.field_name(@input.name),- inputValue: builder.object.send(@input.name),+ inputName: @autocomplete_options.fetch(:inputName) { |key| builder.field_name(@input.name) },+ inputValue: @autocomplete_options.fetch(:inputValue) { |key| builder.object.send(@input.name) },defaultData: 'true')%>diff --git a/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.html.erb b/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.html.erbnew file mode 100644index 00000000000..7b8062a52b6--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.html.erb@@ -0,0 +1,12 @@+<%=+ flex_layout(align_items: :flex_start, justify_content: :space_between) do |custom_field_value_container|+ # temporarily using inline styles in order to align the content as desired+ custom_field_value_container.with_column(mr: 2, style: "width: 130px;") do+ render(Primer::Beta::Text.new(font_weight: :bold)) { @custom_field_value.custom_field.name }+ end++ custom_field_value_container.with_column(flex: 1) do+ render(Primer::Beta::Text.new()) { formated_value }+ end+ end+%>diff --git a/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.rb b/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.rbnew file mode 100644index 00000000000..a9f86db6c93--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/custom_field_value/show_component.rb@@ -0,0 +1,57 @@+#-- 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.+#++++module ProjectAttributes+ module Section+ module CustomFieldValue+ class ShowComponent < ApplicationComponent+ include ApplicationHelper+ include OpPrimer::ComponentHelpers++ def initialize(custom_field_value:)+ super++ @custom_field_value = custom_field_value+ end++ private++ def formated_value+ case @custom_field_value.custom_field.field_format+ when "text"+ ::OpenProject::TextFormatting::Renderer.format_text(@custom_field_value.typed_value)+ when "date"+ format_date(@custom_field_value.typed_value)+ else+ @custom_field_value.typed_value&.to_s+ end+ end+ end+ end+ end+enddiff --git a/modules/overviews/app/components/project_attributes/section/edit_dialog_component.html.erb b/modules/overviews/app/components/project_attributes/section/edit_dialog_component.html.erbnew file mode 100644index 00000000000..a15d1256416--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/edit_dialog_component.html.erb@@ -0,0 +1,38 @@++<%=+ content_tag("turbo-frame", id: "edit-project-attributes-dialog-frame") do+ component_wrapper do+ primer_form_with(+ model: @project,+ method: :put,+ url: project_update_attributes_path(@project)+ ) do |f|+ component_collection do |collection|+ collection.with_component(Primer::Alpha::Dialog::Body.new(style: "max-height: 500px;")) do+ flex_layout(my: 3) do |flex|+ @custom_field_values.group_by { |cfv| cfv.custom_field_id }.sort.each do |custom_field_id, custom_field_values|+ flex.with_row(mb: 2) do+ render_custom_field_value_input(f, custom_field_id, custom_field_values)+ end+ end+ end+ end+ collection.with_component(Primer::Alpha::Dialog::Footer.new) do+ component_collection do |collection1|+ collection1.with_component(Primer::ButtonComponent.new(+ data: {+ 'close-dialog-id': "edit-project-attributes-dialog"+ }+ )) do+ t("button_cancel")+ end+ collection1.with_component(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) do+ t("button_save")+ end+ end+ end+ end+ end+ end+ end+%>diff --git a/modules/overviews/app/components/project_attributes/section/edit_dialog_component.rb b/modules/overviews/app/components/project_attributes/section/edit_dialog_component.rbnew file mode 100644index 00000000000..471cd359bdd--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/edit_dialog_component.rb@@ -0,0 +1,88 @@+#-- 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.+#++++module ProjectAttributes+ module Section+ class EditDialogComponent < ApplicationComponent+ include ApplicationHelper+ include OpTurbo::Streamable+ include OpPrimer::ComponentHelpers++ def initialize(project:, custom_field_values:)+ super++ @project = project+ @custom_field_values = custom_field_values+ end++ def render_custom_field_value_input(form, custom_field_id, custom_field_values)+ custom_field = CustomField.find(custom_field_id)++ if custom_field.multi_value?+ render_multi_value_custom_field_input(form, custom_field, custom_field_values)+ else+ render_single_value_custom_field_input(form, custom_field, custom_field_values.first)+ end+ end++ def render_single_value_custom_field_input(form, custom_field, custom_field_value)+ case custom_field.field_format+ when "string"+ render(Project::CustomValueForm::String.new(form, custom_field:, custom_field_value:, project: @project))+ when "text"+ render(Project::CustomValueForm::Text.new(form, custom_field:, custom_field_value:, project: @project))+ when "int"+ render(Project::CustomValueForm::Int.new(form, custom_field:, custom_field_value:, project: @project))+ when "float"+ render(Project::CustomValueForm::Float.new(form, custom_field:, custom_field_value:, project: @project))+ when "list"+ render(Project::CustomValueForm::SingleSelectList.new(form, custom_field:, custom_field_value:, project: @project))+ when "date"+ render(Project::CustomValueForm::Date.new(form, custom_field:, custom_field_value:, project: @project))+ when "bool"+ render(Project::CustomValueForm::Bool.new(form, custom_field:, custom_field_value:, project: @project))+ when "user"+ render(Project::CustomValueForm::SingleUserSelectList.new(form, custom_field:, custom_field_value:, project: @project))+ when "version"+ render(Project::CustomValueForm::SingleVersionSelectList.new(form, custom_field:, custom_field_value:, project: @project))+ end+ end++ def render_multi_value_custom_field_input(form, custom_field, custom_field_values)+ case custom_field.field_format+ when "list"+ render(Project::CustomValueForm::MultiSelectList.new(form, custom_field:, custom_field_values:, project: @project))+ when "user"+ render(Project::CustomValueForm::MultiUserSelectList.new(form, custom_field:, custom_field_values:, project: @project))+ when "version"+ render(Project::CustomValueForm::MultiVersionSelectList.new(form, custom_field:, custom_field_values:, project: @project))+ end+ end+ end+ end+enddiff --git a/modules/overviews/app/components/project_attributes/section/show_component.html.erb b/modules/overviews/app/components/project_attributes/section/show_component.html.erbnew file mode 100644index 00000000000..40c30b6328c--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/show_component.html.erb@@ -0,0 +1,30 @@+<%=+ component_wrapper do+ flex_layout(border: :bottom, pb: 2) do |details_container|+ details_container.with_row(mb: 2) do+ flex_layout(align_items: :center, justify_content: :space_between) do |heading|+ heading.with_column(flex: 1) do+ render(Primer::Beta::Heading.new(tag: :h4)) { "Basic info" }+ end++ heading.with_column do+ render(OpTurbo::OpPrimer::AsyncDialogComponent.new(+ id: "edit-project-attributes-dialog",+ src: project_attribute_section_dialog_path(@project),+ size: :medium_portrait,+ title: "Edit basic info",+ button_icon: :pencil,+ button_attributes: { scheme: :invisible }+ ))+ end+ end+ end++ @project.custom_field_values.each do |custom_field_value|+ details_container.with_row(mb: 1) do+ render(ProjectAttributes::Section::CustomFieldValue::ShowComponent.new(custom_field_value: custom_field_value))+ end+ end+ end+ end+%>diff --git a/modules/overviews/app/components/project_attributes/section/show_component.rb b/modules/overviews/app/components/project_attributes/section/show_component.rbnew file mode 100644index 00000000000..b6f127600e9--- /dev/null+++ b/modules/overviews/app/components/project_attributes/section/show_component.rb@@ -0,0 +1,44 @@+#-- 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.+#+++++module ProjectAttributes+ module Section+ class ShowComponent < ApplicationComponent+ include ApplicationHelper+ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ def initialize(project:)+ super++ @project = project+ end+ end+ end+enddiff --git a/modules/overviews/app/components/project_attributes/sidebar_component.html.erb b/modules/overviews/app/components/project_attributes/sidebar_component.html.erbnew file mode 100644index 00000000000..ba2810aeba3--- /dev/null+++ b/modules/overviews/app/components/project_attributes/sidebar_component.html.erb@@ -0,0 +1,7 @@+<%=+ content_tag("turbo-frame", id: "project-attributes-sidebar") do+ component_wrapper do+ render(ProjectAttributes::Section::ShowComponent.new(project: @project))+ end+ end+%>diff --git a/modules/overviews/app/components/project_attributes/sidebar_component.rb b/modules/overviews/app/components/project_attributes/sidebar_component.rbnew file mode 100644index 00000000000..aa7fefa26fb--- /dev/null+++ b/modules/overviews/app/components/project_attributes/sidebar_component.rb@@ -0,0 +1,42 @@+#-- 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.+#+++++module ProjectAttributes+ class SidebarComponent < ApplicationComponent+ include ApplicationHelper+ include OpPrimer::ComponentHelpers+ include OpTurbo::Streamable++ def initialize(project:)+ super++ @project = project+ end+ end+enddiff --git a/modules/overviews/app/controllers/overviews/overviews_controller.rb b/modules/overviews/app/controllers/overviews/overviews_controller.rbindex 09afdaf2957..27c12bc8205 100644--- a/modules/overviews/app/controllers/overviews/overviews_controller.rb+++ b/modules/overviews/app/controllers/overviews/overviews_controller.rb@@ -1,14 +1,121 @@module ::Overviewsclass OverviewsController < ::Grids::BaseInProjectController+ include OpTurbo::ComponentStream+before_action :jump_to_project_menu_itemmenu_item :overview+ def attributes_sidebar+ render(+ ProjectAttributes::SidebarComponent.new(+ project: @project+ ),+ layout: false+ )+ end++ def attribute_section_dialog+ render(+ ProjectAttributes::Section::EditDialogComponent.new(+ project: @project,+ custom_field_values: @project.custom_field_values+ ),+ layout: false+ )+ end++ def update_attributes+ # manual nested attributes update as the project model is not yet natively supporting it+ # needs refactoring++ modified_custom_field_values = []+ has_errors = false+ ActiveRecord::Base.transaction do+ # transaction to rollback if any of the custom field values fails to save+ project_attribute_params[:custom_field_values_attributes]&.each do |custom_value_id, attributes|+ custom_value = CustomValue.find(custom_value_id.to_i)++ custom_value.value = attributes[:value]+ unless custom_value.save+ has_errors = true+ end+ modified_custom_field_values << custom_value+ end++ project_attribute_params[:new_custom_field_values_attributes]&.each do |custom_field_id, attributes|+ custom_value = CustomValue.new(+ custom_field_id: custom_field_id.to_i,+ value: attributes[:value],+ customized_type: "Project",+ customized_id: @project.id+ )++ unless custom_value.save+ has_errors = true+ end+ modified_custom_field_values << custom_value+ end++ # TODO: Cannot detect if all values are removed from a multi value custom field+ # autocompleter does not send '_blank' as value when no option is selected as configured+ project_attribute_params[:multi_custom_field_values_attributes]&.each do |custom_field_id, attributes|+ # Detect removed values+ @project.custom_values+ .where(custom_field_id: custom_field_id.to_i)+ .where.not(value: attributes[:values])+ .destroy_all++ attributes[:values]&.each do |value|+ custom_value = CustomValue.find_or_initialize_by(+ custom_field_id: custom_field_id.to_i,+ value:,+ customized_type: "Project",+ customized_id: @project.id+ )++ unless custom_value.save+ has_errors = true+ end+ modified_custom_field_values << custom_value+ end+ end++ if has_errors+ update_via_turbo_stream(+ component: ProjectAttributes::Section::EditDialogComponent.new(+ project: @project,+ custom_field_values: modified_custom_field_values+ )+ )+ raise ActiveRecord::Rollback+ else+ update_via_turbo_stream(+ component: ProjectAttributes::SidebarComponent.new(+ project: @project+ )+ )+ end+ end++ respond_with_turbo_streams+ end+def jump_to_project_menu_itemif params[:jump]# try to redirect to the requested menu itemredirect_to_project_menu_item(@project, params[:jump]) && returnendend++ private++ def project_attribute_params+ params.require(:project).permit(+ custom_field_values_attributes: [:value],+ new_custom_field_values_attributes: [:value],+ multi_custom_field_values_attributes: [:custom_field_id, { values: [] }]+ )+ endendenddiff --git a/modules/overviews/app/forms/project/custom_value_form/base.rb b/modules/overviews/app/forms/project/custom_value_form/base.rbnew file mode 100644index 00000000000..f01ba20e571--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/base.rb@@ -0,0 +1,62 @@+#-- 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.+#++++class Project::CustomValueForm::Base < ApplicationForm+ def initialize(custom_field:, custom_field_value:, project:)+ @custom_field = custom_field+ @custom_field_value = custom_field_value+ @project = project+ end++ def base_config+ {+ name:,+ id:,+ scope_name_to_model: false,+ scope_id_to_model: false,+ placeholder: @custom_field.name,+ label: @custom_field.name,+ value: @custom_field_value.value,+ required: @custom_field.is_required?,+ invalid: @custom_field_value.errors.any?,+ validation_message: @custom_field_value.errors.any? ? @custom_field_value.errors.full_messages&.join(" ") : nil+ }+ end++ def name+ if @custom_field_value.new_record?+ "project[new_custom_field_values_attributes][#{@custom_field_value.custom_field_id}][value]"+ else+ "project[custom_field_values_attributes][#{@custom_field_value.id}][value]"+ end+ end++ def id+ name.gsub(/[\[\]]/, "_")+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/bool.rb b/modules/overviews/app/forms/project/custom_value_form/bool.rbnew file mode 100644index 00000000000..7be79995201--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/bool.rb@@ -0,0 +1,41 @@+#-- 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.+#++++class Project::CustomValueForm::Bool < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.check_box(**base_config)+ end++ def base_config+ super.merge({+ value: "1",+ unchecked_value: "0",+ checked: @custom_field_value&.typed_value == true+ })+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/date.rb b/modules/overviews/app/forms/project/custom_value_form/date.rbnew file mode 100644index 00000000000..15f40f2fa59--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/date.rb@@ -0,0 +1,37 @@+#-- 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.+#++++class Project::CustomValueForm::Date < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.text_field(**base_config)+ end++ def base_config+ super.merge({ type: "date" })+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/float.rb b/modules/overviews/app/forms/project/custom_value_form/float.rbnew file mode 100644index 00000000000..f68e6e550b9--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/float.rb@@ -0,0 +1,37 @@+#-- 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.+#++++class Project::CustomValueForm::Float < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.text_field(**base_config)+ end++ def base_config+ super.merge({ type: "number", step: :any })+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/int.rb b/modules/overviews/app/forms/project/custom_value_form/int.rbnew file mode 100644index 00000000000..903937c2981--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/int.rb@@ -0,0 +1,37 @@+#-- 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.+#++++class Project::CustomValueForm::Int < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.text_field(**base_config)+ end++ def base_config+ super.merge({ type: "number", step: 1 })+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/multi_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/multi_select_list.rbnew file mode 100644index 00000000000..33f1b3b4714--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/multi_select_list.rb@@ -0,0 +1,72 @@+#-- 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.+#++++class Project::CustomValueForm::MultiSelectList < Project::CustomValueForm::Base+ def initialize(custom_field:, custom_field_values:, project:)+ @custom_field = custom_field+ @custom_field_values = custom_field_values+ @project = project+ end++ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config) do |list|+ @custom_field.custom_options.each do |custom_option|+ list.option(+ label: custom_option.value, value: custom_option.id,+ selected: @custom_field_values.pluck(:value).map { |value| value&.to_i }.include?(custom_option.id)+ )+ end+ end+ end++ private++ def base_config+ {+ name:,+ scope_name_to_model: false,+ scope_id_to_model: false, # autocompleter does not respect scope_id_to_model = false+ placeholder: @custom_field.name,+ label: @custom_field.name,+ required: @custom_field.is_required?,+ include_blank: @custom_field.is_required? ? false : '_blank', # autocompleter does not send '_blank' as value when no option is selected+ autocomplete_options: {+ multiple: true,+ decorated: true,+ inputId: id,+ inputName: name,+ },+ invalid: false,+ validation_message: nil+ }+ end++ def name+ "project[multi_custom_field_values_attributes][#{@custom_field.id}][values]"+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/multi_user_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/multi_user_select_list.rbnew file mode 100644index 00000000000..7ef4b1864b4--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/multi_user_select_list.rb@@ -0,0 +1,74 @@+#-- 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.+#++++class Project::CustomValueForm::MultiUserSelectList < Project::CustomValueForm::Base+ def initialize(custom_field:, custom_field_values:, project:)+ @custom_field = custom_field+ @custom_field_values = custom_field_values+ @project = project+ end++ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config)+ end++ private++ def base_config+ {+ name:,+ scope_name_to_model: false,+ scope_id_to_model: false, # autocompleter does not respect scope_id_to_model = false+ placeholder: @custom_field.name,+ label: @custom_field.name,+ required: @custom_field.is_required?,+ include_blank: @custom_field.is_required? ? false : '_blank', # autocompleter does not send '_blank' as value when no option is selected+ autocomplete_options: {+ multiple: true,+ inputId: id,+ placeholder: "Search for users",+ resource: 'users',+ # filters: [{ name: 'type', operator: '=', values: ['User'] },+ # { name: 'id', operator: '!', values: [::Queries::Filters::MeValue::KEY] }],+ searchKey: 'any_name_attribute',+ inputName: name,+ inputValue: 4,+ # focusDirectly: true,+ # appendTo: 'body',+ # disabled: @disabled+ },+ invalid: false,+ validation_message: nil+ }+ end++ def name+ "project[multi_custom_field_values_attributes][#{@custom_field.id}][values]"+ end++enddiff --git a/modules/overviews/app/forms/project/custom_value_form/multi_version_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/multi_version_select_list.rbnew file mode 100644index 00000000000..c2ec51fb15c--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/multi_version_select_list.rb@@ -0,0 +1,73 @@+#-- 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.+#++++class Project::CustomValueForm::MultiVersionSelectList < Project::CustomValueForm::Base+ def initialize(custom_field:, custom_field_values:, project:)+ @custom_field = custom_field+ @custom_field_values = custom_field_values+ @project = project+ end++ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config) do |list|+ @project.versions.each do |version|+ list.option(+ label: version.name, value: version.id,+ selected: @custom_field_values.pluck(:value).map { |value| value&.to_i }.include?(version.id)+ )+ end+ end+ end++ private++ def base_config+ {+ name:,+ scope_name_to_model: false,+ scope_id_to_model: false, # autocompleter does not respect scope_id_to_model = false+ placeholder: @custom_field.name,+ label: @custom_field.name,+ required: @custom_field.is_required?,+ include_blank: @custom_field.is_required? ? false : '_blank', # autocompleter does not send '_blank' as value when no option is selected+ autocomplete_options: {+ multiple: true,+ decorated: true,+ inputId: id,+ inputName: name,+ },+ invalid: false,+ validation_message: nil+ }+ end++ def name+ "project[multi_custom_field_values_attributes][#{@custom_field.id}][values]"+ end++enddiff --git a/modules/overviews/app/forms/project/custom_value_form/single_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/single_select_list.rbnew file mode 100644index 00000000000..e05ff913db0--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/single_select_list.rb@@ -0,0 +1,54 @@+#-- 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.+#++++class Project::CustomValueForm::SingleSelectList < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config) do |list|+ @custom_field_value.custom_field.custom_options.each do |custom_option|+ list.option(+ label: custom_option.value, value: custom_option.id,+ selected: custom_option.id == @custom_field_value.value&.to_i+ )+ end+ end+ end++ def base_config+ super.merge(+ {+ include_blank: @custom_field.is_required? ? false : '_blank', # autocompleter does not send '_blank' as value when no option is selected+ autocomplete_options: {+ multiple: false,+ decorated: true,+ inputId: id,+ inputName: name+ }+ }+ )+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/single_user_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/single_user_select_list.rbnew file mode 100644index 00000000000..52471ef373c--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/single_user_select_list.rb@@ -0,0 +1,51 @@+#-- 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.+#++++class Project::CustomValueForm::SingleUserSelectList < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config)+ end++ def base_config+ super.merge({+ autocomplete_options: {+ inputId: id,+ placeholder: "Search for a user",+ resource: 'users',+ # filters: [{ name: 'type', operator: '=', values: ['User'] },+ # { name: 'id', operator: '!', values: [::Queries::Filters::MeValue::KEY] }],+ searchKey: 'any_name_attribute',+ inputName: name,+ inputValue: @custom_field_value&.value&.to_i || '',+ # focusDirectly: true,+ # appendTo: 'body',+ # disabled: @disabled+ }+ })+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/single_version_select_list.rb b/modules/overviews/app/forms/project/custom_value_form/single_version_select_list.rbnew file mode 100644index 00000000000..5437fa2f82f--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/single_version_select_list.rb@@ -0,0 +1,55 @@+#-- 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.+#++++class Project::CustomValueForm::SingleVersionSelectList < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.autocompleter(**base_config) do |list|+ @project.versions.each do |version|+ list.option(+ label: version.name, value: version.id,+ selected: version.id == @custom_field_value.value&.to_i+ )+ end+ end+ end++ def base_config+ super.merge(+ {+ include_blank: @custom_field.is_required? ? false : '_blank', # autocompleter does not send '_blank' as value when no option is selected+ autocomplete_options: {+ multiple: false,+ decorated: true,+ inputId: id,+ inputName: name,+ }+ }+ )+ end++enddiff --git a/modules/overviews/app/forms/project/custom_value_form/string.rb b/modules/overviews/app/forms/project/custom_value_form/string.rbnew file mode 100644index 00000000000..e301c10da3c--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/string.rb@@ -0,0 +1,33 @@+#-- 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.+#++++class Project::CustomValueForm::String < Project::CustomValueForm::Base+ form do |custom_value_form|+ custom_value_form.text_field(**base_config)+ end+enddiff --git a/modules/overviews/app/forms/project/custom_value_form/text.rb b/modules/overviews/app/forms/project/custom_value_form/text.rbnew file mode 100644index 00000000000..6c66afda1ac--- /dev/null+++ b/modules/overviews/app/forms/project/custom_value_form/text.rb@@ -0,0 +1,38 @@+#-- 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.+#++++class Project::CustomValueForm::Text < Project::CustomValueForm::Base+ form do |custom_value_form|+ # TODO: rich_text_area not working yet+ # Uncaught DOMException: Failed to execute 'querySelector' on 'Element': '#project_project[new_custom_field_values_attributes][xyz][value]' is not a valid selector.+ # --> rich_text_area is not using the configured id, which is not scoped to model via base_config+ # --> ids with '[' ']' are not valid selectors+ # using simple text area for now+ custom_value_form.text_area(**base_config)+ end+enddiff --git a/modules/overviews/config/routes.rb b/modules/overviews/config/routes.rbindex 81d5c874867..64730d6247e 100644--- a/modules/overviews/config/routes.rb+++ b/modules/overviews/config/routes.rb@@ -1,6 +1,8 @@OpenProject::Application.routes.draw do- get 'projects/:project_id',- to: "overviews/overviews#show",- as: :project_overview,- constraints: { format: :html, project_id: Regexp.new("(?!(#{Project::RESERVED_IDENTIFIERS.join('|')})$)(\\w|-)+") }+ constraints(project_id: Regexp.new("(?!(#{Project::RESERVED_IDENTIFIERS.join('|')})$)(\\w|-)+")) do+ get 'projects/:project_id', to: "overviews/overviews#show", as: :project_overview, format: :html+ get 'projects/:project_id/attributes_sidebar', to: "overviews/overviews#attributes_sidebar", as: :project_attributes_sidebar, format: :html+ get 'projects/:project_id/attribute_section_dialog', to: "overviews/overviews#attribute_section_dialog", as: :project_attribute_section_dialog, format: :html+ put 'projects/:project_id/attributes', to: "overviews/overviews#update_attributes", as: :project_update_attributes, format: :html+ endenddiff --git a/modules/overviews/lib/overviews/engine.rb b/modules/overviews/lib/overviews/engine.rbindex 977be0cefb1..3463838867b 100644--- a/modules/overviews/lib/overviews/engine.rb+++ b/modules/overviews/lib/overviews/engine.rb@@ -46,12 +46,21 @@ module OverviewsRails.application.reloader.to_prepare doOpenProject::AccessControl.permission(:view_project).controller_actions- .push('overviews/overviews/show')+ .push(+ 'overviews/overviews/show',+ 'overviews/overviews/attributes_sidebar',+ 'overviews/overviews/attribute_section_dialog',+ 'overviews/overviews/update_attributes'+ )OpenProject::AccessControl.map do |ac_map|ac_map.project_module nil do |map|map.permission :manage_overview,- { 'overviews/overviews': ['show'] },+ { 'overviews/overviews':+ [+ 'show', 'attributes_sidebar', 'attribute_section_dialog', 'update_attributes'+ ]+ },permissible_on: :project,require: :memberend