mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Merge pull request #4287 from PaulAdamDavis/tag-input-ux
Tag input UX improvements
This commit is contained in:
commit
5e2d9c47fb
3 changed files with 19 additions and 19 deletions
|
@ -616,6 +616,11 @@ body.zen {
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
}//.tag-label
|
}//.tag-label
|
||||||
|
#entry-tags.focused {
|
||||||
|
.tag-label:before {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.publish-bar-inner {
|
.publish-bar-inner {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -6,15 +6,13 @@
|
||||||
<div class="publish-bar-tags">
|
<div class="publish-bar-tags">
|
||||||
<div class="tags-wrapper tags">
|
<div class="tags-wrapper tags">
|
||||||
{{#each controller.tags}}
|
{{#each controller.tags}}
|
||||||
{{#view view.tagView tag=this}}
|
<span class="tag" {{action "deleteTag" this target=view}}>{{name}}</span>
|
||||||
{{view.tag.name}}
|
|
||||||
{{/view}}
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="publish-bar-tags-input">
|
<div class="publish-bar-tags-input">
|
||||||
<input type="hidden" class="tags-holder" id="tags-holder">
|
<input type="hidden" class="tags-holder" id="tags-holder">
|
||||||
{{view view.tagInputView class="tag-input" id="tags" value=newTagText}}
|
{{view view.tagInputView class="tag-input js-tag-input" id="tags" value=newTagText}}
|
||||||
<ul class="suggestions dropdown-menu dropdown-triangle-bottom" {{bind-attr style=view.overlayStyles}}>
|
<ul class="suggestions dropdown-menu dropdown-triangle-bottom" {{bind-attr style=view.overlayStyles}}>
|
||||||
{{#each suggestions}}
|
{{#each suggestions}}
|
||||||
{{#view view.suggestionView suggestion=this}}
|
{{#view view.suggestionView suggestion=this}}
|
||||||
|
|
|
@ -2,6 +2,7 @@ var PostTagsInputView = Ember.View.extend({
|
||||||
tagName: 'section',
|
tagName: 'section',
|
||||||
elementId: 'entry-tags',
|
elementId: 'entry-tags',
|
||||||
classNames: 'publish-bar-inner',
|
classNames: 'publish-bar-inner',
|
||||||
|
classNameBindings: ['hasFocus:focused'],
|
||||||
|
|
||||||
templateName: 'post-tags-input',
|
templateName: 'post-tags-input',
|
||||||
|
|
||||||
|
@ -108,19 +109,6 @@ var PostTagsInputView = Ember.View.extend({
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|
||||||
tagView: Ember.View.extend({
|
|
||||||
tagName: 'span',
|
|
||||||
classNames: 'tag',
|
|
||||||
|
|
||||||
tag: null,
|
|
||||||
|
|
||||||
click: function () {
|
|
||||||
this.get('parentView.controller').send('deleteTag', this.get('tag'));
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
|
|
||||||
|
|
||||||
suggestionView: Ember.View.extend({
|
suggestionView: Ember.View.extend({
|
||||||
tagName: 'li',
|
tagName: 'li',
|
||||||
classNameBindings: 'suggestion.selected',
|
classNameBindings: 'suggestion.selected',
|
||||||
|
@ -139,7 +127,16 @@ var PostTagsInputView = Ember.View.extend({
|
||||||
this.get('parentView.controller').send('addTag',
|
this.get('parentView.controller').send('addTag',
|
||||||
this.get('suggestion.tag'));
|
this.get('suggestion.tag'));
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
|
|
||||||
|
actions: {
|
||||||
|
deleteTag: function (tag) {
|
||||||
|
//The view wants to keep focus on the input after a click on a tag
|
||||||
|
Ember.$('.js-tag-input').focus();
|
||||||
|
//Make the controller do the actual work
|
||||||
|
this.get('controller').send('deleteTag', tag);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default PostTagsInputView;
|
export default PostTagsInputView;
|
||||||
|
|
Loading…
Add table
Reference in a new issue