From b7caa338417b484d0d70d11707e2afba770bcca4 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 15 Apr 2014 16:42:24 +1000 Subject: [PATCH] Site setting to allow mods to create categories --- config/locales/server.en.yml | 1 + config/site_settings.yml | 1 + lib/guardian/category_guardian.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index c53b1c01a39..86e44149462 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -656,6 +656,7 @@ en: ga_universal_domain_name: "Google Universal Analytics (analytics.js) domain name, eg: mysite.com; see http://google.com/analytics" enable_escaped_fragments: "Fall back to Google's Ajax-Crawling API if a crawler is not detected." enable_noscript_support: "Enable standard webcrawler search engine support via the noscript tag" + allow_moderators_to_create_categories: "Allow moderators to create new categories" top_menu: "Determine which items appear in the homepage navigation, and in what order. Example latest|new|unread|starred|categories|top|read|posted" post_menu: "Determine which items appear on the post menu, and in what order. Example like|edit|flag|delete|share|bookmark|reply" share_links: "Determine which items appear on the share dialog, and in what order. Example twitter|facebook|google+|email" diff --git a/config/site_settings.yml b/config/site_settings.yml index b12808c98d6..e64c397a6a9 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -345,6 +345,7 @@ security: enable_escaped_fragments: true allow_index_in_robots_txt: true enable_noscript_support: true + allow_moderators_to_create_categories: false onebox: enable_flash_video_onebox: false diff --git a/lib/guardian/category_guardian.rb b/lib/guardian/category_guardian.rb index 66ce6102f57..0696a41e428 100644 --- a/lib/guardian/category_guardian.rb +++ b/lib/guardian/category_guardian.rb @@ -2,7 +2,7 @@ module CategoryGuardian # Creating Method def can_create_category?(parent) - is_admin? + is_admin? || (SiteSetting.allow_moderators_to_create_categories && is_moderator?) end # Editing Method