+ if($e.hasClass('accept-button'))
+ this.closeWithSave( this.editableFor($e) );
+
+ if($e.hasClass('reject-button'))
+ this.closeWithoutSave( this.editableFor($e) );
+ },
+
+ closeWithSave: function($e) {
+ var $edit = $e.data('edit-overlay');
+ var newText = $('textarea', $edit).val();
+
+ this.model.putXMLPart($e, newText, function($e, html) {
+ this.renderPart($e, html);
+ $edit.remove();
+ $e.removeAttr('x-open');
+ }.bind(this) );
+ this.currentOpen = null;
+ },
+
+ closeWithoutSave: function($e) {
+ var $edit = $e.data('edit-overlay');
+ $edit.remove();
+ $e.removeAttr('x-open');
+ this.currentOpen = null;
+ },
+
+ renderPart: function($e, html) {
+ $e.html(html);
+ $e.append( this.$menuTemplate.clone() );
+ },
+
+ editableFor: function($button)
+ {
+ var $e = $button;
+ var n = 0;
+
+ while( ($e[0] != this.element[0]) && !($e.attr('x-editable')) && n < 50)