Commit 60133f11f75c0c16237f18b95b737c6f49dadd04
1 parent
59a057c7
Exists in
checkbox_to_user_can_edit_page
Change environment feature name of disable_appearance to enable_appearance
Signed-off-by: Luciano Prestes Cavalcanti <lucianopcbr@gmail.com> Signed-off-by: Victor Matias Navarro <victor.matias.navarro@gmail.com>
Showing
4 changed files
with
9 additions
and
6 deletions
Show diff stats
app/controllers/my_profile/profile_editor_controller.rb
@@ -11,7 +11,7 @@ class ProfileEditorController < MyProfileController | @@ -11,7 +11,7 @@ class ProfileEditorController < MyProfileController | ||
11 | 11 | ||
12 | def index | 12 | def index |
13 | @pending_tasks = Task.to(profile).pending.without_spam.select{|i| user.has_permission?(i.permission, profile)} | 13 | @pending_tasks = Task.to(profile).pending.without_spam.select{|i| user.has_permission?(i.permission, profile)} |
14 | - @show_appearance_option = user.is_admin?(environment) || !environment.enabled?('disable_appearance') | 14 | + @show_appearance_option = user.is_admin?(environment) || environment.enabled?('enable_appearance') |
15 | @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer')) | 15 | @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer')) |
16 | end | 16 | end |
17 | 17 |
app/controllers/themes_controller.rb
@@ -43,8 +43,8 @@ class ThemesController < ApplicationController | @@ -43,8 +43,8 @@ class ThemesController < ApplicationController | ||
43 | private | 43 | private |
44 | 44 | ||
45 | def check_user_can_edit_appearance | 45 | def check_user_can_edit_appearance |
46 | - user_can_not_edit_appearance = !user.is_admin?(environment) && environment.enabled?('disable_appearance') | ||
47 | - redirect_to request.referer || "/" if user_can_not_edit_appearance | 46 | + user_can_edit_appearance = user.is_admin?(environment) || environment.enabled?('enable_appearance') |
47 | + redirect_to request.referer || "/" unless user_can_edit_appearance | ||
48 | end | 48 | end |
49 | 49 | ||
50 | end | 50 | end |
app/models/environment.rb
@@ -123,7 +123,6 @@ class Environment < ActiveRecord::Base | @@ -123,7 +123,6 @@ class Environment < ActiveRecord::Base | ||
123 | 'disable_asset_events' => _('Disable search for events'), | 123 | 'disable_asset_events' => _('Disable search for events'), |
124 | 'disable_categories' => _('Disable categories'), | 124 | 'disable_categories' => _('Disable categories'), |
125 | 'disable_header_and_footer' => _('Disable header/footer editing by users'), | 125 | 'disable_header_and_footer' => _('Disable header/footer editing by users'), |
126 | - 'disable_appearance' => _('Disable appearance editing by users'), | ||
127 | 'disable_gender_icon' => _('Disable gender icon'), | 126 | 'disable_gender_icon' => _('Disable gender icon'), |
128 | 'disable_categories_menu' => _('Disable the categories menu'), | 127 | 'disable_categories_menu' => _('Disable the categories menu'), |
129 | 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), | 128 | 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), |
@@ -160,6 +159,8 @@ class Environment < ActiveRecord::Base | @@ -160,6 +159,8 @@ class Environment < ActiveRecord::Base | ||
160 | 'display_my_communities_on_user_menu' => _('Display on menu the list of communities the user can manage'), | 159 | 'display_my_communities_on_user_menu' => _('Display on menu the list of communities the user can manage'), |
161 | 'display_my_enterprises_on_user_menu' => _('Display on menu the list of enterprises the user can manage'), | 160 | 'display_my_enterprises_on_user_menu' => _('Display on menu the list of enterprises the user can manage'), |
162 | 'restrict_to_members' => _('Show content only to members'), | 161 | 'restrict_to_members' => _('Show content only to members'), |
162 | + | ||
163 | + 'enable_appearance' => _('Enable appearance editing by users'), | ||
163 | } | 164 | } |
164 | end | 165 | end |
165 | 166 | ||
@@ -439,6 +440,7 @@ class Environment < ActiveRecord::Base | @@ -439,6 +440,7 @@ class Environment < ActiveRecord::Base | ||
439 | show_balloon_with_profile_links_when_clicked | 440 | show_balloon_with_profile_links_when_clicked |
440 | show_zoom_button_on_article_images | 441 | show_zoom_button_on_article_images |
441 | use_portal_community | 442 | use_portal_community |
443 | + enable_appearance | ||
442 | ) | 444 | ) |
443 | 445 | ||
444 | before_create :enable_default_features | 446 | before_create :enable_default_features |
test/functional/profile_themes_controller_test.rb
@@ -17,6 +17,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | @@ -17,6 +17,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | ||
17 | 17 | ||
18 | @env = Environment.default | 18 | @env = Environment.default |
19 | @env.enable('user_themes') | 19 | @env.enable('user_themes') |
20 | + @env.enable_default_features | ||
20 | @env.save! | 21 | @env.save! |
21 | end | 22 | end |
22 | attr_reader :profile, :env | 23 | attr_reader :profile, :env |
@@ -331,7 +332,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | @@ -331,7 +332,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | ||
331 | 332 | ||
332 | should 'user cant edit appearance if environment dont permit' do | 333 | should 'user cant edit appearance if environment dont permit' do |
333 | environment = Environment.default | 334 | environment = Environment.default |
334 | - environment.settings[:disable_appearance_enabled] = true | 335 | + environment.disable('enable_appearance') |
335 | environment.save! | 336 | environment.save! |
336 | 337 | ||
337 | user = create_user('user').person | 338 | user = create_user('user').person |
@@ -346,7 +347,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | @@ -346,7 +347,7 @@ class ProfileThemesControllerTest < ActionController::TestCase | ||
346 | 347 | ||
347 | environment = Environment.default | 348 | environment = Environment.default |
348 | environment.add_admin(user) | 349 | environment.add_admin(user) |
349 | - environment.settings[:disable_appearance_enabled] = true | 350 | + environment.disable('enable_appearance') |
350 | environment.save! | 351 | environment.save! |
351 | 352 | ||
352 | login_as('user') | 353 | login_as('user') |