Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'revisions_reload_dialog' into beta
  • Loading branch information
mattpardee committed May 22, 2012
2 parents 465859c + 548b4d0 commit 12ef75e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 32 deletions.
24 changes: 2 additions & 22 deletions plugins-client/ext.revisions/revisions.js
Expand Up @@ -779,7 +779,9 @@ module.exports = ext.register("ext/revisions/revisions", {
delete data.revision.finalContent;
delete data.revision.realContent;

var self = this;
var finalize = function() {
self.changedPaths = [];
winQuestionRev.hide();
settings.model.setQueryValue("general/@autosaveenabled", this.prevAutoSaveValue || true);
};
Expand Down Expand Up @@ -820,39 +822,17 @@ module.exports = ext.register("ext/revisions/revisions", {
return index;
};

var self = this;
var pages = tabEditors.getPages();
var page = pages.filter(function(_page) {
var pagePath = Util.stripWSFromPath(_page.$model.data.getAttribute("path"));
return data.path === pagePath
})[0];

Util.question(
"File changed, reload tab?",
"'" + data.path + "' has been modified while you were editing it.",
"Do you want to reload it?",
function YesReload() {
var index = reloadAndSave(page);
if (index > -1) {
self.changedPaths.splice(index, 1);
}
setTimeout(finalize);
},
function YesReloadAll() {
pages.forEach(reloadAndSave);
self.changedPaths = [];
setTimeout(finalize);
},
function NoDontReload() {
var index = dontReloadAndStore(page);
if (index > -1) {
self.changedPaths.splice(index, 1);
}
setTimeout(finalize);
},
function NoDontReloadAll() {
pages.forEach(dontReloadAndStore);
self.changedPaths = [];
setTimeout(finalize);
}
);
Expand Down
9 changes: 2 additions & 7 deletions plugins-client/ext.revisions/revisions.xml
Expand Up @@ -27,13 +27,8 @@
</a:vbox>

<a:hbox edge="6 10 10" pack="end" padding="8">
<a:button id="btnQuestionRevYes" default="3" skin="btn-default-css3" class="btn-green">Yes</a:button>
<a:filler/>
<a:button id="btnQuestionRevNo" skin="btn-default-css3" class="btn-red">No (but keep changes in a revision)</a:button>
<a:filler/>
<a:button id="btnQuestionRevYesAll" default="3" skin="btn-default-css3" class="btn-green">Yes to all</a:button>
<a:filler/>
<a:button id="btnQuestionRevNoAll" skin="btn-default-css3" class="btn-red">No to all</a:button>
<a:button id="btnQuestionRevYesAll" default="3" skin="btn-default-css3" class="btn-green">Yes</a:button>
<a:button id="btnQuestionRevNoAll" skin="btn-default-css3" class="btn-red">No</a:button>
</a:hbox>
</a:window>

Expand Down
4 changes: 1 addition & 3 deletions plugins-client/ext.revisions/revisions_util.js
Expand Up @@ -158,13 +158,11 @@ exports.getDocPath = function(page) {
return exports.stripWSFromPath(page.name);
};

exports.question = function(title, header, msg, onyes, onyesall, onno, onnoall) {
exports.question = function(title, header, msg, onyesall, onnoall) {
winQuestionRev.show();
winQuestionRev.setAttribute("title", title);
winQuestionRevHeader.$ext.innerHTML = header;
winQuestionRevMsg.$ext.innerHTML = msg;
btnQuestionRevYes.onclick = onyes;
btnQuestionRevNo.onclick = onno;
btnQuestionRevYesAll.onclick = onyesall;
btnQuestionRevNoAll.onclick = onnoall;
};
Expand Down

0 comments on commit 12ef75e

Please sign in to comment.