mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
Merge pull request #2808 from gschlager/i18n_fix07
FIX: Category creation failed when translation was missing
This commit is contained in:
commit
8371837b21
5 changed files with 12 additions and 7 deletions
|
@ -45,9 +45,15 @@ Discourse.DiscoveryCategoriesRoute = Discourse.Route.extend(Discourse.OpenCompos
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
createCategory: function() {
|
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({
|
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}],
|
color: 'AB9364', text_color: 'FFFFFF', group_permissions: [{group_name: everyone_group.name, permission_type: 1}],
|
||||||
available_groups: Discourse.Site.current().group_names,
|
available_groups: group_names,
|
||||||
allow_badges: true
|
allow_badges: true
|
||||||
}));
|
}));
|
||||||
this.controllerFor('editCategory').set('selectedTab', 'general');
|
this.controllerFor('editCategory').set('selectedTab', 'general');
|
||||||
|
|
|
@ -29,8 +29,8 @@ class Site
|
||||||
TrustLevel.all
|
TrustLevel.all
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_names
|
def groups
|
||||||
@group_name ||= Group.order(:name).pluck(:name)
|
@groups ||= Group.order(:name).map { |g| {:id => g.id, :name => g.name}}
|
||||||
end
|
end
|
||||||
|
|
||||||
def categories
|
def categories
|
||||||
|
|
|
@ -3,7 +3,7 @@ class SiteSerializer < ApplicationSerializer
|
||||||
attributes :default_archetype,
|
attributes :default_archetype,
|
||||||
:notification_types,
|
:notification_types,
|
||||||
:post_types,
|
:post_types,
|
||||||
:group_names,
|
:groups,
|
||||||
:filters,
|
:filters,
|
||||||
:periods,
|
:periods,
|
||||||
:top_menu_items,
|
:top_menu_items,
|
||||||
|
|
|
@ -1278,7 +1278,6 @@ en:
|
||||||
allow_badges_label: "Allow badges to be awarded in this category"
|
allow_badges_label: "Allow badges to be awarded in this category"
|
||||||
edit_permissions: "Edit Permissions"
|
edit_permissions: "Edit Permissions"
|
||||||
add_permission: "Add Permission"
|
add_permission: "Add Permission"
|
||||||
everyone_permission: "everyone"
|
|
||||||
this_year: "this year"
|
this_year: "this year"
|
||||||
position: "position"
|
position: "position"
|
||||||
default_position: "Default Position"
|
default_position: "Default Position"
|
||||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue