X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/78644811ca0c6042212788dc67add42bc41fb74c..0e5e4a0d816add3c0c13559fbed4f79eb295baf8:/platforma/static/js/views/editor.js diff --git a/platforma/static/js/views/editor.js b/platforma/static/js/views/editor.js index 2793141f..cfd18166 100644 --- a/platforma/static/js/views/editor.js +++ b/platforma/static/js/views/editor.js @@ -29,6 +29,28 @@ var EditorView = View.extend({ $('#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(); + + var message = $('#commit-dialog-message').val(); + $('#commit-dialog-related-issues input:checked') + .each(function() { + message += ' refs #' + $(this).val(); + }); + + var ctx = $('#commit-dialog').data('context'); + console.log("COMMIT APROVED", ctx); + ctx.callback(message); + } + return false; + }); + // $('#split-dialog').jqm({ // modal: true, @@ -70,25 +92,8 @@ var EditorView = View.extend({ 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(); - }); - console.log("COMMIT APROVED", hash.t); - hash.t.callback(message); - } - return false; - }); + + $('#commit-dialog').data('context', hash.t); $("div.loading-box", c).show(); $("div.fatal-error-box", c).hide(); @@ -117,16 +122,24 @@ var EditorView = View.extend({ this.commitButton.attr('disabled', null); this.updateButton.attr('disabled', 'disabled'); this.mergeButton.attr('disabled', 'disabled'); - } else if (value == 'synced') { + } else if (value == 'synced' || value == 'unsynced') { this.quickSaveButton.attr('disabled', 'disabled'); this.commitButton.attr('disabled', 'disabled'); this.updateButton.attr('disabled', null); this.mergeButton.attr('disabled', null); + this.unfreeze(); } else if (value == 'empty') { this.quickSaveButton.attr('disabled', 'disabled'); this.commitButton.attr('disabled', 'disabled'); this.updateButton.attr('disabled', 'disabled'); this.mergeButton.attr('disabled', 'disabled'); + } else if (value == 'error') { + this.freeze(this.model.get('error')); + this.quickSaveButton.attr('disabled', 'disabled'); + this.commitButton.attr('disabled', 'disabled'); + this.updateButton.attr('disabled', 'disabled'); + this.mergeButton.attr('disabled', 'disabled'); + } },