X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/4daa3475da9a4d4de4488ec742c77248641e8c1e..1eb24182f3aa52108546f0cacd17e52e54a3a57c:/project/static/js/models.js diff --git a/project/static/js/models.js b/project/static/js/models.js index 65b9d67b..0b00c7ce 100644 --- a/project/static/js/models.js +++ b/project/static/js/models.js @@ -1,7 +1,4 @@ /*globals Editor fileId SplitView PanelContainerView EditorView FlashView messageCenter*/ -var documentsUrl = '/api/documents/'; - - Editor.Model = Editor.Object.extend({ synced: false, data: null @@ -9,8 +6,7 @@ Editor.Model = Editor.Object.extend({ Editor.ToolbarButtonsModel = Editor.Model.extend({ - _className: 'Editor.ToolbarButtonsModel', - serverURL: '/api/toolbar/buttons', + className: 'Editor.ToolbarButtonsModel', buttons: {}, init: function() { @@ -20,7 +16,7 @@ Editor.ToolbarButtonsModel = Editor.Model.extend({ load: function() { if (!this.get('buttons').length) { $.ajax({ - url: this.serverURL, + url: toolbarUrl, dataType: 'json', success: this.loadSucceeded.bind(this) }); @@ -404,12 +400,18 @@ Editor.DocumentModel = Editor.Model.extend({ var leftPanelView, rightPanelContainer, doc; -$(function() { +$(function() +{ + documentsUrl = $('#api-base-url').text() + '/'; + toolbarUrl = $('#api-toolbar-url').text(); + doc = new Editor.DocumentModel(); - var editor = new EditorView('#body-wrap', doc); + var editor = new EditorView('#body-wrap', doc); editor.freeze(); + var flashView = new FlashView('#flashview', messageCenter); var splitView = new SplitView('#splitview', doc); + leftPanelView = new PanelContainerView('#left-panel-container', doc); - rightPanelContainer = new PanelContainerView('#right-panel-container', doc); + rightPanelContainer = new PanelContainerView('#right-panel-container', doc); });