1 /*globals Editor fileId SplitView PanelContainerView*/
2 var documentsUrl = '/api/documents/';
5 Editor.Model = Editor.Object.extend({
11 Editor.XMLModel = Editor.Model.extend({
14 init: function(serverURL) {
15 this.serverURL = serverURL;
25 setData: function(data) {
31 if (!this.get('synced')) {
35 success: this.reloadSucceeded.bind(this)
40 reloadSucceeded: function(data) {
41 this.set('data', data);
42 this.set('synced', true);
47 Editor.HTMLModel = Editor.Model.extend({
50 init: function(serverURL) {
51 this.serverURL = serverURL;
55 if (!this.get('synced')) {
59 success: this.reloadSucceeded.bind(this)
64 reloadSucceeded: function(data) {
65 this.set('data', data);
66 this.set('synced', true);
71 Editor.DocumentModel = Editor.Model.extend({
72 data: null, // name, text_url, latest_rev, latest_shared_rev, parts_url, dc_url, size
80 console.log('DocumentModel#load');
83 url: documentsUrl + fileId,
85 success: this.successfulLoad.bind(this)
89 successfulLoad: function(data) {
90 console.log('DocumentModel#successfulLoad:', data);
91 this.set('data', data);
92 this.contentModels = {
93 'xml': new Editor.XMLModel(data.text_url),
94 'html': new Editor.HTMLModel(data.html_url)
100 var leftPanelView, rightPanelContainer, doc;
103 doc = new Editor.DocumentModel();
104 var splitView = new SplitView('#splitview', doc);
105 leftPanelView = new PanelContainerView('#left-panel-container', doc);
106 rightPanelContainer = new PanelContainerView('#right-panel-container', doc);