Fix new tags disappearing in PSM when saving post

closes #5708
- when adding a tag give it a throwaway UUID so that every selected/available tag object has a unique identifier for use with selectize
This commit is contained in:
Kevin Ansfield 2015-08-25 23:52:45 +01:00
parent 58a86d17be
commit de970a4aba
3 changed files with 6 additions and 1 deletions

View File

@ -493,6 +493,10 @@ export default Ember.Controller.extend(SettingsMenuMixin, {
tagToAdd = self.get('store').createRecord('tag', {
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

View File

@ -59,6 +59,7 @@ export default DS.Model.extend(ValidationEngine, {
// remove client-generated tags, which have `id: null`.
// Ember Data won't recognize/update them automatically
// when returned from the server with ids.
// https://github.com/emberjs/data/issues/1829
updateTags: function () {
var tags = this.get('tags'),
oldTags = tags.filterBy('id', null);

View File

@ -40,7 +40,7 @@
multiple=true
selection=model.tags
content=availableTags
optionValuePath="content.name"
optionValuePath="content.uuid"
optionLabelPath="content.name"
create-item="addTag"
remove-item="removeTag"}}