Commit 77496dba4c5fa56783f3aa13de8b41a7e5f8515c

Authored by Rodrigo Souto
1 parent 553c713a

Signing plugin to hot spots

plugins/shopping_cart/lib/shopping_cart_plugin.rb 0 → 100644
... ... @@ -0,0 +1,35 @@
  1 +class ShoppingCartPlugin < Noosfero::Plugin
  2 +
  3 + def self.plugin_name
  4 + "Shopping Cart"
  5 + end
  6 +
  7 + def self.plugin_description
  8 + _("A shopping cart feature for enterprises")
  9 + end
  10 +
  11 + def add_to_cart_button(item)
  12 + lambda {
  13 + link_to(_('Add to cart'), "add:#{item.name}",
  14 + :class => 'cart-add-item',
  15 + :onclick => "Cart.addItem('#{profile.identifier}', #{item.id}, this); return false"
  16 + )
  17 + }
  18 + end
  19 +
  20 + alias :product_info_extras :add_to_cart_button
  21 + alias :catalog_item_extras :add_to_cart_button
  22 +
  23 + def stylesheet?
  24 + true
  25 + end
  26 +
  27 + def js_files
  28 + ['cart.js']
  29 + end
  30 +
  31 + def body_beginning
  32 + expanded_template('cart.html.erb',{:cart => context.session[:cart]})
  33 + end
  34 +
  35 +end
... ...