Permalink
Browse files

BUGFIX: add CloseButton back, only hidde it when editing an image tha…

…t loaded from content area.

ENHANEMENT: remove call of toogleLooks() from redraw(), only call toggleLooks() when needed.
MINOR: code minimazing / code convention.
  • Loading branch information...
1 parent e1372b3 commit ca38b2501411a42bdc104c14a13a9228df3697d4 @normann normann committed Apr 20, 2012
Showing with 13 additions and 13 deletions.
  1. +10 −13 javascript/HtmlEditorField.js
  2. +3 −0 templates/Includes/HtmlEditorField_viewfile.ss
@@ -659,17 +659,14 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
},
toggleLooks: function(){
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
- if(updateExisting){
- this.find('.htmleditorfield-mediaform-heading.insert').hide();
- this.find('.Actions .image-insert').hide();
- this.find('.htmleditorfield-mediaform-heading.update').show();
- this.find('.Actions .image-update').show();
- }else{
- this.find('.htmleditorfield-mediaform-heading.insert').show();
- this.find('.Actions .image-insert').show();
- this.find('.htmleditorfield-mediaform-heading.update').hide();
- this.find('.Actions .image-update').hide();
- }
+ this.find('.htmleditorfield-mediaform-heading.insert')[updateExisting ? 'hide' : 'show']();
+ this.find('.Actions .image-insert')[updateExisting ? 'hide' : 'show']();
+ this.find('.htmleditorfield-mediaform-heading.update')[updateExisting ? 'show' : 'hide']();
+ this.find('.Actions .image-update')[updateExisting ? 'show' : 'hide']();
+ },
+ toggleCloseButton: function(){
+ var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
+ this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show']();
},
onsubmit: function() {
var self = this, ed = this.getEditor();
@@ -692,15 +689,15 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
if(node.is('img')) {
this.showFileView(node.attr('src'), function() {
$(this).updateFromNode(node);
+ self.toggleCloseButton();
self.redraw();
});
}
-
+ this.toggleLooks();
this.redraw();
},
redraw: function() {
this._super();
- this.toggleLooks();
var ed = this.getEditor(), node = $(ed.getSelectedNode()),
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
editingSelected = node.is('img');
@@ -2,6 +2,9 @@
<div class="overview">
<span class="thumbnail">$Preview</span>
<span class="title">$Name</span>
+ <a href="#" class="action-delete ui-state-default">
+ <span class="ui-button-icon-primary ui-icon btn-icon-cross-circle"></span>
+ </a>
</div>
<div class="details">
<fieldset>

0 comments on commit ca38b25

Please sign in to comment.