2014-03-05 20:52:20 +08:00
|
|
|
Discourse.AdminBadgesRoute = Discourse.Route.extend({
|
2014-07-24 16:28:09 +08:00
|
|
|
setupController: function(controller) {
|
|
|
|
Discourse.ajax('/admin/badges.json').then(function(json){
|
2014-07-27 16:22:01 +08:00
|
|
|
|
|
|
|
controller.set('badgeGroupings', Em.A(json.badge_groupings));
|
2014-03-05 20:52:20 +08:00
|
|
|
controller.set('badgeTypes', json.badge_types);
|
2014-07-24 16:28:09 +08:00
|
|
|
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));
|
2014-03-05 20:52:20 +08:00
|
|
|
});
|
2014-07-27 16:22:01 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
actions: {
|
|
|
|
editGroupings: function(model){
|
|
|
|
Discourse.Route.showModal(this, 'admin_edit_badge_groupings', model);
|
|
|
|
}
|
2014-03-05 20:52:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|