Commit aa0d63f2bd202e236a6b1be9e0d57847145967c6

Authored by Rodrigo Souto
1 parent b18a39a8

Formating notification messages

Adding the 'Add to cart' button to assets products list.
plugins/shopping_cart/lib/shopping_cart_plugin.rb
... ... @@ -8,12 +8,12 @@ class ShoppingCartPlugin < Noosfero::Plugin
8 8 _("A shopping cart feature for enterprises")
9 9 end
10 10  
11   - def add_to_cart_button(item)
12   - if context.profile.shopping_cart
  11 + def add_to_cart_button(item, enterprise = context.profile)
  12 + if enterprise.shopping_cart
13 13 lambda {
14 14 link_to(_('Add to cart'), "add:#{item.name}",
15 15 :class => 'cart-add-item',
16   - :onclick => "Cart.addItem('#{profile.identifier}', #{item.id}, this); return false"
  16 + :onclick => "Cart.addItem('#{enterprise.identifier}', #{item.id}, this); return false"
17 17 )
18 18 }
19 19 end
... ... @@ -21,6 +21,7 @@ class ShoppingCartPlugin < Noosfero::Plugin
21 21  
22 22 alias :product_info_extras :add_to_cart_button
23 23 alias :catalog_item_extras :add_to_cart_button
  24 + alias :asset_product_extras :add_to_cart_button
24 25  
25 26 def stylesheet?
26 27 true
... ...
plugins/shopping_cart/public/style.css
... ... @@ -6,6 +6,10 @@
6 6 top: 5px;
7 7 }
8 8  
  9 +.product-item .cart-add-item {
  10 + top: 0px;
  11 +}
  12 +
9 13 .cart {
10 14 position: absolute;
11 15 right: 20px;
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/customer_notification.html.erb
1   -<% environment = @environment %>
2   -<h4><%= _('Hi %s!') % @customer[:name] %></h4>
3   -<p>
4   -<%= _('This is a notification e-mail about your buy request on %s.') % link_to(@supplier.name, @supplier.url) %>
5   -<%= _('The supplier already received your buy request and may contact you for confirmation.') %>
6   -<%= _('Please check if your information below is correct:') %>
7   -</p>
8   -<ul>
9   - <li><b><%= _('Full name') %>: </b><%= @customer[:name] %></li>
10   - <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
11   - <li><b><%= _('Address') %>: </b><%= @customer[:address] %>
12   - <br \>
13   - <%= @customer[:city]+'-'+@customer[:state]+'-'+@customer[:country] %>
14   - <br \>
15   - <%= @customer[:zip_code] %></li>
16   -</ul>
17   -<p><%=_('Here are the products you bought:')%></p>
18   -<%= items_table(@items, true) %>
19   -<p>
20   -<%=_('Thanks for buying with us!')%>
21   -<br/>
22   -<%= link_to @supplier.name, @supplier.url %>
23   -</p>
24   -<small style="color: #888"><%= _('A service of %s.') % environment.name %></small>
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + </head>
  6 + <body>
  7 + <% environment = @environment %>
  8 + <h4><%= _('Hi %s!') % @customer[:name] %></h4>
  9 +
  10 + <p>
  11 + <%= _('This is a notification e-mail about your buy request on %s.') % link_to(@supplier.name, @supplier.url) %>
  12 + <%= _('The supplier already received your buy request and may contact you for confirmation.') %>
  13 + <%= _('Please check if your information below is correct:') %>
  14 + </p>
  15 +
  16 + <ul>
  17 + <li><b><%= _('Full name') %>: </b><%= @customer[:name] %></li>
  18 + <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
  19 + <li><b><%= _('Address') %>: </b><%= @customer[:address] %><br \>
  20 + <%= @customer[:city]+'-'+@customer[:state]+'-'+@customer[:country] %><br \>
  21 + <%= @customer[:zip_code] %></li>
  22 + </ul>
  23 +
  24 + <p><%=_('Here are the products you bought:')%></p>
  25 + <%= items_table(@items, true) %>
  26 +
  27 + <p>
  28 + --<br/>
  29 + <%=_('Thanks for buying with us!')%><br/>
  30 + <%= link_to @supplier.name, @supplier.url %>
  31 + </p>
  32 + <small style="color: #888"><%= _('A service of %s.') % environment.name %></small>
  33 + </body>
  34 +</html>
... ...
plugins/shopping_cart/views/shopping_cart_plugin/mailer/supplier_notification.html.erb
1   -<% environment = @environment %>
2   -<h4><%= _('Hi %s!') % @supplier.name %></h4>
3   -<p>
4   -<%= _('This is a buy request made by %s.') % @customer[:name] %>
5   -<%= _('Below follows the customer informations:') %>
6   -</p>
7   -<ul>
8   - <li><b><%= _('Full name') %>: </b><%= @customer[:name] %></li>
9   - <li><b><%= _('Email') %>: </b><%= @customer[:email] %></li>
10   - <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
11   - <li><b><%= _('Address') %>: </b><%= @customer[:address] %>
12   - <br \>
13   - <%= @customer[:city]+'-'+@customer[:state]+'-'+@customer[:country] %>
14   - <br \>
15   - <%= @customer[:zip_code] %></li>
16   -</ul>
17   -<p><%=_('And here are the items bought by this customer:')%></p>
18   -<%= items_table(@items, true) %>
19   -<p>
20   -<%=_('If there are any problems with this email contact the admin of %s.') % environment.name %>
21   -</p>
22   -<small style="color: #888"><%= _('A service of %s.') % environment.name %></small>
  1 +<!DOCTYPE html>
  2 +<html>
  3 + <head>
  4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5 + </head>
  6 + <body>
  7 + <% environment = @environment %>
  8 + <h4><%= _('Hi %s!') % @supplier.name %></h4>
  9 +
  10 + <p>
  11 + <%= _('This is a buy request made by %s.') % @customer[:name] %>
  12 + <%= _('Below follows the customer informations:') %>
  13 + </p>
  14 +
  15 + <ul>
  16 + <li><b><%= _('Full name') %>: </b><%= @customer[:name] %></li>
  17 + <li><b><%= _('Email') %>: </b><%= @customer[:email] %></li>
  18 + <li><b><%= _('Phone number') %>: </b><%= @customer[:contact_phone] %></li>
  19 + <li><b><%= _('Address') %>: </b><%= @customer[:address] %><br \>
  20 + <%= @customer[:city]+'-'+@customer[:state]+'-'+@customer[:country] %><br \>
  21 + <%= @customer[:zip_code] %></li>
  22 + </ul>
  23 +
  24 + <p><%=_('And here are the items bought by this customer:')%></p>
  25 + <%= items_table(@items, true) %>
  26 +
  27 + <p>
  28 + --<br/>
  29 + <%=_('If there are any problems with this email contact the admin of %s.') % environment.name %>
  30 + </p>
  31 + <small style="color: #888"><%= _('A service of %s.') % environment.name %></small>
  32 + </body>
  33 +</html>
... ...