fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Oops #2
[redakcja.git]
/
project
/
static
/
js
/
models.js
diff --git
a/project/static/js/models.js
b/project/static/js/models.js
index
c333a97
..
5c6b36d
100644
(file)
--- a/
project/static/js/models.js
+++ b/
project/static/js/models.js
@@
-1,7
+1,4
@@
/*globals Editor fileId SplitView PanelContainerView EditorView FlashView messageCenter*/
/*globals Editor fileId SplitView PanelContainerView EditorView FlashView messageCenter*/
-var documentsUrl = '/api/documents/';
-
-
Editor.Model = Editor.Object.extend({
synced: false,
data: null
Editor.Model = Editor.Object.extend({
synced: false,
data: null
@@
-9,8
+6,7
@@
Editor.Model = Editor.Object.extend({
Editor.ToolbarButtonsModel = Editor.Model.extend({
Editor.ToolbarButtonsModel = Editor.Model.extend({
- _className: 'Editor.ToolbarButtonsModel',
- serverURL: '/api/toolbar/buttons',
+ className: 'Editor.ToolbarButtonsModel',
buttons: {},
init: function() {
buttons: {},
init: function() {
@@
-20,7
+16,7
@@
Editor.ToolbarButtonsModel = Editor.Model.extend({
load: function() {
if (!this.get('buttons').length) {
$.ajax({
load: function() {
if (!this.get('buttons').length) {
$.ajax({
- url: t
his.serverURL
,
+ url: t
oolbarUrl
,
dataType: 'json',
success: this.loadSucceeded.bind(this)
});
dataType: 'json',
success: this.loadSucceeded.bind(this)
});
@@
-56,8
+52,8
@@
Editor.XMLModel = Editor.Model.extend({
this.addObserver(this, 'data', this.dataChanged.bind(this));
},
this.addObserver(this, 'data', this.dataChanged.bind(this));
},
- load: function() {
- if (this.get('state') == 'empty') {
+ load: function(
force
) {
+ if (
force ||
this.get('state') == 'empty') {
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
@@
-162,8
+158,8
@@
Editor.HTMLModel = Editor.Model.extend({
this.serverURL = serverURL;
},
this.serverURL = serverURL;
},
- load: function() {
- if (this.get('state') == 'empty') {
+ load: function(
force
) {
+ if (
force ||
this.get('state') == 'empty') {
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
@@
-215,8
+211,8
@@
Editor.ImageGalleryModel = Editor.Model.extend({
this.pages = [];
},
this.pages = [];
},
- load: function() {
- if (this.get('state') == 'empty') {
+ load: function(
force
) {
+ if (
force ||
this.get('state') == 'empty') {
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
this.set('state', 'loading');
$.ajax({
url: this.serverURL,
@@
-404,7
+400,11
@@
Editor.DocumentModel = Editor.Model.extend({
var leftPanelView, rightPanelContainer, doc;
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);
editor.freeze();
doc = new Editor.DocumentModel();
var editor = new EditorView('#body-wrap', doc);
editor.freeze();