X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/8ad03264f1a47afe5108b1252ec3ec139dc16d9a..60f59d5903e5f4289d7a4b224c3f05e161395815:/project/static/js/views/html.js diff --git a/project/static/js/views/html.js b/project/static/js/views/html.js index 3d803fc7..a8eb4d01 100644 --- a/project/static/js/views/html.js +++ b/project/static/js/views/html.js @@ -20,19 +20,35 @@ var HTMLView = View.extend({ modelDataChanged: function(property, value) { $('.htmlview', this.element).html(value); + + var base = this.$printLink.attr('ui:baseref'); + this.$printLink.attr('href', base + "?revision=" + this.model.get('revision')); }, 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() { + if(this.$printLink) this.$printLink.unbind(); + this._super(); + this.$printLink = $('.html-print-link', this.element); + }, + + reload: function() { + this.model.load(true); + }, dispose: function() { this.model.removeObserver(this);