X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/9479037111e9b243268189874be167e6c445455f..d5cf348c60b8ddc92ce9dae6080d3d276696ffec:/project/static/js/views/html.js?ds=inline diff --git a/project/static/js/views/html.js b/project/static/js/views/html.js index 3d803fc7..4dc3d544 100644 --- a/project/static/js/views/html.js +++ b/project/static/js/views/html.js @@ -24,15 +24,40 @@ var HTMLView = View.extend({ modelStateChanged: function(property, value) { if (value == 'synced' || value == 'dirty') { - this.parent.unfreeze(); + this.unfreeze(); } else if (value == 'unsynced') { - this.parent.freeze('Niezsynchronizowany...'); + this.freeze('Niezsynchronizowany...'); } else if (value == 'loading') { - this.parent.freeze('Ładowanie...'); + this.freeze('Ładowanie...'); } else if (value == 'saving') { - this.parent.freeze('Zapisywanie...'); + this.freeze('Zapisywanie...'); + } else if (value == 'error') { + this.freeze(this.model.get('error')); } }, + + + render: function() { + $('.html-print-link', this.element).unbind(); + + this._super(); + + $('.html-print-link', this.element).mouseover( + this.printView.bind(this) + ); + }, + + + printView: function(event) { + var base = $(event.target).attr('ui:baseref'); + $(event.target).attr('href', base + "?revision=" + this.model.get('revision') ); + + return true; + }, + + reload: function() { + this.model.load(true); + }, dispose: function() { this.model.removeObserver(this);