mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-25 19:48:50 +03:00
🐛 Fixed incorrect save warning on design settings
closes https://github.com/TryGhost/Ghost/issues/11590 - Dirty attribute flag was set incorrectly on focus out from label/url fields as no check with existing was used - Checks against existing nav item value before setting dirty attribute on focus out
This commit is contained in:
parent
29c1b2f18c
commit
a7c0899782
@ -16,10 +16,10 @@
|
||||
<GhTrimFocusInput
|
||||
@shouldFocus={{this.navItem.last}}
|
||||
@placeholder="Label"
|
||||
@value={{readonly this.navItem.label}}
|
||||
@input={{action (mut this.navItem.label) value="target.value"}}
|
||||
@value={{readonly this.label}}
|
||||
@input={{action (mut this.label) value="target.value"}}
|
||||
@keyPress={{action "clearLabelErrors"}}
|
||||
@focus-out={{action "updateLabel" this.navItem.label}} data-test-input="label" />
|
||||
@focus-out={{action "updateLabel" this.label}} data-test-input="label" />
|
||||
<GhErrorMessage
|
||||
@errors={{this.navItem.errors}}
|
||||
@property="label" data-test-error="label" />
|
||||
@ -34,7 +34,7 @@
|
||||
<GhNavitemUrlInput
|
||||
@baseUrl={{this.baseUrl}}
|
||||
@isNew={{this.navItem.isNew}}
|
||||
@url={{readonly this.navItem.url}}
|
||||
@url={{readonly this.url}}
|
||||
@update={{action "updateUrl"}}
|
||||
@clearErrors={{action "clearUrlErrors"}} data-test-input="url" />
|
||||
<GhErrorMessage
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Component from '@ember/component';
|
||||
import ValidationState from 'ghost-admin/mixins/validation-state';
|
||||
import boundOneWay from 'ghost-admin/utils/bound-one-way';
|
||||
import {computed} from '@ember/object';
|
||||
import {readOnly} from '@ember/object/computed';
|
||||
import {run} from '@ember/runloop';
|
||||
@ -15,6 +16,8 @@ export default Component.extend(ValidationState, {
|
||||
deleteItem() {},
|
||||
updateUrl() {},
|
||||
updateLabel() {},
|
||||
label: boundOneWay('navItem.label'),
|
||||
url: boundOneWay('navItem.url'),
|
||||
|
||||
errors: readOnly('navItem.errors'),
|
||||
|
||||
|
@ -69,8 +69,10 @@ export default Controller.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
navItem.set('label', label);
|
||||
this.set('dirtyAttributes', true);
|
||||
if (navItem.get('label') !== label) {
|
||||
navItem.set('label', label);
|
||||
this.set('dirtyAttributes', true);
|
||||
}
|
||||
},
|
||||
|
||||
updateUrl(url, navItem) {
|
||||
@ -78,8 +80,10 @@ export default Controller.extend({
|
||||
return;
|
||||
}
|
||||
|
||||
navItem.set('url', url);
|
||||
this.set('dirtyAttributes', true);
|
||||
if (navItem.get('url') !== url) {
|
||||
navItem.set('url', url);
|
||||
this.set('dirtyAttributes', true);
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
@ -38,6 +38,7 @@
|
||||
@baseUrl={{this.blogUrl}}
|
||||
@addItem={{action "addNavItem"}}
|
||||
@updateUrl={{action "updateUrl"}}
|
||||
@updateLabel={{action "updateLabel"}}
|
||||
data-test-navitem="new" />
|
||||
</form>
|
||||
</div>
|
||||
@ -64,6 +65,7 @@
|
||||
@baseUrl={{this.blogUrl}}
|
||||
@addItem={{action "addNavItem"}}
|
||||
@updateUrl={{action "updateUrl"}}
|
||||
@updateLabel={{action "updateLabel"}}
|
||||
data-test-navitem="new" />
|
||||
</form>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user