mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Merge pull request #1544 from ErisDS/client-model-fix
Bugfix handle model and collection separately
This commit is contained in:
commit
548079ca94
8 changed files with 26 additions and 9 deletions
|
@ -4,7 +4,24 @@
|
|||
"use strict";
|
||||
NProgress.configure({ showSpinner: false });
|
||||
|
||||
Ghost.TemplateModel = Backbone.Model.extend({
|
||||
Ghost.ProgressModel = Backbone.Model.extend({
|
||||
|
||||
// Adds in a call to start a loading bar
|
||||
// This is sets up a success function which completes the loading bar
|
||||
fetch : function (options) {
|
||||
options = options || {};
|
||||
|
||||
NProgress.start();
|
||||
|
||||
options.success = function () {
|
||||
NProgress.done();
|
||||
};
|
||||
|
||||
return Backbone.Model.prototype.fetch.call(this, options);
|
||||
}
|
||||
});
|
||||
|
||||
Ghost.ProgressCollection = Backbone.Collection.extend({
|
||||
|
||||
// Adds in a call to start a loading bar
|
||||
// This is sets up a success function which completes the loading bar
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Post = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.Post = Ghost.ProgressModel.extend({
|
||||
|
||||
defaults: {
|
||||
status: 'draft'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
//id:0 is used to issue PUT requests
|
||||
Ghost.Models.Settings = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.Settings = Ghost.ProgressModel.extend({
|
||||
url: Ghost.settings.apiRoot + '/settings/?type=blog,theme',
|
||||
id: '0'
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
Ghost.Collections.Tags = Ghost.TemplateModel.extend({
|
||||
Ghost.Collections.Tags = Ghost.ProgressCollection.extend({
|
||||
url: Ghost.settings.apiRoot + '/tags/'
|
||||
});
|
||||
}());
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Themes = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.Themes = Backbone.Model.extend({
|
||||
url: Ghost.settings.apiRoot + '/themes'
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*global Ghost, Backbone, $ */
|
||||
(function () {
|
||||
'use strict';
|
||||
Ghost.Models.uploadModal = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.uploadModal = Backbone.Model.extend({
|
||||
|
||||
options: {
|
||||
close: true,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.User = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.User = Ghost.ProgressModel.extend({
|
||||
url: Ghost.settings.apiRoot + '/users/me/'
|
||||
});
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
(function () {
|
||||
'use strict';
|
||||
|
||||
Ghost.Models.Widget = Ghost.TemplateModel.extend({
|
||||
Ghost.Models.Widget = Ghost.ProgressModel.extend({
|
||||
|
||||
defaults: {
|
||||
title: '',
|
||||
|
@ -35,7 +35,7 @@
|
|||
}
|
||||
});
|
||||
|
||||
Ghost.Collections.Widgets = Backbone.Collection.extend({
|
||||
Ghost.Collections.Widgets = Ghost.ProgressCollection.extend({
|
||||
// url: Ghost.settings.apiRoot + '/widgets/', // What will this be?
|
||||
model: Ghost.Models.Widget
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue