mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: Couldn't navigate to Categories list via link
This commit is contained in:
parent
a0bd51862e
commit
07cd87f941
8 changed files with 57 additions and 26 deletions
|
@ -8,9 +8,13 @@
|
||||||
**/
|
**/
|
||||||
Discourse.AdminFlagsActiveRoute = Discourse.Route.extend({
|
Discourse.AdminFlagsActiveRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
setupController: function() {
|
model: function() {
|
||||||
|
return Discourse.FlaggedPost.findAll('active');
|
||||||
|
},
|
||||||
|
|
||||||
|
setupController: function(controller, model) {
|
||||||
var adminFlagsController = this.controllerFor('adminFlags');
|
var adminFlagsController = this.controllerFor('adminFlags');
|
||||||
adminFlagsController.set('content', Discourse.FlaggedPost.findAll('active'));
|
adminFlagsController.set('content', model);
|
||||||
adminFlagsController.set('query', 'active');
|
adminFlagsController.set('query', 'active');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,13 @@
|
||||||
**/
|
**/
|
||||||
Discourse.AdminFlagsOldRoute = Discourse.Route.extend({
|
Discourse.AdminFlagsOldRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
|
model: function() {
|
||||||
|
return Discourse.FlaggedPost.findAll('old');
|
||||||
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
var adminFlagsController = this.controllerFor('adminFlags');
|
var adminFlagsController = this.controllerFor('adminFlags');
|
||||||
adminFlagsController.set('content', Discourse.FlaggedPost.findAll('old'));
|
adminFlagsController.set('content', model);
|
||||||
adminFlagsController.set('query', 'old');
|
adminFlagsController.set('query', 'old');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
Discourse.AdminGroupsRoute = Discourse.Route.extend({
|
Discourse.AdminGroupsRoute = Discourse.Route.extend({
|
||||||
renderTemplate: function() {
|
|
||||||
this.render('admin/templates/groups',{into: 'admin/templates/admin'});
|
model: function() {
|
||||||
|
return Discourse.Group.findAll();
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
renderTemplate: function() {
|
||||||
controller.set('model', Discourse.Group.findAll());
|
this.render('admin/templates/groups',{into: 'admin/templates/admin'});
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,18 +7,17 @@
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.AdminUserRoute = Discourse.Route.extend({
|
Discourse.AdminUserRoute = Discourse.Route.extend({
|
||||||
|
|
||||||
serialize: function(params) {
|
serialize: function(params) {
|
||||||
return { username: Em.get(params, 'username').toLowerCase() };
|
return { username: Em.get(params, 'username').toLowerCase() };
|
||||||
},
|
},
|
||||||
|
|
||||||
renderTemplate: function() {
|
model: function(params) {
|
||||||
this.render('admin/templates/user', {into: 'admin/templates/admin'});
|
return Discourse.AdminUser.find(Em.get(params, 'username').toLowerCase());
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
renderTemplate: function() {
|
||||||
Discourse.AdminUser.find(Em.get(model, 'username').toLowerCase()).then(function (u) {
|
this.render('admin/templates/user', {into: 'admin/templates/admin'});
|
||||||
controller.set('content', u);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{#if loaded}}
|
|
||||||
<h3>{{model.title}}</h3>
|
<h3>{{model.title}}</h3>
|
||||||
<p class='description'>{{model.description}}</p>
|
<p class='description'>{{model.description}}</p>
|
||||||
|
|
||||||
|
@ -30,7 +30,3 @@
|
||||||
</button>
|
</button>
|
||||||
{{#if saved}}{{i18n saved}}{{/if}}
|
{{#if saved}}{{i18n saved}}{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{else}}
|
|
||||||
<div class='spinner'>{{i18n loading}}</div>
|
|
||||||
{{/if}}
|
|
29
app/assets/javascripts/discourse/mixins/model_ready.js
Normal file
29
app/assets/javascripts/discourse/mixins/model_ready.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/**
|
||||||
|
Until the fully async router is merged into Ember, it is healthy to do some extra checking
|
||||||
|
that setupController is not passed a promise instead of the model we want.
|
||||||
|
|
||||||
|
This mixin handles that case, and calls modelReady instead.
|
||||||
|
|
||||||
|
@class Discourse.ModelReady
|
||||||
|
@extends Ember.Mixin
|
||||||
|
@namespace Discourse
|
||||||
|
@module Discourse
|
||||||
|
**/
|
||||||
|
Discourse.ModelReady = Em.Mixin.create({
|
||||||
|
|
||||||
|
setupController: function(controller, model) {
|
||||||
|
var route = this;
|
||||||
|
if (model.then) {
|
||||||
|
model.then(function (m) {
|
||||||
|
controller.set('model', m);
|
||||||
|
if (route.modelReady) { route.modelReady(controller, m); }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
controller.set('model', model);
|
||||||
|
if (route.modelReady) { route.modelReady(controller, model); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.ListCategoriesRoute = Discourse.Route.extend({
|
Discourse.ListCategoriesRoute = Discourse.Route.extend(Discourse.ModelReady, {
|
||||||
|
|
||||||
redirect: function() { Discourse.redirectIfLoginRequired(this); },
|
redirect: function() { Discourse.redirectIfLoginRequired(this); },
|
||||||
|
|
||||||
|
@ -28,9 +28,8 @@ Discourse.ListCategoriesRoute = Discourse.Route.extend({
|
||||||
this.controllerFor('list').set('canCreateCategory', false);
|
this.controllerFor('list').set('canCreateCategory', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, categoryList) {
|
modelReady: function(controller, categoryList) {
|
||||||
this.render('listCategories', { into: 'list', outlet: 'listView' });
|
this.render('listCategories', { into: 'list', outlet: 'listView' });
|
||||||
controller.set('model', categoryList);
|
|
||||||
|
|
||||||
this.controllerFor('list').setProperties({
|
this.controllerFor('list').setProperties({
|
||||||
canCreateCategory: categoryList.get('can_create_category'),
|
canCreateCategory: categoryList.get('can_create_category'),
|
||||||
|
|
|
@ -6,16 +6,14 @@
|
||||||
@namespace Discourse
|
@namespace Discourse
|
||||||
@module Discourse
|
@module Discourse
|
||||||
**/
|
**/
|
||||||
Discourse.UserInvitedRoute = Discourse.Route.extend({
|
Discourse.UserInvitedRoute = Discourse.Route.extend(Discourse.ModelReady, {
|
||||||
|
|
||||||
renderTemplate: function() {
|
renderTemplate: function() {
|
||||||
this.render({ into: 'user', outlet: 'userOutlet' });
|
this.render({ into: 'user', outlet: 'userOutlet' });
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller) {
|
model: function() {
|
||||||
Discourse.InviteList.findInvitedBy(this.controllerFor('user').get('content')).then(function(invited) {
|
return Discourse.InviteList.findInvitedBy(this.modelFor('user'));
|
||||||
controller.set('content', invited);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue