FIX: Linking to users on admin dashboard was broken

This commit is contained in:
Robin Ward 2013-07-23 13:35:32 -04:00
parent b9a5a0460d
commit 6237a155e7
2 changed files with 12 additions and 2 deletions
app/assets/javascripts/admin/routes

@ -23,9 +23,19 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
_.each(d.reports,function(report){ _.each(d.reports,function(report){
c.set(report.type, Discourse.Report.create(report)); c.set(report.type, Discourse.Report.create(report));
}); });
_.each(['admins', 'moderators', 'blocked', 'banned', 'top_referrers', 'top_traffic_sources', 'top_referred_topics'], function(x) {
var topReferrers = d.top_referrers;
if (topReferrers && topReferrers.data) {
d.top_referrers.data = topReferrers.data.map(function (user) {
return Discourse.AdminUser.create(user);
});
c.set('top_referrers', topReferrers);
}
['admins', 'moderators', 'blocked', 'banned', 'top_traffic_sources', 'top_referred_topics'].forEach(function(x) {
c.set(x, d[x]); c.set(x, d[x]);
}); });
c.set('loading', false); c.set('loading', false);
}); });
} }

@ -26,8 +26,8 @@ Discourse.AdminUserRoute = Discourse.Route.extend({
adminUser.loadDetails().then(function () { adminUser.loadDetails().then(function () {
adminUser.setOriginalTrustLevel(); adminUser.setOriginalTrustLevel();
controller.set('model', adminUser); controller.set('model', adminUser);
window.scrollTo(0, 0);
}); });
} }
}); });