diff --git a/app/controllers/my_profile/manage_products_controller.rb b/app/controllers/my_profile/manage_products_controller.rb index ed181dc..575d510 100644 --- a/app/controllers/my_profile/manage_products_controller.rb +++ b/app/controllers/my_profile/manage_products_controller.rb @@ -6,10 +6,10 @@ class ManageProductsController < ApplicationController before_filter :login_required, :except => [:show] before_filter :create_product?, :only => [:new] - protected + protected def check_environment_feature - if profile.environment.enabled?('disable_products_for_enterprises') + unless profile.environment.enabled?('products_for_enterprises') render_not_found return end diff --git a/app/controllers/my_profile/profile_design_controller.rb b/app/controllers/my_profile/profile_design_controller.rb index 69b7a62..5ee727a 100644 --- a/app/controllers/my_profile/profile_design_controller.rb +++ b/app/controllers/my_profile/profile_design_controller.rb @@ -38,7 +38,7 @@ class ProfileDesignController < BoxOrganizerController end # product block exclusive for enterprises in environments that permits it - if profile.enterprise? && !profile.environment.enabled?('disable_products_for_enterprises') + if profile.enterprise? && profile.environment.enabled?('products_for_enterprises') blocks << ProductsBlock end diff --git a/app/controllers/public/catalog_controller.rb b/app/controllers/public/catalog_controller.rb index dd0929a..26178b3 100644 --- a/app/controllers/public/catalog_controller.rb +++ b/app/controllers/public/catalog_controller.rb @@ -12,7 +12,7 @@ class CatalogController < PublicController protected def check_enterprise_and_environment - unless profile.kind_of?(Enterprise) && !profile.environment.enabled?('disable_products_for_enterprises') + unless profile.kind_of?(Enterprise) && @profile.environment.enabled?('products_for_enterprises') redirect_to :controller => 'profile', :profile => profile.identifier, :action => 'index' end end diff --git a/app/models/enterprise.rb b/app/models/enterprise.rb index 89e3962..5982444 100644 --- a/app/models/enterprise.rb +++ b/app/models/enterprise.rb @@ -134,7 +134,7 @@ class Enterprise < Organization [ProfileImageBlock.new, LinkListBlock.new(:links => links)], [] ] - if !environment.enabled?('disable_products_for_enterprises') + if environment.enabled?('products_for_enterprises') blocks[2].unshift ProductsBlock.new end blocks diff --git a/app/models/environment.rb b/app/models/environment.rb index 7ef039e..d736363 100644 --- a/app/models/environment.rb +++ b/app/models/environment.rb @@ -95,7 +95,6 @@ class Environment < ActiveRecord::Base 'disable_asset_communities' => __('Disable search for communities'), 'disable_asset_products' => _('Disable search for products'), 'disable_asset_events' => _('Disable search for events'), - 'disable_products_for_enterprises' => __('Disable products for enterprises'), 'disable_categories' => _('Disable categories'), 'disable_header_and_footer' => _('Disable header/footer editing by users'), 'disable_gender_icon' => _('Disable gender icon'), @@ -103,9 +102,13 @@ class Environment < ActiveRecord::Base 'disable_select_city_for_contact' => _('Disable state/city select for contact form'), 'disable_contact_person' => _('Disable contact for people'), 'disable_contact_community' => _('Disable contact for groups/communities'), - 'enterprise_registration' => __('Enterprise registration'), + 'products_for_enterprises' => __('Enable products for enterprises'), + 'enterprise_registration' => __('Enterprise registration'), 'enterprise_activation' => __('Enable activation of enterprises'), + 'enterprises_are_disabled_when_created' => __('Enterprises are disabled when created'), + 'enterprises_are_validated_when_created' => __('Enterprises are validated when created'), + 'media_panel' => _('Media panel in WYSIWYG editor'), 'select_preferred_domain' => _('Select preferred domains per profile'), 'use_portal_community' => _('Use the portal as news source for front page'), @@ -118,8 +121,6 @@ class Environment < ActiveRecord::Base 'organizations_are_moderated_by_default' => _("Organizations have moderated publication by default"), 'enable_organization_url_change' => _("Allow organizations to change their URL"), 'admin_must_approve_new_communities' => _("Admin must approve creation of communities"), - 'enterprises_are_disabled_when_created' => __('Enterprises are disabled when created'), - 'enterprises_are_validated_when_created' => __('Enterprises are validated when created'), 'show_balloon_with_profile_links_when_clicked' => _('Show a balloon with profile links when a profile image is clicked'), 'xmpp_chat' => _('XMPP/Jabber based chat'), 'show_zoom_button_on_article_images' => _('Show a zoom link on all article images'), @@ -281,8 +282,9 @@ class Environment < ActiveRecord::Base end # Enables a feature identified by its name - def enable(feature) + def enable(feature, must_save=true) self.settings["#{feature}_enabled".to_sym] = true + self.save! if must_save end def enable_plugin(plugin) @@ -292,8 +294,9 @@ class Environment < ActiveRecord::Base end # Disables a feature identified by its name - def disable(feature) + def disable(feature, must_save=true) self.settings["#{feature}_enabled".to_sym] = false + self.save! if must_save end def disable_plugin(plugin) @@ -337,7 +340,7 @@ class Environment < ActiveRecord::Base %w( disable_asset_products disable_gender_icon - disable_products_for_enterprises + products_for_enterprises disable_select_city_for_contact enterprise_registration media_panel @@ -345,7 +348,7 @@ class Environment < ActiveRecord::Base show_balloon_with_profile_links_when_clicked use_portal_community ).each do |feature| - enable(feature) + enable(feature, false) end end diff --git a/app/models/price_detail.rb b/app/models/price_detail.rb index f24fc58..958c1a5 100644 --- a/app/models/price_detail.rb +++ b/app/models/price_detail.rb @@ -8,7 +8,7 @@ class PriceDetail < ActiveRecord::Base validates_uniqueness_of :production_cost_id, :scope => :product_id def name - production_cost.nil? ? _('other costs') : production_cost.name + production_cost.nil? ? _('Other costs') : production_cost.name end def price diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index 012ffc8..b60fb5e 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -17,7 +17,7 @@