X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/d1582246fb727ec53bb984b432a3a59ce86ea772..d0cbddd54807e6e43f2ab75bd234ddc0beaa8d86:/project/static/js/views/editor.js?ds=sidebyside diff --git a/project/static/js/views/editor.js b/project/static/js/views/editor.js index 49b5e022..10c77f63 100644 --- a/project/static/js/views/editor.js +++ b/project/static/js/views/editor.js @@ -7,7 +7,6 @@ var EditorView = View.extend({ init: function(element, model, template) { this._super(element, model, template); - this.model.load(); this.quickSaveButton = $('#action-quick-save', this.element).bind('click.editorview', this.quickSave.bind(this)); this.commitButton = $('#action-commit', this.element).bind('click.editorview', this.commit.bind(this)); @@ -16,7 +15,7 @@ var EditorView = View.extend({ this.model.addObserver(this, 'state', this.modelStateChanged.bind(this)); this.modelStateChanged('state', this.model.get('state')); - + // Inicjalizacja okien jQuery Modal $('#commit-dialog', this.element). jqm({ @@ -34,10 +33,12 @@ var EditorView = View.extend({ // onShow: $.fbind(self, self.loadSplitDialog) // }). // jqmAddClose('button.dialog-close-button'); + + this.model.load(); }, quickSave: function(event) { - this.model.updateDirtyContentModel(); + this.model.saveDirtyContentModel(); }, commit: function(event) { @@ -45,7 +46,19 @@ var EditorView = View.extend({ }, doCommit: function(message) { - this.model.updateDirtyContentModel(message); + this.model.saveDirtyContentModel(message); + }, + + update: function(event) { + this.model.update(); + }, + + merge: function(event) { + $('#commit-dialog', this.element).jqmShow({callback: this.doMerge.bind(this)}); + }, + + doMerge: function(message) { + this.model.merge(message); }, loadRelatedIssues: function(hash) { @@ -73,28 +86,22 @@ var EditorView = View.extend({ $("div.fatal-error-box", c).hide(); $("div.container-box", c).hide(); - // $.getJSON(c.attr('ui:ajax-src') + '?callback=?', - // function(data, status) - // { - // var fmt = ''; - // $(data).each( function() { - // fmt += '\n' - // }); - // $("div.container-box", c).html(fmt); - // $("div.loading-box", c).hide(); - // $("div.container-box", c).show(); - // }); + $.getJSON(c.attr('ui:ajax-src') + '?callback=?', + function(data, status) + { + var fmt = ''; + $(data).each( function() { + fmt += '\n'; + }); + $("div.container-box", c).html(fmt); + $("div.loading-box", c).hide(); + $("div.container-box", c).show(); + }); hash.w.show(); }, - update: function(event) { - }, - - merge: function(event) { - }, - modelStateChanged: function(property, value) { // Uaktualnia stan przycisków if (value == 'dirty') {