mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-02 16:41:24 +03:00
Merge pull request #4041 from felixrieseberg/psm-coverimages
PSM: Cover Images
This commit is contained in:
commit
21aee9229c
@ -67,7 +67,6 @@
|
|||||||
position:relative;
|
position:relative;
|
||||||
z-index: 700;
|
z-index: 700;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
padding-left:5px;
|
|
||||||
}
|
}
|
||||||
.btn-blue {
|
.btn-blue {
|
||||||
margin: 0 0 0 10px;
|
margin: 0 0 0 10px;
|
||||||
|
@ -62,7 +62,11 @@
|
|||||||
.image-uploader {
|
.image-uploader {
|
||||||
padding-top: 35px;
|
padding-top: 35px;
|
||||||
padding-bottom: 35px;
|
padding-bottom: 35px;
|
||||||
margin: 0 0 1.5rem 0;
|
margin: 0 0 1.6rem 0;
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: auto;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
@ -76,8 +80,16 @@
|
|||||||
.nav-list {
|
.nav-list {
|
||||||
margin-top: 3rem;
|
margin-top: 3rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.pre-image-uploader {
|
||||||
|
width: auto;
|
||||||
|
min-height: 50px;
|
||||||
|
max-height: 250px;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.seo-preview {
|
.seo-preview {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
line-height: 1.46;
|
line-height: 1.46;
|
||||||
|
33
core/client/components/gh-uploader.js
Normal file
33
core/client/components/gh-uploader.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import uploader from 'ghost/assets/lib/uploader';
|
||||||
|
|
||||||
|
var PostImageUploader = Ember.Component.extend({
|
||||||
|
classNames: ['image-uploader', 'js-post-image-upload'],
|
||||||
|
|
||||||
|
setup: function () {
|
||||||
|
var $this = this.$(),
|
||||||
|
self = this;
|
||||||
|
|
||||||
|
uploader.call($this, {
|
||||||
|
editor: true,
|
||||||
|
fileStorage: this.get('config.fileStorage')
|
||||||
|
});
|
||||||
|
|
||||||
|
$this.on('uploadsuccess', function (event, result) {
|
||||||
|
if (result && result !== '' && result !== 'http://') {
|
||||||
|
self.sendAction('uploaded', result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$this.find('.js-cancel').on('click', function () {
|
||||||
|
self.sendAction('canceled');
|
||||||
|
});
|
||||||
|
}.on('didInsertElement'),
|
||||||
|
|
||||||
|
removeListeners: function () {
|
||||||
|
var $this = this.$();
|
||||||
|
$this.off();
|
||||||
|
$this.find('.js-cancel').off();
|
||||||
|
}.on('willDestroyElement')
|
||||||
|
});
|
||||||
|
|
||||||
|
export default PostImageUploader;
|
@ -19,7 +19,7 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
selectedAuthor: null,
|
selectedAuthor: null,
|
||||||
initializeSelectedAuthor: function () {
|
initializeSelectedAuthor: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
return this.get('author').then(function (author) {
|
return this.get('author').then(function (author) {
|
||||||
self.set('selectedAuthor', author);
|
self.set('selectedAuthor', author);
|
||||||
return author;
|
return author;
|
||||||
@ -259,6 +259,36 @@ var PostSettingsMenuController = Ember.ObjectController.extend({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
||||||
|
self.showErrors(errors);
|
||||||
|
self.get('model').rollback();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
setCoverImage: function (image) {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.set('image', image);
|
||||||
|
|
||||||
|
if (this.get('isNew')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
||||||
|
self.showErrors(errors);
|
||||||
|
self.get('model').rollback();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
clearCoverImage: function () {
|
||||||
|
var self = this;
|
||||||
|
|
||||||
|
this.set('image', '');
|
||||||
|
|
||||||
|
if (this.get('isNew')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
this.get('model').save(this.get('saveOptions')).catch(function (errors) {
|
||||||
self.showErrors(errors);
|
self.showErrors(errors);
|
||||||
self.get('model').rollback();
|
self.get('model').rollback();
|
||||||
|
6
core/client/templates/components/gh-uploader.hbs
Normal file
6
core/client/templates/components/gh-uploader.hbs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<span class="media">
|
||||||
|
<span class="hidden">Image Upload</span>
|
||||||
|
</span>
|
||||||
|
<img class="js-upload-target" {{bind-attr src=image}}>
|
||||||
|
<div class="description">Add post image <strong></strong></div>
|
||||||
|
<input data-url="upload" class="js-fileupload main fileupload" type="file" name="uploadimage">
|
@ -6,15 +6,7 @@
|
|||||||
<button class="close icon-x post-settings-header-action" {{action "closePostSettings"}}><span class="hidden">Close</span></button>
|
<button class="close icon-x post-settings-header-action" {{action "closePostSettings"}}><span class="hidden">Close</span></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="post-settings-content">
|
<div class="post-settings-content">
|
||||||
<!--
|
{{gh-uploader uploaded="setCoverImage" canceled="clearCoverImage" image=image tagName="section"}}
|
||||||
<section class="image-uploader">
|
|
||||||
<span class="media">
|
|
||||||
<span class="hidden">Image Upload</span>
|
|
||||||
</span>
|
|
||||||
<img class="js-upload-target" style="display: none;" src="">
|
|
||||||
<div class="description">Add image of <strong></strong></div>
|
|
||||||
</section>
|
|
||||||
-->
|
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="blog-title">Post URL</label>
|
<label for="blog-title">Post URL</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user