Commit 7b1826d2c9a1bdaab0d1ade895d888d474608506
1 parent
e8c00784
Exists in
master
and in
22 other branches
zoom-article-image: enabling zoom button on article images by default
AI3086
Showing
3 changed files
with
32 additions
and
12 deletions
Show diff stats
app/models/environment.rb
... | ... | @@ -337,20 +337,22 @@ class Environment < ActiveRecord::Base |
337 | 337 | features.delete_if{ |k, v| !self.enabled?(k) } |
338 | 338 | end |
339 | 339 | |
340 | + DEFAULT_FEATURES = %w( | |
341 | + disable_asset_products | |
342 | + disable_gender_icon | |
343 | + products_for_enterprises | |
344 | + disable_select_city_for_contact | |
345 | + enterprise_registration | |
346 | + media_panel | |
347 | + organizations_are_moderated_by_default | |
348 | + show_balloon_with_profile_links_when_clicked | |
349 | + show_zoom_button_on_article_images | |
350 | + use_portal_community | |
351 | + ) | |
352 | + | |
340 | 353 | before_create :enable_default_features |
341 | 354 | def enable_default_features |
342 | - %w( | |
343 | - disable_asset_products | |
344 | - disable_gender_icon | |
345 | - products_for_enterprises | |
346 | - disable_select_city_for_contact | |
347 | - enterprise_registration | |
348 | - media_panel | |
349 | - organizations_are_moderated_by_default | |
350 | - show_balloon_with_profile_links_when_clicked | |
351 | - show_zoom_button_on_article_images | |
352 | - use_portal_community | |
353 | - ).each do |feature| | |
355 | + DEFAULT_FEATURES.each do |feature| | |
354 | 356 | enable(feature, false) |
355 | 357 | end |
356 | 358 | end | ... | ... |
db/migrate/20140408172149_enable_show_zoom_button_on_article_images.rb
0 → 100644
... | ... | @@ -0,0 +1,11 @@ |
1 | +class EnableShowZoomButtonOnArticleImages < ActiveRecord::Migration | |
2 | + def self.up | |
3 | + Environment.find_each do |environment| | |
4 | + environment.enable(:show_zoom_button_on_article_images) | |
5 | + end | |
6 | + end | |
7 | + | |
8 | + def self.down | |
9 | + say("This migration is irreversible.") | |
10 | + end | |
11 | +end | ... | ... |
test/unit/environment_test.rb
... | ... | @@ -53,6 +53,13 @@ class EnvironmentTest < ActiveSupport::TestCase |
53 | 53 | assert !v.enabled?('feature1') && !v.enabled?('feature2') && !v.enabled?('feature3') |
54 | 54 | end |
55 | 55 | |
56 | + def test_default_enabled_features_are_enabled | |
57 | + environment = Environment.create(:name => 'Testing') | |
58 | + Environment::DEFAULT_FEATURES.each do |features| | |
59 | + assert environment.enabled?(features) | |
60 | + end | |
61 | + end | |
62 | + | |
56 | 63 | def test_name_is_mandatory |
57 | 64 | v = Environment.new |
58 | 65 | v.valid? | ... | ... |