Commit 281ae6cccd2aeff55fc6737ea5143a3a1acbd240
Exists in
master
and in
29 other branches
Merge branch 'zoom-article-image' into 'stable'
Shows a zoom link on article images by default https://noosfero.org/Development/ActionItem3086
Showing
3 changed files
with
32 additions
and
11 deletions
Show diff stats
app/models/environment.rb
@@ -337,19 +337,22 @@ class Environment < ActiveRecord::Base | @@ -337,19 +337,22 @@ class Environment < ActiveRecord::Base | ||
337 | features.delete_if{ |k, v| !self.enabled?(k) } | 337 | features.delete_if{ |k, v| !self.enabled?(k) } |
338 | end | 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 | before_create :enable_default_features | 353 | before_create :enable_default_features |
341 | def enable_default_features | 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 | - use_portal_community | ||
352 | - ).each do |feature| | 355 | + DEFAULT_FEATURES.each do |feature| |
353 | enable(feature, false) | 356 | enable(feature, false) |
354 | end | 357 | end |
355 | end | 358 | end |
db/migrate/20140408172149_enable_show_zoom_button_on_article_images.rb
0 → 100644
@@ -0,0 +1,11 @@ | @@ -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,6 +53,13 @@ class EnvironmentTest < ActiveSupport::TestCase | ||
53 | assert !v.enabled?('feature1') && !v.enabled?('feature2') && !v.enabled?('feature3') | 53 | assert !v.enabled?('feature1') && !v.enabled?('feature2') && !v.enabled?('feature3') |
54 | end | 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 | def test_name_is_mandatory | 63 | def test_name_is_mandatory |
57 | v = Environment.new | 64 | v = Environment.new |
58 | v.valid? | 65 | v.valid? |