X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/fef7f24f34c07be9d9aff6db434e997f9a1f3451..ac2e9ceea7cf6a59810081d52b64d9c22861c62d:/project/static/js/editor.ui.js diff --git a/project/static/js/editor.ui.js b/project/static/js/editor.ui.js index 4d2a5d39..f66d977b 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(); @@ -265,7 +277,7 @@ Editor.prototype.loadSplitDialog = function(hash) hash.t.success(); }); - if($('#id_splitform-autoxml').is(':checked')) + /* if($('#id_splitform-autoxml').is(':checked')) $('#split-form-dc-subform').show(); else $('#split-form-dc-subform').hide(); @@ -275,7 +287,7 @@ Editor.prototype.loadSplitDialog = function(hash) $('#split-form-dc-subform').show(); else $('#split-form-dc-subform').hide(); - }); + }); */ }; $.ajax({ @@ -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'); }; /*