Fix in the print button.
[redakcja.git] / project / static / js / views / html.js
index 058b019..a8eb4d0 100644 (file)
@@ -20,6 +20,9 @@ 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) {
@@ -31,8 +34,21 @@ var HTMLView = View.extend({
       this.freeze('Ɓadowanie...');
     } else if (value == 'saving') {
       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);