Commit 60133f11f75c0c16237f18b95b737c6f49dadd04

Authored by Luciano Prestes
1 parent 59a057c7

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>
app/controllers/my_profile/profile_editor_controller.rb
... ... @@ -11,7 +11,7 @@ class ProfileEditorController &lt; MyProfileController
11 11  
12 12 def index
13 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 15 @show_header_footer_option = user.is_admin?(environment) || (!profile.enterprise? && !environment.enabled?('disable_header_and_footer'))
16 16 end
17 17  
... ...
app/controllers/themes_controller.rb
... ... @@ -43,8 +43,8 @@ class ThemesController &lt; ApplicationController
43 43 private
44 44  
45 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 48 end
49 49  
50 50 end
... ...
app/models/environment.rb
... ... @@ -123,7 +123,6 @@ class Environment &lt; ActiveRecord::Base
123 123 'disable_asset_events' => _('Disable search for events'),
124 124 'disable_categories' => _('Disable categories'),
125 125 'disable_header_and_footer' => _('Disable header/footer editing by users'),
126   - 'disable_appearance' => _('Disable appearance editing by users'),
127 126 'disable_gender_icon' => _('Disable gender icon'),
128 127 'disable_categories_menu' => _('Disable the categories menu'),
129 128 'disable_select_city_for_contact' => _('Disable state/city select for contact form'),
... ... @@ -160,6 +159,8 @@ class Environment &lt; ActiveRecord::Base
160 159 'display_my_communities_on_user_menu' => _('Display on menu the list of communities the user can manage'),
161 160 'display_my_enterprises_on_user_menu' => _('Display on menu the list of enterprises the user can manage'),
162 161 'restrict_to_members' => _('Show content only to members'),
  162 +
  163 + 'enable_appearance' => _('Enable appearance editing by users'),
163 164 }
164 165 end
165 166  
... ... @@ -439,6 +440,7 @@ class Environment &lt; ActiveRecord::Base
439 440 show_balloon_with_profile_links_when_clicked
440 441 show_zoom_button_on_article_images
441 442 use_portal_community
  443 + enable_appearance
442 444 )
443 445  
444 446 before_create :enable_default_features
... ...
test/functional/profile_themes_controller_test.rb
... ... @@ -17,6 +17,7 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase
17 17  
18 18 @env = Environment.default
19 19 @env.enable('user_themes')
  20 + @env.enable_default_features
20 21 @env.save!
21 22 end
22 23 attr_reader :profile, :env
... ... @@ -331,7 +332,7 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase
331 332  
332 333 should 'user cant edit appearance if environment dont permit' do
333 334 environment = Environment.default
334   - environment.settings[:disable_appearance_enabled] = true
  335 + environment.disable('enable_appearance')
335 336 environment.save!
336 337  
337 338 user = create_user('user').person
... ... @@ -346,7 +347,7 @@ class ProfileThemesControllerTest &lt; ActionController::TestCase
346 347  
347 348 environment = Environment.default
348 349 environment.add_admin(user)
349   - environment.settings[:disable_appearance_enabled] = true
  350 + environment.disable('enable_appearance')
350 351 environment.save!
351 352  
352 353 login_as('user')
... ...