diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 3d9121b..17b78cc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1259,25 +1259,27 @@ module ApplicationHelper task.information[:message] % values end + def add_zoom_to_article_images + add_zoom_to_images if environment.enabled?(:show_zoom_button_on_article_images) + end + def add_zoom_to_images - if environment.enabled?(:show_zoom_button_on_article_images) - stylesheet_link_tag('fancybox') + - javascript_include_tag('jquery.fancybox-1.3.4.pack') + - javascript_tag("jQuery(function($) { - $(window).load( function() { - $('#article .article-body img').each( function(index) { - var original = original_image_dimensions($(this).attr('src')); - if ($(this).width() < original['width'] || $(this).height() < original['height']) { - $(this).wrap('
'); - $(this).parent('.zoomable-image').attr('style', $(this).attr('style')); - $(this).attr('style', ''); - $(this).after(\'%s'); - } - }); - $('.zoomify-image').fancybox(); + stylesheet_link_tag('fancybox') + + javascript_include_tag('jquery.fancybox-1.3.4.pack') + + javascript_tag("jQuery(function($) { + $(window).load( function() { + $('#article .article-body img').each( function(index) { + var original = original_image_dimensions($(this).attr('src')); + if ($(this).width() < original['width'] || $(this).height() < original['height']) { + $(this).wrap('
'); + $(this).parent('.zoomable-image').attr('style', $(this).attr('style')); + $(this).attr('style', ''); + $(this).after(\'%s'); + } }); - });" % _('Zoom in')) - end + $('.zoomify-image').fancybox(); + }); + });" % _('Zoom in')) end def render_dialog_error_messages(instance_name) diff --git a/app/views/catalog/index.rhtml b/app/views/catalog/index.rhtml index b317ab3..d6f4d81 100644 --- a/app/views/catalog/index.rhtml +++ b/app/views/catalog/index.rhtml @@ -13,14 +13,14 @@ +
<%= extra_content.join("\n") %>
+ @@ -74,8 +74,10 @@
<% product.inputs.each do |i| %> -
<%= "#{i.amount_used} #{i.unit.singular} #{_('of')} " if i.has_all_price_details? %> - <%= "#{i.product_category.name}" %>
+
+ <%= _('%{amount_used} %{unit} of') % {:amount_used => i.amount_used, :unit => i.unit.singular} + ' ' if i.has_all_price_details? %> + <%= i.product_category.name %> +
<% end %>
@@ -100,12 +102,4 @@ <%= pagination_links @products, :params => {:controller => :catalog, :action => :index, :profile => profile.identifier} %> - +<%= add_zoom_to_images %> diff --git a/app/views/content_viewer/view_page.rhtml b/app/views/content_viewer/view_page.rhtml index 2539796..3fee903 100644 --- a/app/views/content_viewer/view_page.rhtml +++ b/app/views/content_viewer/view_page.rhtml @@ -91,4 +91,4 @@
-<%= add_zoom_to_images %> +<%= add_zoom_to_article_images %> diff --git a/features/browse_catalogs.feature b/features/browse_catalogs.feature index 0f75613..125b50b 100644 --- a/features/browse_catalogs.feature +++ b/features/browse_catalogs.feature @@ -66,7 +66,7 @@ Feature: browse catalogs | artebonito | categ1 | Produto1 | 0.00 | And I am on /catalog/artebonito Then I should see "Produto1" within "li.product-link" - And I should not see "0.00" + And I should not see "0.00" And I should see "No image" within ".no-image" And I should not see "product unavailable" And I should not see "description" @@ -150,7 +150,7 @@ Feature: browse catalogs And the "product-description" should be visible @selenium - Scenario: hide description + Scenario: hide description Given the following products | owner | category | name | price | description | | artebonito | categ1 | Produto3 | 12.34 | A small description for a product that doesn't exist. | @@ -234,7 +234,7 @@ Feature: browse catalogs | name | plural | | Liter | Liters | And the following input - | product | category | + | product | category | | Vitamina | food | And I am on /catalog/artebonito And I reload and wait for the page diff --git a/public/javascripts/catalog.js b/public/javascripts/catalog.js index f7fc4e3..74596c0 100644 --- a/public/javascripts/catalog.js +++ b/public/javascripts/catalog.js @@ -12,6 +12,15 @@ $(document).live('click', function() { $.each($('#product-list .product .expand-box'), function(index, value) { value.clicked = false; click(value); }); }); +$(document).click(function (event) { + if ($(event.target).parents('.expand-box').length == 0) { + $('.expand-box').each(function(index, element){ + $(element).removeClass('open'); + $(element).children('div').toggle(false); + }); + } +}); + var rows = {}; $('#product-list .product').each(function (index, element) { obj = rows[$(element).offset().top] || {}; @@ -50,11 +59,4 @@ function hover() { jQuery(this).toggleClass('hover'); } -jQuery(document).click(function (event) { - if (jQuery(event.target).parents('.expand-box').length == 0) { - jQuery('.expand-box').each(function(index, element){ - jQuery(element).removeClass('open'); - jQuery(element).children('div').toggle(false); - }); - } -}); + diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 9453653..35e7e78 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2994,12 +2994,9 @@ div#activation_enterprise div { #product-list .expand-box { background-color: #1EB46D; margin-bottom: 3px; - -moz-border-radius-topleft: 10px; - -moz-border-radius-topright: 0px; - -moz-border-radius-bottomright: 0px; - -moz-border-radius-bottomleft: 10px; + -moz-border-radius: 10px 0px 0px 10px; -webkit-border-radius: 10px 0px 0px 10px; - border-radius: 10px 0px 0px 10px; + border-radius: 10px 0px 0px 10px; width: 202px; } #product-list .expand-box > span { @@ -3148,10 +3145,10 @@ div#activation_enterprise div { margin: 0; } #product-list .ui-button-text { - color: #D38D5F; - font-size: 0.8em; - padding: 0.1em 0.3em 0.1em 3em; - } + color: #D38D5F; + font-size: 0.8em; + padding: 0.1em 0.3em 0.1em 3em; +} #product-list .product-big span { display: none; } diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index c986a9d..54fa13c 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -649,13 +649,18 @@ class ApplicationHelperTest < Test::Unit::TestCase env = Environment.default env.stubs(:enabled?).with(:show_zoom_button_on_article_images).returns(false) stubs(:environment).returns(env) - assert_nil add_zoom_to_images + assert_nil add_zoom_to_article_images end should 'return code when :show_zoom_button_on_article_images is enabled in environment' do env = Environment.default env.stubs(:enabled?).with(:show_zoom_button_on_article_images).returns(true) stubs(:environment).returns(env) + assert_not_nil add_zoom_to_article_images + end + + should 'return code when add_zoom_to_images' do + env = Environment.default assert_not_nil add_zoom_to_images end -- libgit2 0.21.2