mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-01 15:29:19 +03:00
Merge pull request #3836 from jaswilli/ember17-prep
Rework editor save button.
This commit is contained in:
commit
fb0d1d0643
@ -1,14 +1,14 @@
|
||||
<button type="button" {{action "save"}} {{bind-attr class=":btn :btn-sm view.isDangerous:btn-red:btn-blue :js-publish-button" }}>{{view.save-text}}</button>
|
||||
<button type="button" {{action "save"}} {{bind-attr class=":btn :btn-sm view.isDangerous:btn-red:btn-blue :js-publish-button" }}>{{view.saveText}}</button>
|
||||
{{#gh-popover-button popoverName="post-save-menu" classNameBindings=":btn :btn-sm view.isDangerous:btn-red:btn-blue btnopen:active :dropdown-toggle :up"}}
|
||||
<i class="options"></i>
|
||||
<span class="sr-only">Toggle Settings Menu</span>
|
||||
{{/gh-popover-button}}
|
||||
{{#gh-popover name="post-save-menu" closeOnClick="true" tagName="div" classNames="dropdown editor-options" publishTextBinding="view.publish-text" draftTextBinding="view.draft-text"}}
|
||||
{{#gh-popover name="post-save-menu" closeOnClick="true" tagName="div" classNames="dropdown editor-options"}}
|
||||
<ul class="dropdown-menu dropdown-triangle-bottom-right">
|
||||
<li class="post-save-publish" {{bind-attr class="controller.willPublish:active" }}>
|
||||
<li class="post-save-publish" {{bind-attr class="willPublish:active"}}>
|
||||
<a {{action "setSaveType" "publish"}} href="#">{{view.publishText}}</a>
|
||||
</li>
|
||||
<li class="post-save-draft" {{bind-attr class="controller.willPublish::active" }}>
|
||||
<li class="post-save-draft" {{bind-attr class="willPublish::active"}}>
|
||||
<a {{action "setSaveType" "draft"}} href="#">{{view.draftText}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -1,24 +1,24 @@
|
||||
var EditorSaveButtonView = Ember.View.extend({
|
||||
templateName: 'editor-save-button',
|
||||
tagName: 'section',
|
||||
classNames: ['splitbtn js-publish-splitbutton'],
|
||||
classNames: ['splitbtn', 'js-publish-splitbutton'],
|
||||
|
||||
//Tracks whether we're going to change the state of the post on save
|
||||
isDangerous: Ember.computed('controller.isPublished', 'controller.willPublish', function () {
|
||||
return this.get('controller.isPublished') !== this.get('controller.willPublish');
|
||||
}),
|
||||
|
||||
'save-text': Ember.computed('controller.willPublish', function () {
|
||||
return this.get('controller.willPublish') ? this.get('publish-text') : this.get('draft-text');
|
||||
}),
|
||||
|
||||
'publish-text': Ember.computed('controller.isPublished', function () {
|
||||
'publishText': Ember.computed('controller.isPublished', function () {
|
||||
return this.get('controller.isPublished') ? 'Update Post' : 'Publish Now';
|
||||
}),
|
||||
|
||||
'draft-text': Ember.computed('controller.isPublished', function () {
|
||||
'draftText': Ember.computed('controller.isPublished', function () {
|
||||
return this.get('controller.isPublished') ? 'Unpublish' : 'Save Draft';
|
||||
})
|
||||
}),
|
||||
|
||||
'saveText': Ember.computed('controller.willPublish', function () {
|
||||
return this.get('controller.willPublish') ? this.get('publishText') : this.get('draftText');
|
||||
}),
|
||||
});
|
||||
|
||||
export default EditorSaveButtonView;
|
||||
|
Loading…
Reference in New Issue
Block a user