FIX: edit custom section title (#20258)
When custom section is edited, it should say "Edit custom section" instead of "Add custom section"
This commit is contained in:
parent
2d99e508c6
commit
ca7131648f
|
@ -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 }));
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -19,6 +19,7 @@ describe "Custom sidebar sections", type: :system, js: true do
|
|||
|
||||
expect(section_modal).to be_visible
|
||||
expect(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 do
|
|||
visit("/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
|
||||
|
|
Loading…
Reference in New Issue