});
dialog.show();
},
+ dropDraft: function() {
+ logger.debug('Dropping a draft...');
+ wlxmlDocument.loadXML(sandbox.getBootstrappedData().document);
+ draftDirty = false;
+ logger.debug('Draft dropped');
+ },
getDocumentId: function() {
return document_id;
},
return function(sandbox) {
var view = $(_.template(template)());
- view.find('button').click(function(e) {
+ view.find('[data-cmd]').click(function(e) {
e.preventDefault();
sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));
});
<div class="rng-module-mainBar">
<ul>
<li>wersja: <span class="version"></span></li>
+ <li><a href="#" data-cmd="drop-draft"><%= gettext('drop a working draft') %></a></li>
<li><button class="btn btn-mini btn-info" data-cmd="save"><%= gettext('Save') %></button></li>
<li><a class="btn btn-mini btn-danger" href="/"><%= gettext('Exit') %></a></li>
</ul>
sourceEditor.commitChanges();
}
sandbox.getModule('data').saveDocument();
+ },
+ 'cmd.drop-draft': function() {
+ sandbox.getModule('data').dropDraft();
}
};