Skip to content

Commit

Permalink
BUGFIX: add CloseButton back, only hidde it when editing an image tha…
Browse files Browse the repository at this point in the history
…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
normann committed Apr 20, 2012
1 parent e1372b3 commit ca38b25
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
23 changes: 10 additions & 13 deletions javascript/HtmlEditorField.js
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -659,17 +659,14 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
}, },
toggleLooks: function(){ toggleLooks: function(){
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length); var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
if(updateExisting){ this.find('.htmleditorfield-mediaform-heading.insert')[updateExisting ? 'hide' : 'show']();
this.find('.htmleditorfield-mediaform-heading.insert').hide(); this.find('.Actions .image-insert')[updateExisting ? 'hide' : 'show']();
this.find('.Actions .image-insert').hide(); this.find('.htmleditorfield-mediaform-heading.update')[updateExisting ? 'show' : 'hide']();
this.find('.htmleditorfield-mediaform-heading.update').show(); this.find('.Actions .image-update')[updateExisting ? 'show' : 'hide']();
this.find('.Actions .image-update').show(); },
}else{ toggleCloseButton: function(){
this.find('.htmleditorfield-mediaform-heading.insert').show(); var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
this.find('.Actions .image-insert').show(); this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show']();
this.find('.htmleditorfield-mediaform-heading.update').hide();
this.find('.Actions .image-update').hide();
}
}, },
onsubmit: function() { onsubmit: function() {
var self = this, ed = this.getEditor(); var self = this, ed = this.getEditor();
Expand All @@ -692,15 +689,15 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
if(node.is('img')) { if(node.is('img')) {
this.showFileView(node.attr('src'), function() { this.showFileView(node.attr('src'), function() {
$(this).updateFromNode(node); $(this).updateFromNode(node);
self.toggleCloseButton();
self.redraw(); self.redraw();
}); });
} }

this.toggleLooks();
this.redraw(); this.redraw();
}, },
redraw: function() { redraw: function() {
this._super(); this._super();
this.toggleLooks();
var ed = this.getEditor(), node = $(ed.getSelectedNode()), var ed = this.getEditor(), node = $(ed.getSelectedNode()),
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length), hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
editingSelected = node.is('img'); editingSelected = node.is('img');
Expand Down
3 changes: 3 additions & 0 deletions templates/Includes/HtmlEditorField_viewfile.ss
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="overview"> <div class="overview">
<span class="thumbnail">$Preview</span> <span class="thumbnail">$Preview</span>
<span class="title">$Name</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>
<div class="details"> <div class="details">
<fieldset> <fieldset>
Expand Down

0 comments on commit ca38b25

Please sign in to comment.