Commit a8fbeab5f993c874ad00ed4ae5ae0c762d4cb6b8

Authored by Rodrigo Souto
1 parent 12083a2c

Profile cart control panel

* Feature:
    - Possibility to enable and disable "Add to cart" buttons
    - Also possibility to further configurations of cart on the profile.
plugins/shopping_cart/20110422151030_add_shopping_cart_to_profile.rb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +class AddShoppingCartToProfile < ActiveRecord::Migration
  2 +
  3 + def self.up
  4 + add_column :profiles, :shopping_cart, :boolean, :default => true
  5 + end
  6 +
  7 + def self.down
  8 + remove_column :profiles, :shopping_cart
  9 + end
  10 +end
plugins/shopping_cart/views/shopping_cart_plugin_myprofile/edit.html.erb
1 <h1> <%= _('Cart options') %> </h1> 1 <h1> <%= _('Cart options') %> </h1>
2 2
3 <% form_for(:profile_attr, profile, :url => {:action => 'edit'}, :html => {:method => 'post'}) do |f| %> 3 <% form_for(:profile_attr, profile, :url => {:action => 'edit'}, :html => {:method => 'post'}) do |f| %>
4 -<%# form_tag :action => 'edit' do %>  
5 <%= labelled_form_field(_('Enabled?'), f.check_box(:shopping_cart)) %> 4 <%= labelled_form_field(_('Enabled?'), f.check_box(:shopping_cart)) %>
6 <%= labelled_form_field(_('Delivery?'), f.check_box(:shopping_cart_delivery)) %> 5 <%= labelled_form_field(_('Delivery?'), f.check_box(:shopping_cart_delivery)) %>
7 <%= labelled_form_field(_('Delivery price:'), f.text_field(:shopping_cart_delivery_price)) %> 6 <%= labelled_form_field(_('Delivery price:'), f.text_field(:shopping_cart_delivery_price)) %>