Commit aa0d63f2bd202e236a6b1be9e0d57847145967c6
1 parent
b18a39a8
Exists in
master
and in
22 other branches
Formating notification messages
Adding the 'Add to cart' button to assets products list.
Showing
4 changed files
with
75 additions
and
49 deletions
Show diff stats
plugins/shopping_cart/lib/shopping_cart_plugin.rb
| @@ -8,12 +8,12 @@ class ShoppingCartPlugin < Noosfero::Plugin | @@ -8,12 +8,12 @@ class ShoppingCartPlugin < Noosfero::Plugin | ||
| 8 | _("A shopping cart feature for enterprises") | 8 | _("A shopping cart feature for enterprises") |
| 9 | end | 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 | lambda { | 13 | lambda { |
| 14 | link_to(_('Add to cart'), "add:#{item.name}", | 14 | link_to(_('Add to cart'), "add:#{item.name}", |
| 15 | :class => 'cart-add-item', | 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 | end | 19 | end |
| @@ -21,6 +21,7 @@ class ShoppingCartPlugin < Noosfero::Plugin | @@ -21,6 +21,7 @@ class ShoppingCartPlugin < Noosfero::Plugin | ||
| 21 | 21 | ||
| 22 | alias :product_info_extras :add_to_cart_button | 22 | alias :product_info_extras :add_to_cart_button |
| 23 | alias :catalog_item_extras :add_to_cart_button | 23 | alias :catalog_item_extras :add_to_cart_button |
| 24 | + alias :asset_product_extras :add_to_cart_button | ||
| 24 | 25 | ||
| 25 | def stylesheet? | 26 | def stylesheet? |
| 26 | true | 27 | true |
plugins/shopping_cart/public/style.css
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> |