From: Ɓukasz Rekucki Date: Tue, 15 Sep 2009 15:46:17 +0000 (+0200) Subject: * Dodanie przycisku "commit". Zmiana nazwy z "save" na "quick save". Closes #96. X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/e6ba3117b6791a88ffef8ddecb310b5d514780e9 * Dodanie przycisku "commit". Zmiana nazwy z "save" na "quick save". Closes #96. --- diff --git a/project/static/js/editor.js b/project/static/js/editor.js index e37228ce..4150043f 100644 --- a/project/static/js/editor.js +++ b/project/static/js/editor.js @@ -347,7 +347,7 @@ Editor.prototype.saveToBranch = function(msg) var self = this; $.log('Saving to local branch - panel:', changed_panel); - if(!msg) msg = "Zapis z edytora platformy."; + if(!msg) msg = "Szybki zapis z edytora platformy."; if( changed_panel.length == 0) { $.log('Nothing to save.'); @@ -417,9 +417,8 @@ Editor.prototype.autoSave = function() Editor.prototype.onContentChanged = function(event, data) { var self = this; - $('#toolbar-button-save').removeAttr('disabled'); - $('#toolbar-button-commit').attr('disabled', 'disabled'); - $('#toolbar-button-update').attr('disabled', 'disabled'); + $('button.provides-save').removeAttr('disabled'); + $('button.requires-save').attr('disabled', 'disabled'); if(this.autosaveTimer) return; this.autosaveTimer = setTimeout( function() { @@ -461,10 +460,7 @@ Editor.prototype.sendMergeRequest = function (message) { alert("There are unsaved changes - can't commit."); var self = this; - - $('#commit-dialog-related-issues input:checked'). - each(function() { message += ' refs #' + $(this).val(); }); - + $.ajax({ url: $('#commit-dialog form').attr('action'), dataType: 'json', diff --git a/project/static/js/editor.ui.js b/project/static/js/editor.ui.js index 4d2a5d39..8932b4e6 100755 --- a/project/static/js/editor.ui.js +++ b/project/static/js/editor.ui.js @@ -146,10 +146,14 @@ Editor.prototype.setupUI = function() { * Connect various buttons */ - $('#toolbar-button-save').click( function (event, data) { + $('#toolbar-button-quick-save').click( function (event, data) { self.saveToBranch(); } ); + $('#toolbar-button-save').click( function (event, data) { + $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.saveToBranch)} ); + } ); + $('#toolbar-button-update').click( function (event, data) { if (self.updateUserBranch()) { // commit/update can be called only after proper, save @@ -163,29 +167,18 @@ Editor.prototype.setupUI = function() { $('#commit-dialog'). jqm({ modal: true, - onShow: $.fbind(self, self.loadRelatedIssues), - trigger: '#toolbar-button-commit' + onShow: $.fbind(self, self.loadRelatedIssues) }); + + $('#toolbar-button-commit').click( function (event, data) { + $('#commit-dialog').jqmShow( {callback: $.fbind(self, self.sendMergeRequest)} ); + } ); /* STATIC BINDS */ $('#commit-dialog-cancel-button').click(function() { $('#commit-dialog-error-empty-message').hide(); $('#commit-dialog').jqmHide(); - }); - - $('#commit-dialog-save-button').click( function (event, data) - { - if( $('#commit-dialog-message').val().match(/^\s*$/)) { - $('#commit-dialog-error-empty-message').fadeIn(); - } - else { - $('#commit-dialog-error-empty-message').hide(); - $('#commit-dialog').jqmHide(); - self.sendMergeRequest($('#commit-dialog-message').val() ); - } - - return false; - }); + }); /* SPLIT DIALOG */ @@ -203,6 +196,25 @@ Editor.prototype.loadRelatedIssues = function(hash) var self = this; var c = $('#commit-dialog-related-issues'); + $('#commit-dialog-save-button').click( function (event, data) + { + if( $('#commit-dialog-message').val().match(/^\s*$/)) { + $('#commit-dialog-error-empty-message').fadeIn(); + } + else { + $('#commit-dialog-error-empty-message').hide(); + $('#commit-dialog').jqmHide(); + + var message = $('#commit-dialog-message').val(); + $('#commit-dialog-related-issues input:checked'). + each(function() { message += ' refs #' + $(this).val(); }); + $.log("COMMIT APROVED", hash.t); + hash.t.callback(message); + } + + return false; + }); + $("div.loading-box", c).show(); $("div.fatal-error-box", c).hide(); $("div.container-box", c).hide(); @@ -301,9 +313,8 @@ Editor.prototype.refreshPanels = function() { panel.refresh(); }); - $('#toolbar-button-save').attr('disabled', 'disabled'); - $('#toolbar-button-commit').removeAttr('disabled'); - $('#toolbar-button-update').removeAttr('disabled'); + $('button.provides-save').attr('disabled', 'disabled'); + $('button.requires-save').removeAttr('disabled'); }; /* diff --git a/project/templates/explorer/editor.html b/project/templates/explorer/editor.html index 02a1c758..c82b75f5 100644 --- a/project/templates/explorer/editor.html +++ b/project/templates/explorer/editor.html @@ -28,17 +28,16 @@ {% endblock extrabody %} - {% load explorer_tags %} +{% load explorer_tags %} {% block breadcrumbs %}Platforma Redakcyjna > {{ fileid|bookname }}{% endblock breadcrumbs %} {% block header-toolbar %} - - - - + - + + {% endblock %} {% block message-box %} @@ -96,7 +95,7 @@
No related issues.

- +