X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/1c9098d6313e24c7fd873859c7e10b81452f4bec..38747104cc8581d642f3c5a0d78c17565cc9988c:/project/static/js/models.js diff --git a/project/static/js/models.js b/project/static/js/models.js index 97682d02..96cab868 100644 --- a/project/static/js/models.js +++ b/project/static/js/models.js @@ -8,13 +8,40 @@ Editor.Model = Editor.Object.extend({ }); +Editor.ToolbarButtonsModel = Editor.Model.extend({ + _className: 'Editor.ToolbarButtonsModel', + serverURL: '/api/toolbar/buttons', + buttons: {}, + + init: function() { + this._super(); + }, + + load: function() { + if (!this.get('buttons').length) { + $.ajax({ + url: this.serverURL, + dataType: 'json', + success: this.loadSucceeded.bind(this) + }); + } + }, + + loadSucceeded: function(data) { + this.set('buttons', data); + } +}); + + Editor.XMLModel = Editor.Model.extend({ _className: 'Editor.XMLModel', serverURL: null, + data: '', init: function(serverURL) { this._super(); this.serverURL = serverURL; + this.toolbarButtonsModel = new Editor.ToolbarButtonsModel(); }, getData: function() {