mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 01:47:22 +08:00
FIX: Category creation failed when translation was missing
This commit is contained in:
parent
d97548114f
commit
a6714e252e
|
@ -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');
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -3,7 +3,7 @@ class SiteSerializer < ApplicationSerializer
|
|||
attributes :default_archetype,
|
||||
:notification_types,
|
||||
:post_types,
|
||||
:group_names,
|
||||
:groups,
|
||||
:filters,
|
||||
:periods,
|
||||
:top_menu_items,
|
||||
|
|
|
@ -1275,7 +1275,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
Loading…
Reference in New Issue
Block a user