DEV: Code style improvements following review

Followup to 05ee1d1aba
This commit is contained in:
David Taylor 2019-02-19 20:02:29 +00:00
parent 34b2157b8c
commit dbcf05d62c
3 changed files with 12 additions and 23 deletions

View File

@ -1,4 +1,5 @@
import { default as computed } from "ember-addons/ember-computed-decorators";
import { fmt } from "discourse/lib/computed";
export default Ember.Component.extend({
@computed("theme.targets", "onlyOverridden", "showAdvanced")
@ -40,10 +41,7 @@ export default Ember.Component.extend({
}
},
@computed("fieldName", "currentTargetName")
editorId(fieldName, currentTarget) {
return fieldName + "|" + currentTarget;
},
editorId: fmt("fieldName", "currentTargetName", "%@|%@"),
@computed("maximized")
maximizeIcon(maximized) {
@ -77,16 +75,13 @@ export default Ember.Component.extend({
if (!name) return;
name = name.replace(/\W/g, "");
this.get("theme").setField(this.get("currentTargetName"), name, "");
this.set("newFieldName", "");
this.set("addingField", false);
this.setProperties({ newFieldName: "", addingField: false });
this.fieldAdded(this.get("currentTargetName"), name);
},
toggleMaximize: function() {
this.toggleProperty("maximized");
Ember.run.next(() => {
this.appEvents.trigger("ace:resize");
});
Ember.run.next(() => this.appEvents.trigger("ace:resize"));
},
onlyOverriddenChanged(value) {

View File

@ -154,9 +154,7 @@ const Theme = RestModel.extend({
hasError(target, name) {
return this.get("theme_fields")
.filter(f => {
return f.target === target && (!name || name === f.name);
})
.filter(f => f.target === target && (!name || name === f.name))
.any(f => f.error);
},

View File

@ -4,12 +4,12 @@
{{#each visibleTargets as |target|}}
<li>
{{#link-to editRouteName
theme.id
target.name
fieldName
replace=true
title=field.title
class=(if target.edited 'edited' 'blank')
theme.id
target.name
fieldName
replace=true
title=field.title
class=(if target.edited 'edited' 'blank')
}}
{{#if target.error}}{{d-icon 'exclamation-triangle'}}{{/if}}
{{#if target.icon}}
@ -24,11 +24,7 @@
class='no-text'
title="{{i18n (concat "admin.customize.theme." (if showAdvanced "hide_advanced" "show_advanced"))}}"
>
{{#if showAdvanced}}
{{d-icon "angle-double-left"}}
{{else}}
{{d-icon "angle-double-right"}}
{{/if}}
{{d-icon (if showAdvanced "angle-double-left" "angle-double-right")}}
</a>
</li>
<li class="spacer"></li>