- dataChanged: function() {
- this.parent.modelChanged('html');
- },
-
- needsReload: function() {
- this.needsReload = true;
- this.signal('needsReload');
- }
-})
-
-
-var DocumentModel = Model.extend({
- data: null, // name, text_url, latest_rev, latest_shared_rev, parts_url, dc_url, size
- xml: null,
- html: null,
- contentModels: {},
-
- init: function() {
- this.getData();
- },
-
- getData: function() {
- console.log('DocumentModel#getData');
- $.ajax({
- cache: false,
- url: documentsUrl + fileId,
- dataType: 'json',
- success: this.successfulGetData.bind(this)
- });
- },
-
- successfulGetData: function(data) {
- console.log('DocumentModel#successfulGetData:', data);
- this.data = data;
- this.contentModels = {
- 'xml': new XMLModel(this, data.text_url)
- };
+ set: function(property, value) {
+ if (this[property] != value) {
+ this[property] = value;
+ this.notifyObservers(property);
+ }
+ return this;