Skip to content

Commit

Permalink
update paint
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre committed Feb 23, 2010
1 parent d64e883 commit 773e775
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/views/paint_colors/_list.html.erb
@@ -1,22 +1,24 @@
<% if @product.paint_colors.size>0 %>
<p>Cette maquette est vendu sans peinture, les peintures nécessaires à cette maquette sont listés ci dessous : <br/>

<p>Cette maquette est vendue sans peinture, les peintures nécessaires à cette maquette sont listées ci dessous : <br/>
<% PaintColorType.all.each do |type| %>
<% products = @product.paint_colors.paint_type(type.id).map(&:color_product) %>
<% if products.size %>
<div class="paint">
<%= link_to("<span class=\"fx-iconmodel fx-modelpaint\"></span><span class=\"content\">Acheter la maquette et ses peintures #{type.title}</span>","#",:class=>"ui-widget-content ui-state-default",:onclick=>"javascript:spree.general.add_to_cart('/orders','#{@product.name} et ses #{type.description}','#{@product.variant.id},#{products.map(&:variant).map(&:id).join(",")}');return false;") %>
<% total = @product.final_price + products.map(&:final_price).sum %>
<%= link_to("<span class=\"fx-iconmodel fx-modelpaint\"></span><span class=\"content\">Acheter la maquette et ses peintures #{type.title} = #{number_to_currency(total)}</span>","#",:class=>"ui-widget-content ui-state-default",:onclick=>"javascript:spree.general.add_to_cart('/orders','#{@product.name} et ses #{type.description}','#{@product.variant.id},#{products.map(&:variant).map(&:id).join(",")}');return false;") %>
</div>
<% end %>
<% end %>
<% PaintColorType.all.each do |type| %>
<% products = @product.paint_colors.paint_type(type.id).map(&:color_product) %>
<% if products.size %>
<div class="paint">
<%= link_to("<span class=\"fx-iconmodel fx-paint\"></span><span class=\"content\">Acheter seulement les peintures #{type.title} pour cette maquette</span>","#",:class=>"ui-widget-content ui-state-default",:onclick=>"javascript:spree.general.add_to_cart('/orders','#{type.description} de la maquette #{escape_javascript(@product.name)}','#{products.map(&:variant).map(&:id).join(",")}');return false;") %>
<% total = products.map(&:final_price).sum %>
<%= link_to("<span class=\"fx-iconmodel fx-paint\"></span><span class=\"content\">Acheter seulement les peintures #{type.title} pour cette maquette = #{number_to_currency(total)}</span>","#",:class=>"ui-widget-content ui-state-default",:onclick=>"javascript:spree.general.add_to_cart('/orders','#{type.description} de la maquette #{escape_javascript(@product.name)}','#{products.map(&:variant).map(&:id).join(",")}');return false;") %>
</div>
<% end %>
<% end %>
<i>Une seule des deux gammes de peinture est nécessaire</i>
</p>
<% PaintColorType.all.each do |type| %>
<% products = @product.paint_colors.paint_type(type.id).map(&:color_product) %>
Expand Down

0 comments on commit 773e775

Please sign in to comment.