fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
2961355
)
editor: dropping a working draft
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 20 Mar 2014 10:37:37 +0000
(11:37 +0100)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Thu, 20 Mar 2014 10:38:42 +0000
(11:38 +0100)
src/editor/modules/data/data.js
patch
|
blob
|
history
src/editor/modules/mainBar/mainBar.js
patch
|
blob
|
history
src/editor/modules/mainBar/template.html
patch
|
blob
|
history
src/editor/modules/rng/rng.js
patch
|
blob
|
history
diff --git
a/src/editor/modules/data/data.js
b/src/editor/modules/data/data.js
index
7488390
..
ef1c87d
100644
(file)
--- a/
src/editor/modules/data/data.js
+++ b/
src/editor/modules/data/data.js
@@
-238,6
+238,12
@@
return function(sandbox) {
});
dialog.show();
},
});
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;
},
getDocumentId: function() {
return document_id;
},
diff --git
a/src/editor/modules/mainBar/mainBar.js
b/src/editor/modules/mainBar/mainBar.js
index
ecf6812
..
e2e09c3
100644
(file)
--- a/
src/editor/modules/mainBar/mainBar.js
+++ b/
src/editor/modules/mainBar/mainBar.js
@@
-8,7
+8,7
@@
define([
return function(sandbox) {
var view = $(_.template(template)());
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'));
});
e.preventDefault();
sandbox.publish('cmd.' + $(e.target).attr('data-cmd'));
});
diff --git
a/src/editor/modules/mainBar/template.html
b/src/editor/modules/mainBar/template.html
index
e3c971b
..
eeecd62
100644
(file)
--- a/
src/editor/modules/mainBar/template.html
+++ b/
src/editor/modules/mainBar/template.html
@@
-1,6
+1,7
@@
<div class="rng-module-mainBar">
<ul>
<li>wersja: <span class="version"></span></li>
<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>
<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>
diff --git
a/src/editor/modules/rng/rng.js
b/src/editor/modules/rng/rng.js
index
bed3e86
..
78145a5
100644
(file)
--- a/
src/editor/modules/rng/rng.js
+++ b/
src/editor/modules/rng/rng.js
@@
-151,6
+151,9
@@
return function(sandbox) {
sourceEditor.commitChanges();
}
sandbox.getModule('data').saveDocument();
sourceEditor.commitChanges();
}
sandbox.getModule('data').saveDocument();
+ },
+ 'cmd.drop-draft': function() {
+ sandbox.getModule('data').dropDraft();
}
};
}
};