0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Add relationships to client models

No issue
- Removed tabs from tag.js (why didn't jshint catch this?)
- Removed superfluous `activate` in SettingsIndexRoute
- updated `UserModel` and `TagModel` to have `created_by, updated_by` be references to `user` objects.
- updated `UserModel` to use `moment-date` instead of `date`
This commit is contained in:
Matt Enlow 2014-07-18 17:52:56 -06:00
parent 17b87d7402
commit b9e755f142
3 changed files with 14 additions and 17 deletions

View file

@ -1,15 +1,15 @@
var Tag = DS.Model.extend({ var Tag = DS.Model.extend({
uuid: DS.attr('string'), uuid: DS.attr('string'),
name: DS.attr('string'), name: DS.attr('string'),
slug: DS.attr('string'), slug: DS.attr('string'),
description: DS.attr('string'), description: DS.attr('string'),
parent_id: DS.attr('number'), parent_id: DS.attr('number'),
meta_title: DS.attr('string'), meta_title: DS.attr('string'),
meta_description: DS.attr('string'), meta_description: DS.attr('string'),
created_at: DS.attr('date'), created_at: DS.attr('moment-date'),
created_by: DS.attr('number'), created_by: DS.belongsTo('user', {async: true}),
updated_at: DS.attr('date'), updated_at: DS.attr('moment-date'),
updated_by: DS.attr('number') updated_by: DS.belongsTo('user', {async: true})
}); });
export default Tag; export default Tag;

View file

@ -20,9 +20,9 @@ var User = DS.Model.extend(NProgressSaveMixin, ValidationEngine, {
meta_description: DS.attr('string'), meta_description: DS.attr('string'),
last_login: DS.attr('moment-date'), last_login: DS.attr('moment-date'),
created_at: DS.attr('moment-date'), created_at: DS.attr('moment-date'),
created_by: DS.attr('number'), created_by: DS.belongsTo('user', { async: true }),
updated_at: DS.attr('moment-date'), updated_at: DS.attr('moment-date'),
updated_by: DS.attr('number'), updated_by: DS.belongsTo('user', { async: true }),
saveNewPassword: function () { saveNewPassword: function () {
var url = this.get('ghostPaths.url').api('users', 'password'); var url = this.get('ghostPaths.url').api('users', 'password');

View file

@ -1,9 +1,6 @@
import {mobileQuery} from 'ghost/utils/mobile'; import {mobileQuery} from 'ghost/utils/mobile';
var SettingsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, { var SettingsIndexRoute = Ember.Route.extend(Ember.SimpleAuth.AuthenticatedRouteMixin, {
activate: function () {
this._super();
},
// redirect to general tab, unless on a mobile phone // redirect to general tab, unless on a mobile phone
beforeModel: function () { beforeModel: function () {
if (!mobileQuery.matches) { if (!mobileQuery.matches) {