diff --git a/core/client/assets/lib/uploader.js b/core/client/assets/lib/uploader.js index 6c41db7518..ef9f1072c0 100644 --- a/core/client/assets/lib/uploader.js +++ b/core/client/assets/lib/uploader.js @@ -147,6 +147,7 @@ UploadUi = function ($dropzone, settings) { // This is the start point if no image exists $dropzone.find('img.js-upload-target').css({display: 'none'}); + $dropzone.find('div.description').show(); $dropzone.removeClass('pre-image-uploader image-uploader-url').addClass('image-uploader'); this.removeExtras(); this.buildExtras(); @@ -170,6 +171,7 @@ UploadUi = function ($dropzone, settings) { $dropzone.find('.js-cancel').on('click', function () { $dropzone.find('.js-url').remove(); $dropzone.find('.js-fileupload').removeClass('right'); + $dropzone.trigger('imagecleared'); self.removeExtras(); self.initWithDropzone(); }); @@ -211,10 +213,12 @@ UploadUi = function ($dropzone, settings) { // This is the start point if an image already exists $dropzone.removeClass('image-uploader image-uploader-url').addClass('pre-image-uploader'); $dropzone.find('div.description').hide(); + $dropzone.find('img.js-upload-target').show(); $dropzone.append($cancel); $dropzone.find('.js-cancel').on('click', function () { $dropzone.find('img.js-upload-target').attr({src: ''}); $dropzone.find('div.description').show(); + $dropzone.trigger('imagecleared'); $dropzone.delay(2500).animate({opacity: 100}, 1000, function () { self.init(); }); diff --git a/core/client/components/gh-uploader.js b/core/client/components/gh-uploader.js index c1bbfa9cf9..7bec724ceb 100644 --- a/core/client/components/gh-uploader.js +++ b/core/client/components/gh-uploader.js @@ -18,7 +18,7 @@ var PostImageUploader = Ember.Component.extend({ } }); - $this.find('.js-cancel').on('click', function () { + $this.on('imagecleared', function () { self.sendAction('canceled'); }); }.on('didInsertElement'), diff --git a/core/client/controllers/settings/tags.js b/core/client/controllers/settings/tags.js index 5b83e9bfd3..ea6239cf82 100644 --- a/core/client/controllers/settings/tags.js +++ b/core/client/controllers/settings/tags.js @@ -153,6 +153,14 @@ var TagsController = Ember.ArrayController.extend(PaginationMixin, { closeSubview: function () { this.set('isViewingSubview', false); + }, + + setCoverImage: function (image) { + this.saveActiveTagProperty('image', image); + }, + + clearCoverImage: function () { + this.saveActiveTagProperty('image', ''); } } }); diff --git a/core/client/models/tag.js b/core/client/models/tag.js index bc16f8291d..a8053bbbd2 100644 --- a/core/client/models/tag.js +++ b/core/client/models/tag.js @@ -10,7 +10,8 @@ var Tag = DS.Model.extend(NProgressSaveMixin, ValidationEngine, { description: DS.attr('string'), parent_id: DS.attr('number'), meta_title: DS.attr('string'), - meta_description: DS.attr('string') + meta_description: DS.attr('string'), + image: DS.attr('string') }); export default Tag; diff --git a/core/client/templates/components/gh-uploader.hbs b/core/client/templates/components/gh-uploader.hbs index dfd9759abf..c4adb710e4 100644 --- a/core/client/templates/components/gh-uploader.hbs +++ b/core/client/templates/components/gh-uploader.hbs @@ -2,5 +2,5 @@ Image Upload -