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
Remove "+ Description" button and show the field directly
Henriette Dargeb4247ef0ed0f
diff --git a/app/components/work_package_relations_tab/add_work_package_child_dialog_component.html.erb b/app/components/work_package_relations_tab/add_work_package_child_dialog_component.html.erbindex 6d087862780..d068472fdcf 100644--- a/app/components/work_package_relations_tab/add_work_package_child_dialog_component.html.erb+++ b/app/components/work_package_relations_tab/add_work_package_child_dialog_component.html.erb@@ -1,9 +1,9 @@<%=render(Primer::Alpha::Dialog.new(title: dialog_title,- size: :xlarge,+ size: :large,id: DIALOG_ID)) do |d|d.with_header(variant: :large)- d.with_body do+ d.with_body(classes: "Overlay-body_autocomplete_height") dorender(WorkPackageRelationsTab::AddWorkPackageChildFormComponent.new(work_package: @work_package))diff --git a/app/components/work_package_relations_tab/work_package_relation_dialog_component.html.erb b/app/components/work_package_relations_tab/work_package_relation_dialog_component.html.erbindex 373f197de3f..d9cf73a50d3 100644--- a/app/components/work_package_relations_tab/work_package_relation_dialog_component.html.erb+++ b/app/components/work_package_relations_tab/work_package_relation_dialog_component.html.erb@@ -1,9 +1,9 @@<%=render(Primer::Alpha::Dialog.new(title: dialog_title,- size: :xlarge,+ size: :large,id: DIALOG_ID)) do |d|d.with_header(variant: :large)- d.with_body do+ d.with_body(classes: "Overlay-body_autocomplete_height") dorender(WorkPackageRelationsTab::WorkPackageRelationFormComponent.new(work_package: @work_package,relation: @relationdiff --git a/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb b/app/components/work_package_relations_tab/work_package_relation_form_component.html.erbindex e4ecf807f32..be40b1ad524 100644--- a/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb+++ b/app/components/work_package_relations_tab/work_package_relation_form_component.html.erb@@ -3,9 +3,7 @@id: FORM_ID,model: @relation,**submit_url_options,- data: { turbo: true,- controller: STIMULUS_CONTROLLER,- application_target: "dynamic" }+ data: { turbo: true }) do |f| %><%# Form fields section %><%= flex_layout(my: 3) do |flex|@@ -20,7 +18,6 @@relation = @relationwork_package = @work_packagetarget_work_package = related_work_package- stimulus_controller = STIMULUS_CONTROLLERi18n_namespace = I18N_NAMESPACEdialog_id = DIALOG_IDto_id_field_test_selector = TO_ID_FIELD_TEST_SELECTOR@@ -61,27 +58,9 @@my_form.text_field(name: :description,label: Relation.human_attribute_name(:description),- hidden: relation.description.blank?,- data: { "#{stimulus_controller}-target": "descriptionField" })endendend %>- <%# Actions section %>- <%= flex_layout(my: 3) do |flex|- flex.with_row do- if @relation.description.blank?- render(Primer::Beta::Button.new(- scheme: :secondary,- title: I18n.t("#{I18N_NAMESPACE}.label_add_description"),- data: { action: "#{STIMULUS_CONTROLLER}#toggleDescriptionField",- "#{STIMULUS_CONTROLLER}-target": "descriptionButton" }- )) do |button|- button.with_leading_visual_icon(icon: :plus)- I18n.t("#{I18N_NAMESPACE}.label_add_description")- end- end- end- end %><% end %><% end %>diff --git a/app/components/work_package_relations_tab/work_package_relation_form_component.rb b/app/components/work_package_relations_tab/work_package_relation_form_component.rbindex 2233e0b0f7a..7dd778e13ac 100644--- a/app/components/work_package_relations_tab/work_package_relation_form_component.rb+++ b/app/components/work_package_relations_tab/work_package_relation_form_component.rb@@ -36,7 +36,6 @@ class WorkPackageRelationsTab::WorkPackageRelationFormComponent < ApplicationComDIALOG_ID = "work-package-relation-dialog"FORM_ID = "work-package-relation-form"TO_ID_FIELD_TEST_SELECTOR = "work-package-relation-form-to-id"- STIMULUS_CONTROLLER = "work-packages--relations-tab--relation-form"I18N_NAMESPACE = "work_package_relations_tab"def initialize(work_package:, relation:, base_errors: nil)diff --git a/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/relation-form.controller.ts b/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/relation-form.controller.tsdeleted file mode 100644index eda94428648..00000000000--- a/frontend/src/stimulus/controllers/dynamic/work-packages/relations-tab/relation-form.controller.ts+++ /dev/null@@ -1,55 +0,0 @@-/*- * -- copyright- * OpenProject is an open source project management software.- * Copyright (C) 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.- * ++- */--import { Controller } from '@hotwired/stimulus';--export default class RelationFormController extends Controller {- static targets = ['descriptionField', 'descriptionButton'];-- declare readonly descriptionFieldTarget:HTMLDivElement;- declare readonly descriptionButtonTarget:HTMLButtonElement;-- toggleDescriptionField():void {- const topLevelTextFieldElement = this.descriptionFieldTarget.closest('primer-text-field') as HTMLElement;- const elements = {- label: topLevelTextFieldElement.querySelector('label') as HTMLLabelElement,- formControl: topLevelTextFieldElement.querySelector('.FormControl-input-wrap') as HTMLElement,- textField: topLevelTextFieldElement,- input: this.descriptionFieldTarget,- };-- // Show description field and its related elements- Object.values(elements).forEach((element) => {- element.hidden = false;- });- // Hide Add description button- this.descriptionButtonTarget.hidden = true;- }-}diff --git a/spec/features/work_packages/details/relations/primerized_relations_spec.rb b/spec/features/work_packages/details/relations/primerized_relations_spec.rbindex 8b4cd4dee87..29e0ed75821 100644--- a/spec/features/work_packages/details/relations/primerized_relations_spec.rb+++ b/spec/features/work_packages/details/relations/primerized_relations_spec.rb@@ -204,7 +204,6 @@ RSpec.describe "Primerized work package relations tab",within "##{WorkPackageRelationsTab::WorkPackageRelationFormComponent::DIALOG_ID}" doexpect(page).to have_text("Add predecessor (before)")- expect(page).to have_button("Add description")autocomplete_field = page.find("[data-test-selector='work-package-relation-form-to-id']")search_autocomplete(autocomplete_field,diff --git a/spec/support/components/work_packages/relations.rb b/spec/support/components/work_packages/relations.rbindex 5fff5daf77e..48369bf45d4 100644--- a/spec/support/components/work_packages/relations.rb+++ b/spec/support/components/work_packages/relations.rb@@ -151,8 +151,6 @@ module Componentsresults_selector: "body")if description.present?- click_link_or_button "Add description"-fill_in "Description", with: descriptionend@@ -183,11 +181,6 @@ module Componentswithin "##{WorkPackageRelationsTab::WorkPackageRelationDialogComponent::DIALOG_ID}" doexpect(page).to have_field("Work package", readonly: true)- expect(page).to have_button("Add description")- expect(page).to have_field("Description", visible: :hidden)-- click_link_or_button "Add description"-expect(page).to have_field("Description")fill_in "Description", with: description