diff --git a/app/views/catalog/index.rhtml b/app/views/catalog/index.rhtml index bdfec1c..9db745e 100644 --- a/app/views/catalog/index.rhtml +++ b/app/views/catalog/index.rhtml @@ -64,20 +64,20 @@ <% if product.description %>
  • - <%= _('description') %> -
    + <%= _('description') %> +
    -
    <%= txt2html(product.description || '') %>
    +
    <%= product.description %>
  • <% end %> <% if product.price_described? %>
  • - <%= _('price composition') %> -
    + <%= _('price composition') %> +
    -
    +
    <% product.inputs.relevant_to_price.each do |i| %>
    <%= i.product_category.name %>
    @@ -98,9 +98,9 @@ <% if product.inputs.count > 0 %>
  • <%= _('inputs and raw materials') %> -
    +
    -
    +
    <% product.inputs.each do |i| %>
    <%= _('%{amount_used} %{unit} of') % {:amount_used => i.amount_used, :unit => i.unit.singular} + ' ' if i.has_all_price_details? %> diff --git a/public/javascripts/catalog.js b/public/javascripts/catalog.js index 9e9341c..79e56e2 100644 --- a/public/javascripts/catalog.js +++ b/public/javascripts/catalog.js @@ -1,47 +1,29 @@ (function($) { -$('#product-list .product .expand-box').live('click', function () { - $('.expand-box').each(function(index, element){ this.clicked = false; toggle_expandbox(this); }); - this.clicked = !this.clicked; - toggle_expandbox(this); - $.each($(this).siblings('.expand-box'), function(index, value) { value.clicked = false; toggle_expandbox(value); }); - - return false; -}); - -$(document).live('click', function() { - $.each($('#product-list .product .expand-box'), function(index, value) { value.clicked = false; toggle_expandbox(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] || {}; - - obj.heights = obj.heights || []; - obj.elements = obj.elements || []; - obj.heights.push($(element).height()); - obj.elements.push(element); - - rows[$(element).offset().top] = obj; -}); - -$.each(rows, function(top, obj) { - maxWidth = Array.max(obj.heights); - $(obj.elements).height(maxWidth); -}); + function toggle_expandbox(element, open) { + element.clicked = open; + $(element).toggleClass('open', open); + } + + $('#product-list .expand-box').live('click', function () { + var me = this; + $('.expand-box').each(function(index, element){ + if ( element != me ) toggle_expandbox(element, false); + }); + toggle_expandbox(me, !me.clicked); + return false; + }); + + $('#product-list .float-box').live('click', function () { + return false; + }); + + $(document).click(function (event) { + if ($(event.target).parents('.expand-box').length == 0) { + $('#product-list .expand-box').each(function(index, element){ + toggle_expandbox(element, false); + }); + } + }); })(jQuery); - -function toggle_expandbox(e) { - jQuery(e).toggleClass('open', e.clicked); - jQuery(e).children('div').toggle(e.clicked).css({left: jQuery(e).position().left-180, top: jQuery(e).position().top-10}); -} diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css index 545d48f..e0cc7a6 100644 --- a/public/stylesheets/application.css +++ b/public/stylesheets/application.css @@ -2509,6 +2509,7 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation -webkit-border-radius: 10px 0px 0px 10px; border-radius: 10px 0px 0px 10px; width: 202px; + position: relative; } #product-list .expand-box > span { padding-left: 20px; @@ -2539,17 +2540,22 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation #product-list li.product .expand-box > span { text-transform: uppercase; } -#product-list li.product .expand-box > div { +#product-list li.product .expand-box .float-box { display: none; position: absolute; + left: -220px; + top: -11px; z-index: 10; } +#product-list li.product .expand-box.open .float-box { + display: block; +} #product-list li.product .expand-box .content { font-size: 11px; padding: 6px 5px; overflow: auto; max-height: 200px; - width: 160px; + width: 200px; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; @@ -2784,7 +2790,7 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation position: relative; clear: left; } -#product-description, #product-details, #product-info, .input-item { +#product-details, #product-info, .input-item { overflow: hidden; } #product-info { -- libgit2 0.21.2