A platform for community discussion. Free, open, simple.
FIX: edit custom section title (#20258)
Krzysztof Kotlarekca7131648f00
diff --git a/app/assets/javascripts/discourse/app/controllers/sidebar-section-form.js b/app/assets/javascripts/discourse/app/controllers/sidebar-section-form.jsindex 318b50c4c9f..33623e16e7a 100644--- a/app/assets/javascripts/discourse/app/controllers/sidebar-section-form.js+++ b/app/assets/javascripts/discourse/app/controllers/sidebar-section-form.js@@ -203,6 +203,12 @@ export default Controller.extend(ModalFunctionality, {return this.model.links.filter((link) => !link._destroy);},+ get header() {+ return this.model.id+ ? "sidebar.sections.custom.edit"+ : "sidebar.sections.custom.add";+ },+actions: {addLink() {this.model.links.pushObject(new SectionLink({ router: this.router }));diff --git a/app/assets/javascripts/discourse/app/templates/modal/sidebar-section-form.hbs b/app/assets/javascripts/discourse/app/templates/modal/sidebar-section-form.hbsindex 66c864a0ca3..3e21bd08d3e 100644--- a/app/assets/javascripts/discourse/app/templates/modal/sidebar-section-form.hbs+++ b/app/assets/javascripts/discourse/app/templates/modal/sidebar-section-form.hbs@@ -3,7 +3,7 @@{{this.flashText}}</div>{{/if}}-<DModalBody @title="sidebar.sections.custom.add">+<DModalBody @title={{this.header}}><form class="form-horizontal"><div class="input-group"><label for="section-name">{{i18n "sidebar.sections.custom.name"}}</label>diff --git a/spec/system/custom_sidebar_sections_spec.rb b/spec/system/custom_sidebar_sections_spec.rbindex 7f6cc830d24..390a1f2ae0a 100644--- a/spec/system/custom_sidebar_sections_spec.rb+++ b/spec/system/custom_sidebar_sections_spec.rb@@ -19,6 +19,7 @@ describe "Custom sidebar sections", type: :system, js: true doexpect(section_modal).to be_visibleexpect(section_modal).to have_disabled_save+ expect(find("#discourse-modal-title")).to have_content("Add custom section")section_modal.fill_name("My section")@@ -41,6 +42,8 @@ describe "Custom sidebar sections", type: :system, js: true dovisit("/latest")sidebar.edit_custom_section("My section")+ expect(find("#discourse-modal-title")).to have_content("Edit custom section")+section_modal.fill_name("Edited section")section_modal.fill_link("Edited Tags", "/tags")section_modal.remove_last_link