fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
small refactor + fix brackets
[fnpeditor.git]
/
src
/
editor
/
modules
/
documentHistory
/
documentHistory.js
diff --git
a/src/editor/modules/documentHistory/documentHistory.js
b/src/editor/modules/documentHistory/documentHistory.js
index
b90fc59
..
8cd4475
100644
(file)
--- a/
src/editor/modules/documentHistory/documentHistory.js
+++ b/
src/editor/modules/documentHistory/documentHistory.js
@@
-1,10
+1,9
@@
define([
'libs/jquery',
'libs/underscore',
define([
'libs/jquery',
'libs/underscore',
-'./restoreDialog',
'libs/text!./templates/main.html',
'libs/text!./templates/item.html'
'libs/text!./templates/main.html',
'libs/text!./templates/item.html'
-], function($, _,
restoreDialog,
mainTemplateSrc, itemTemplateSrc) {
+], function($, _, mainTemplateSrc, itemTemplateSrc) {
'use strict';
'use strict';
@@
-23,16
+22,15
@@
return function(sandbox) {
});
dom.find('.btn.restore').click(function() {
});
dom.find('.btn.restore').click(function() {
- var dialog = restoreDialog.create();
- dialog.on('restore', function(event) {
- sandbox.publish('restoreVersion', {version: historyItems.getSelected()[0], description: event.data.description});
- event.success();
- });
- dialog.show();
+ sandbox.publish('restoreVersion', historyItems.getSelected()[0]);
});
dom.find('.btn.display').click(function() {
});
dom.find('.btn.display').click(function() {
- sandbox.publish('displayVersion', {version: historyItems.getSelected()[0]});
+ sandbox.publish('displayVersion', historyItems.getSelected()[0]);
+ });
+
+ dom.find('.btn.publish').click(function() {
+ sandbox.publish('publishVersion', historyItems.getSelected()[0]);
});
var addHistoryItem = function(item, options) {
});
var addHistoryItem = function(item, options) {
@@
-62,21
+60,21
@@
return function(sandbox) {
_selected: [],
select: function(item) {
if(this._selected.length < 2) {
_selected: [],
select: function(item) {
if(this._selected.length < 2) {
- this._selected.push(item.
ver
sion);
+ this._selected.push(item.
revi
sion);
this._updateUI();
return true;
}
return false;
},
unselect: function(item) {
this._updateUI();
return true;
}
return false;
},
unselect: function(item) {
- this._selected = _.without(this._selected, item.
ver
sion);
+ this._selected = _.without(this._selected, item.
revi
sion);
this._updateUI();
},
add: function(item) {
this._itemsById[item.version] = item;
},
isSelected: function(item) {
this._updateUI();
},
add: function(item) {
this._itemsById[item.version] = item;
},
isSelected: function(item) {
- return _.contains(this._selected, item.
ver
sion);
+ return _.contains(this._selected, item.
revi
sion);
},
getSelected: function() {
return this._selected;
},
getSelected: function() {
return this._selected;
@@
-87,17
+85,20
@@
return function(sandbox) {
toggleButton('compare', false);
toggleButton('display', false);
toggleButton('restore', false);
toggleButton('compare', false);
toggleButton('display', false);
toggleButton('restore', false);
+ toggleButton('publish', false);
}
if(len === 1) {
toggleButton('compare', false);
toggleButton('display', true);
toggleButton('restore', true);
}
if(len === 1) {
toggleButton('compare', false);
toggleButton('display', true);
toggleButton('restore', true);
+ toggleButton('publish', true);
}
if(len === 2) {
toggleItemViews(false);
toggleButton('compare', true);
toggleButton('display', false);
toggleButton('restore', false);
}
if(len === 2) {
toggleItemViews(false);
toggleButton('compare', true);
toggleButton('display', false);
toggleButton('restore', false);
+ toggleButton('publish', false);
} else {
toggleItemViews(true);
}
} else {
toggleItemViews(true);
}