mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
Merge pull request #5727 from kevinansfield/fix-disappearing-tags-on-save
Fix new tags disappearing in PSM when saving post
This commit is contained in:
commit
79f1bd2571
3 changed files with 6 additions and 1 deletions
|
@ -493,6 +493,10 @@ export default Ember.Controller.extend(SettingsMenuMixin, {
|
||||||
tagToAdd = self.get('store').createRecord('tag', {
|
tagToAdd = self.get('store').createRecord('tag', {
|
||||||
name: tagName
|
name: tagName
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// we need to set a UUID so that selectize has a unique value
|
||||||
|
// it will be ignored when sent to the server
|
||||||
|
tagToAdd.set('uuid', Ember.guidFor(tagToAdd));
|
||||||
}
|
}
|
||||||
|
|
||||||
// push tag onto post relationship
|
// push tag onto post relationship
|
||||||
|
|
|
@ -59,6 +59,7 @@ export default DS.Model.extend(ValidationEngine, {
|
||||||
// remove client-generated tags, which have `id: null`.
|
// remove client-generated tags, which have `id: null`.
|
||||||
// Ember Data won't recognize/update them automatically
|
// Ember Data won't recognize/update them automatically
|
||||||
// when returned from the server with ids.
|
// when returned from the server with ids.
|
||||||
|
// https://github.com/emberjs/data/issues/1829
|
||||||
updateTags: function () {
|
updateTags: function () {
|
||||||
var tags = this.get('tags'),
|
var tags = this.get('tags'),
|
||||||
oldTags = tags.filterBy('id', null);
|
oldTags = tags.filterBy('id', null);
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
multiple=true
|
multiple=true
|
||||||
selection=model.tags
|
selection=model.tags
|
||||||
content=availableTags
|
content=availableTags
|
||||||
optionValuePath="content.name"
|
optionValuePath="content.uuid"
|
||||||
optionLabelPath="content.name"
|
optionLabelPath="content.name"
|
||||||
create-item="addTag"
|
create-item="addTag"
|
||||||
remove-item="removeTag"}}
|
remove-item="removeTag"}}
|
||||||
|
|
Loading…
Add table
Reference in a new issue