discourse/app/assets/javascripts/admin/routes/admin_badges_route.js
Sam ec03d135fa FEATURE: allow advanced badge options in admin screen
clean up serializer, allow simplistic preview
2014-07-24 18:28:23 +10:00

16 lines
667 B
JavaScript

Discourse.AdminBadgesRoute = Discourse.Route.extend({
setupController: function(controller) {
Discourse.ajax('/admin/badges.json').then(function(json){
controller.set('badgeGroupings', json.badge_groupings);
controller.set('badgeTypes', json.badge_types);
controller.set('protectedSystemFields', json.admin_badges.protected_system_fields);
var triggers = [];
_.each(json.admin_badges.triggers,function(v,k){
triggers.push({id: v, name: I18n.t('admin.badges.trigger_type.'+k)});
});
controller.set('badgeTriggers', triggers);
controller.set('model', Discourse.Badge.createFromJson(json));
});
}
});