mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 21:43:15 +08:00
FIX: javascript error when opening rename tag modal
This commit is contained in:
parent
94e2b77c5f
commit
cd3a167c63
|
@ -1,16 +1,18 @@
|
||||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||||
|
import computed from "ember-addons/ember-computed-decorators";
|
||||||
import BufferedContent from "discourse/mixins/buffered-content";
|
import BufferedContent from "discourse/mixins/buffered-content";
|
||||||
import { extractError } from "discourse/lib/ajax-error";
|
import { extractError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
export default Ember.Controller.extend(ModalFunctionality, BufferedContent, {
|
export default Ember.Controller.extend(ModalFunctionality, BufferedContent, {
|
||||||
renameDisabled: function() {
|
@computed("buffered.id", "id")
|
||||||
|
renameDisabled(inputTagName, currentTagName) {
|
||||||
const filterRegexp = new RegExp(this.site.tags_filter_regexp, "g"),
|
const filterRegexp = new RegExp(this.site.tags_filter_regexp, "g"),
|
||||||
newId = this.get("buffered.id")
|
newTagName = inputTagName
|
||||||
.replace(filterRegexp, "")
|
? inputTagName.replace(filterRegexp, "").trim()
|
||||||
.trim();
|
: "";
|
||||||
|
|
||||||
return newId.length === 0 || newId === this.get("model.id");
|
return newTagName.length === 0 || newTagName === currentTagName;
|
||||||
}.property("buffered.id", "id"),
|
},
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
performRename() {
|
performRename() {
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
{{#d-modal-body title="tagging.rename_tag"}}
|
{{#d-modal-body title="tagging.rename_tag"}}
|
||||||
<label>
|
<label class="control-label">
|
||||||
<p>{{i18n "tagging.rename_instructions"}}</p>
|
{{i18n "tagging.rename_instructions"}}
|
||||||
{{input value=buffered.id maxlength=siteSettings.max_tag_length}}
|
|
||||||
</label>
|
</label>
|
||||||
|
<div class="controls">
|
||||||
|
{{input value=buffered.id maxlength=siteSettings.max_tag_length}}
|
||||||
|
</div>
|
||||||
{{/d-modal-body}}
|
{{/d-modal-body}}
|
||||||
|
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user