Merge pull request #2808 from gschlager/i18n_fix07

FIX: Category creation failed when translation was missing
This commit is contained in:
Sam 2014-09-29 16:20:02 +10:00
commit 8371837b21
5 changed files with 12 additions and 7 deletions

View file

@ -45,9 +45,15 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos
actions: {
createCategory: function() {
var groups = Discourse.Site.current().groups;
var everyone_group = groups.findBy('id', 0);
var group_names = groups.map(function(group) {
return group.name;
});
Discourse.Route.showModal(this, 'editCategory', Discourse.Category.create({
color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: I18n.t('category.everyone_permission'), permission_type: 1}],
available_groups: Discourse.Site.current().group_names,
color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: everyone_group.name, permission_type: 1}],
available_groups: group_names,
allow_badges: true
}));
this.controllerFor('editCategory').set('selectedTab', 'general');

View file

@ -29,8 +29,8 @@ class Site
TrustLevel.all
end
def group_names
@group_name ||= Group.order(:name).pluck(:name)
def groups
@groups ||= Group.order(:name).map { |g| {:id => g.id, :name => g.name}}
end
def categories

View file

@ -3,7 +3,7 @@ class SiteSerializer < ApplicationSerializer
attributes :default_archetype,
:notification_types,
:post_types,
:group_names,
:groups,
:filters,
:periods,
:top_menu_items,

View file

@ -1278,7 +1278,6 @@ en:
allow_badges_label: "Allow badges to be awarded in this category"
edit_permissions: "Edit Permissions"
add_permission: "Add Permission"
everyone_permission: "everyone"
this_year: "this year"
position: "position"
default_position: "Default Position"

File diff suppressed because one or more lines are too long