0
Fork 0
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:
Hannah Wolfe 2013-11-22 14:07:36 -08:00
commit 548079ca94
8 changed files with 26 additions and 9 deletions

View file

@ -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

View file

@ -2,7 +2,7 @@
(function () {
'use strict';
Ghost.Models.Post = Ghost.TemplateModel.extend({
Ghost.Models.Post = Ghost.ProgressModel.extend({
defaults: {
status: 'draft'

View file

@ -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'
});

View file

@ -2,7 +2,7 @@
(function () {
'use strict';
Ghost.Collections.Tags = Ghost.TemplateModel.extend({
Ghost.Collections.Tags = Ghost.ProgressCollection.extend({
url: Ghost.settings.apiRoot + '/tags/'
});
}());

View file

@ -2,7 +2,7 @@
(function () {
'use strict';
Ghost.Models.Themes = Ghost.TemplateModel.extend({
Ghost.Models.Themes = Backbone.Model.extend({
url: Ghost.settings.apiRoot + '/themes'
});

View file

@ -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,

View file

@ -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/'
});

View file

@ -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
});