Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updating spree

  • Loading branch information...
commit eecf5a0b4428f3e5829219cf2dd9b1bc4b366eab 1 parent 8f36b69
@levid authored
View
10 Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'
-gem 'rails', '3.1.4'
+gem 'rails', '3.2.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
@@ -15,7 +15,7 @@ group :development, :test do
gem 'pry'
end
-gem 'jquery-rails'
+gem 'jquery-rails', '~> 2.0.0'
gem 'rack'
gem 'haml'
@@ -52,6 +52,8 @@ gem 'cancan'
# thin server
gem 'thin'
+gem 'authorize-net'
+
# Shopping cart
# gem 'acts_as_shopping_cart', :git => "git@github.com:crowdint/acts_as_shopping_cart.git"
@@ -81,7 +83,7 @@ end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
- gem 'sass-rails', '3.1.4'
+ gem 'sass-rails'
gem 'coffee-rails'
gem 'uglifier'
gem 'yui-compressor'
@@ -91,6 +93,6 @@ group :assets do
end
-gem 'spree'
+gem 'spree', :git => 'git://github.com/spree/spree.git'
gem 'spree_usa_epay'
gem 'spree_skrill'
View
236 Gemfile.lock
@@ -1,3 +1,49 @@
+GIT
+ remote: git://github.com/spree/spree.git
+ revision: 64461d88d6a5bcfce6ebeb11de47091ad6280be5
+ specs:
+ spree (1.1.0.beta)
+ spree_api (= 1.1.0.beta)
+ spree_auth (= 1.1.0.beta)
+ spree_cmd (= 1.1.0.beta)
+ spree_core (= 1.1.0.beta)
+ spree_dash (= 1.1.0.beta)
+ spree_promo (= 1.1.0.beta)
+ spree_sample (= 1.1.0.beta)
+ spree_api (1.1.0.beta)
+ rabl (= 0.6.5)
+ spree_auth (= 1.1.0.beta)
+ spree_core (= 1.1.0.beta)
+ spree_auth (1.1.0.beta)
+ cancan (= 1.6.7)
+ devise (~> 2.0)
+ spree_core (= 1.1.0.beta)
+ spree_cmd (1.1.0.beta)
+ spree_core (1.1.0.beta)
+ activemerchant (= 1.20.4)
+ acts_as_list (= 0.1.4)
+ aws-sdk (~> 1.3.4)
+ deface (>= 0.8.0)
+ ffaker (~> 1.12.0)
+ highline (= 1.6.11)
+ jquery-rails (~> 2.0.0)
+ kaminari (>= 0.13.0)
+ nested_set (= 1.7.0)
+ paperclip (~> 2.7)
+ rails (>= 3.2.2, <= 3.2.3)
+ ransack (~> 0.6.0)
+ state_machine (= 1.1.2)
+ stringex (~> 1.3.2)
+ spree_dash (1.1.0.beta)
+ httparty (~> 0.8.1)
+ spree_auth (= 1.1.0.beta)
+ spree_core (= 1.1.0.beta)
+ spree_promo (1.1.0.beta)
+ spree_auth (= 1.1.0.beta)
+ spree_core (= 1.1.0.beta)
+ spree_sample (1.1.0.beta)
+ spree_core (= 1.1.0.beta)
+
GEM
remote: https://rubygems.org/
specs:
@@ -5,50 +51,56 @@ GEM
Platform (>= 0.4.0)
open4
Platform (0.4.0)
- actionmailer (3.1.4)
- actionpack (= 3.1.4)
- mail (~> 2.3.0)
- actionpack (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
+ actionmailer (3.2.3)
+ actionpack (= 3.2.3)
+ mail (~> 2.4.4)
+ actionpack (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6)
- rack (~> 1.3.6)
- rack-cache (~> 1.1)
- rack-mount (~> 0.8.2)
+ journey (~> 1.0.1)
+ rack (~> 1.4.0)
+ rack-cache (~> 1.2)
rack-test (~> 0.6.1)
- sprockets (~> 2.0.3)
+ sprockets (~> 2.1.2)
active_utils (1.0.3)
activesupport (>= 2.3.11)
i18n
- activemerchant (1.20.1)
- active_utils (>= 1.0.1)
+ activemerchant (1.20.4)
+ active_utils (>= 1.0.2)
activesupport (>= 2.3.11)
braintree (>= 2.0.0)
builder (>= 2.0.0)
i18n
json (>= 1.5.1)
money (<= 3.7.1)
- activemodel (3.1.4)
- activesupport (= 3.1.4)
+ activemodel (3.2.3)
+ activesupport (= 3.2.3)
builder (~> 3.0.0)
- i18n (~> 0.6)
- activerecord (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
- arel (~> 2.2.3)
+ activerecord (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ arel (~> 3.0.2)
tzinfo (~> 0.3.29)
- activeresource (3.1.4)
- activemodel (= 3.1.4)
- activesupport (= 3.1.4)
- activesupport (3.1.4)
+ activeresource (3.2.3)
+ activemodel (= 3.2.3)
+ activesupport (= 3.2.3)
+ activesupport (3.2.3)
+ i18n (~> 0.6)
multi_json (~> 1.0)
acts_as_list (0.1.4)
addressable (2.2.7)
akami (1.0.0)
gyoku (>= 0.4.0)
- arel (2.2.3)
+ arel (3.0.2)
+ authorize-net (1.5.2)
+ nokogiri (~> 1.4)
+ aws-sdk (1.3.9)
+ httparty (~> 0.7)
+ json (~> 1.4)
+ nokogiri (>= 1.4.4)
+ uuidtools (~> 2.1)
bcrypt-ruby (3.0.1)
braintree (2.16.0)
builder (>= 2.0.0)
@@ -62,16 +114,17 @@ GEM
rack-test (>= 0.5.4)
selenium-webdriver (~> 2.0)
xpath (~> 0.1.4)
- carrierwave (0.5.8)
- activesupport (~> 3.0)
+ carrierwave (0.6.2)
+ activemodel (>= 3.2.0)
+ activesupport (>= 3.2.0)
childprocess (0.3.2)
ffi (~> 1.0.6)
chunky_png (1.2.5)
cocaine (0.2.1)
coderay (1.0.6)
- coffee-rails (3.1.1)
+ coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
- railties (~> 3.1.0)
+ railties (~> 3.2.0)
coffee-script (2.2.0)
coffee-script-source
execjs
@@ -84,10 +137,11 @@ GEM
deface (0.8.0)
nokogiri (~> 1.5.0)
rails (>= 3.0.9)
- devise (1.4.8)
+ devise (2.0.4)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.0.3)
- warden (~> 1.0.3)
+ railties (~> 3.1)
+ warden (~> 1.1.1)
draper (0.11.1)
activesupport (>= 2.3.10)
erubis (2.7.0)
@@ -120,13 +174,17 @@ GEM
gyoku (0.4.4)
builder (>= 2.1.2)
haml (3.1.4)
- highline (1.6.8)
+ highline (1.6.11)
hike (1.2.1)
+ httparty (0.8.3)
+ multi_json (~> 1.0)
+ multi_xml
httpi (0.9.6)
rack
i18n (0.6.0)
- jquery-rails (1.0.19)
- railties (~> 3.0)
+ journey (1.0.3)
+ jquery-rails (2.0.2)
+ railties (>= 3.2.0, < 5.0)
thor (~> 0.14)
json (1.6.6)
kaminari (0.13.0)
@@ -135,21 +193,16 @@ GEM
railties (>= 3.0.0)
libwebsocket (0.1.3)
addressable
- mail (2.3.3)
+ mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
- meta_search (1.1.1)
- actionpack (~> 3.1.0)
- activerecord (~> 3.1.0)
- activesupport (~> 3.1.0)
- polyamorous (~> 0.5.0)
metaclass (0.0.1)
method_source (0.7.1)
mime-types (1.18)
mini_magick (3.4)
subexec (~> 0.2.1)
- mocha (0.11.1)
+ mocha (0.11.2)
metaclass (~> 0.0.1)
money (3.7.1)
i18n (~> 0.4)
@@ -157,8 +210,9 @@ GEM
daemons (~> 1.0.10)
gem_plugin (~> 0.2.3)
multi_json (1.3.2)
+ multi_xml (0.4.4)
mysql2 (0.3.11)
- nested_set (1.6.8)
+ nested_set (1.7.0)
activerecord (>= 3.0.0)
railties (>= 3.0.0)
net-scp (1.0.4)
@@ -168,7 +222,7 @@ GEM
nori (1.1.0)
open4 (1.3.0)
orm_adapter (0.0.7)
- paperclip (2.5.0)
+ paperclip (2.7.0)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
cocaine (>= 0.0.2)
@@ -181,43 +235,46 @@ GEM
coderay (~> 1.0.5)
method_source (~> 0.7.1)
slop (>= 2.4.4, < 3)
- rack (1.3.6)
+ rabl (0.6.5)
+ activesupport (>= 2.3.14)
+ multi_json (~> 1.0)
+ rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
- rack-mount (0.8.3)
- rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
- rails (3.1.4)
- actionmailer (= 3.1.4)
- actionpack (= 3.1.4)
- activerecord (= 3.1.4)
- activeresource (= 3.1.4)
- activesupport (= 3.1.4)
+ rails (3.2.3)
+ actionmailer (= 3.2.3)
+ actionpack (= 3.2.3)
+ activerecord (= 3.2.3)
+ activeresource (= 3.2.3)
+ activesupport (= 3.2.3)
bundler (~> 1.0)
- railties (= 3.1.4)
- railties (3.1.4)
- actionpack (= 3.1.4)
- activesupport (= 3.1.4)
+ railties (= 3.2.3)
+ railties (3.2.3)
+ actionpack (= 3.2.3)
+ activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (~> 0.14.6)
rake (0.9.2.2)
+ ransack (0.6.0)
+ actionpack (~> 3.0)
+ activerecord (~> 3.0)
+ polyamorous (~> 0.5.0)
rdoc (3.12)
json (~> 1.4)
rolify (3.1.0)
ruby-hmac (0.4.0)
rubyzip (0.9.7)
sass (3.1.16)
- sass-rails (3.1.4)
- actionpack (~> 3.1.0)
- railties (~> 3.1.0)
- sass (>= 3.1.4)
- sprockets (~> 2.0.0)
- tilt (~> 1.3.2)
+ sass-rails (3.2.5)
+ railties (~> 3.2.0)
+ sass (>= 3.1.10)
+ tilt (~> 1.3)
savon (0.9.9)
akami (~> 1.0)
builder (>= 2.1.2)
@@ -240,54 +297,17 @@ GEM
spork (0.9.0)
spork-testunit (0.0.6)
spork (>= 0.6.0)
- spree (1.0.3)
- spree_api (= 1.0.3)
- spree_auth (= 1.0.3)
- spree_cmd (= 1.0.3)
- spree_core (= 1.0.3)
- spree_dash (= 1.0.3)
- spree_promo (= 1.0.3)
- spree_sample (= 1.0.3)
- spree_api (1.0.3)
- spree_auth (= 1.0.3)
- spree_core (= 1.0.3)
- spree_auth (1.0.3)
- cancan (= 1.6.7)
- devise (= 1.4.8)
- spree_core (= 1.0.3)
- spree_cmd (1.0.3)
- spree_core (1.0.3)
- activemerchant (= 1.20.1)
- acts_as_list (= 0.1.4)
- deface (>= 0.7.2)
- ffaker (~> 1.12.0)
- highline (= 1.6.8)
- jquery-rails (>= 1.0.18, <= 1.0.19)
- kaminari (>= 0.13.0)
- meta_search (= 1.1.1)
- nested_set (= 1.6.8)
- paperclip (= 2.5.0)
- rails (>= 3.1.1, <= 3.1.4)
- state_machine (= 1.1.1)
- stringex (~> 1.3.0)
- spree_dash (1.0.3)
- spree_core (= 1.0.3)
- spree_promo (1.0.3)
- spree_auth (= 1.0.3)
- spree_core (= 1.0.3)
- spree_sample (1.0.3)
- spree_core (= 1.0.3)
spree_skrill (1.0.1)
spree_core (>= 1.0.0)
spree_usa_epay (1.0.1)
savon
spree_core (>= 1.0.0)
- sprockets (2.0.3)
+ sprockets (2.1.2)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
- state_machine (1.1.1)
- stringex (1.3.2)
+ state_machine (1.1.2)
+ stringex (1.3.3)
subexec (0.2.2)
test-unit (2.4.8)
thin (1.3.1)
@@ -303,8 +323,9 @@ GEM
uglifier (1.2.4)
execjs (>= 0.3.0)
multi_json (>= 1.0.2)
+ uuidtools (2.1.2)
vcr (2.1.0)
- warden (1.0.6)
+ warden (1.1.1)
rack (>= 1.0)
wasabi (2.1.0)
nokogiri (>= 1.4.0)
@@ -318,6 +339,7 @@ PLATFORMS
ruby
DEPENDENCIES
+ authorize-net
bson_ext (~> 1.3.1)
cancan
capybara (~> 1.1.2)
@@ -330,7 +352,7 @@ DEPENDENCIES
guard
guard-test
haml
- jquery-rails
+ jquery-rails (~> 2.0.0)
mini_magick
mocha
mongrel (= 1.2.0.pre2)
@@ -338,12 +360,12 @@ DEPENDENCIES
pg
pry
rack
- rails (= 3.1.4)
+ rails (= 3.2.3)
rolify
- sass-rails (= 3.1.4)
+ sass-rails
simplecov
spork-testunit (= 0.0.6)
- spree
+ spree!
spree_skrill
spree_usa_epay
sprockets
View
1  app/assets/javascripts/admin/all.js
@@ -7,7 +7,6 @@
//= require admin/spree_core
//= require admin/spree_auth
-//= require admin/spree_api
//= require admin/spree_promo
//= require_tree .
View
1  app/assets/javascripts/store/all.js
@@ -7,7 +7,6 @@
//= require store/spree_core
//= require store/spree_auth
-//= require store/spree_api
//= require store/spree_promo
//= require_tree .
View
1  app/assets/stylesheets/admin/all.css
@@ -6,7 +6,6 @@
*= require admin/spree_core
*= require admin/spree_auth
- *= require admin/spree_api
*= require admin/spree_promo
*= require_self
View
1  app/assets/stylesheets/store/all.css
@@ -6,7 +6,6 @@
*= require store/spree_core
*= require store/spree_auth
- *= require store/spree_api
*= require store/spree_promo
*= require_self
View
250 app/models/spree/product.rb
@@ -1,250 +0,0 @@
-# PRODUCTS
-# Products represent an entity for sale in a store.
-# Products can have variations, called variants
-# Products properties include description, permalink, availability,
-# shipping category, etc. that do not change by variant.
-#
-# MASTER VARIANT
-# Every product has one master variant, which stores master price and sku, size and weight, etc.
-# The master variant does not have option values associated with it.
-# Price, SKU, size, weight, etc. are all delegated to the master variant.
-# Contains on_hand inventory levels only when there are no variants for the product.
-#
-# VARIANTS
-# All variants can access the product properties directly (via reverse delegation).
-# Inventory units are tied to Variant.
-# The master variant can have inventory units, but not option values.
-# All other variants have option values and may have inventory units.
-# Sum of on_hand each variant's inventory level determine "on_hand" level for the product.
-#
-module Spree
- class Product < ActiveRecord::Base
- has_many :product_option_types, :dependent => :destroy
- has_many :option_types, :through => :product_option_types
- has_many :product_properties, :dependent => :destroy
- has_many :properties, :through => :product_properties
- belongs_to :tax_category
- has_and_belongs_to_many :taxons, :join_table => 'spree_products_taxons'
- belongs_to :shipping_category
-
- has_one :master,
- :class_name => 'Spree::Variant',
- :conditions => ["#{Variant.quoted_table_name}.is_master = ? AND #{Variant.quoted_table_name}.deleted_at IS NULL", true]
-
- delegate_belongs_to :master, :sku, :price, :weight, :height, :width, :depth, :is_master
- delegate_belongs_to :master, :cost_price if Variant.table_exists? && Variant.column_names.include?('cost_price')
-
- after_create :set_master_variant_defaults
- after_create :add_properties_and_option_types_from_prototype
- after_create :build_variants_from_option_values_hash, :if => :option_values_hash
- before_save :recalculate_count_on_hand
- after_save :save_master
- after_save :set_master_on_hand_to_zero_when_product_has_variants
-
- has_many :variants,
- :class_name => 'Spree::Variant',
- :conditions => ["#{::Spree::Variant.quoted_table_name}.is_master = ? AND #{::Spree::Variant.quoted_table_name}.deleted_at IS NULL", false],
- :order => "#{::Spree::Variant.quoted_table_name}.position ASC"
-
- has_many :variants_including_master,
- :class_name => 'Spree::Variant',
- :conditions => ["#{::Spree::Variant.quoted_table_name}.deleted_at IS NULL"],
- :dependent => :destroy
-
- has_many :variants_with_only_master,
- :class_name => 'Spree::Variant',
- :conditions => ["#{::Spree::Variant.quoted_table_name}.deleted_at IS NULL AND #{::Spree::Variant.quoted_table_name}.is_master = ?", true],
- :dependent => :destroy
-
- accepts_nested_attributes_for :variants, :allow_destroy => true
-
- def variant_images
- Image.find_by_sql("SELECT #{Asset.quoted_table_name}.* FROM #{Asset.quoted_table_name} LEFT JOIN #{Variant.quoted_table_name} ON (#{Variant.quoted_table_name}.id = #{Asset.quoted_table_name}.viewable_id) WHERE (#{Variant.quoted_table_name}.product_id = #{self.id})")
- end
-
- alias_method :images, :variant_images
-
- validates :name, :price, :presence => true
-
- attr_accessor :option_values_hash
-
- attr_accessible :name, :description, :available_on, :permalink, :meta_description,
- :meta_keywords, :price, :sku, :deleted_at, :prototype_id,
- :option_values_hash, :on_hand, :weight, :height, :width, :depth,
- :shipping_category_id, :tax_category_id, :product_properties_attributes
-
- attr_accessible :cost_price if Variant.table_exists? && Variant.column_names.include?('cost_price')
-
-
- accepts_nested_attributes_for :product_properties, :allow_destroy => true, :reject_if => lambda { |pp| pp[:property_name].blank? }
-
- make_permalink :order => :name
-
- alias :options :product_option_types
-
- after_initialize :ensure_master
-
- def ensure_master
- return unless new_record?
- self.master ||= Variant.new
- end
-
- def to_param
- permalink.present? ? permalink : (permalink_was || name.to_s.to_url)
- end
-
- # returns true if the product has any variants (the master variant is not a member of the variants array)
- def has_variants?
- variants.exists?
- end
-
- # returns the number of inventory units "on_hand" for this product
- def on_hand
- has_variants? ? variants.inject(0) { |sum, v| sum + v.on_hand } : master.on_hand
- end
-
- # adjusts the "on_hand" inventory level for the product up or down to match the given new_level
- def on_hand=(new_level)
- raise 'cannot set on_hand of product with variants' if has_variants? && Spree::Config[:track_inventory_levels]
- master.on_hand = new_level
- end
-
- # Returns true if there are inventory units (any variant) with "on_hand" state for this product
- # Variants take precedence over master
- def has_stock?
- has_variants? ? variants.any?(&:in_stock?) : master.in_stock?
- end
-
- def tax_category
- if self[:tax_category_id].nil?
- TaxCategory.where(:is_default => true).first
- else
- TaxCategory.find(self[:tax_category_id])
- end
- end
-
- # Adding properties and option types on creation based on a chosen prototype
- attr_reader :prototype_id
- def prototype_id=(value)
- @prototype_id = value.to_i
- end
-
- # Ensures option_types and product_option_types exist for keys in option_values_hash
- def ensure_option_types_exist_for_values_hash
- return if option_values_hash.nil?
- option_values_hash.keys.map(&:to_i).each do |id|
- self.option_type_ids << id unless option_type_ids.include?(id)
- product_option_types.create({:option_type_id => id}, :without_protection => true) unless product_option_types.map(&:option_type_id).include?(id)
- end
- end
-
- # for adding products which are closely related to existing ones
- # define "duplicate_extra" for site-specific actions, eg for additional fields
- def duplicate
- p = self.dup
- p.name = 'COPY OF ' + name
- p.deleted_at = nil
- p.created_at = p.updated_at = nil
- p.taxons = taxons
-
- p.product_properties = product_properties.map { |q| r = q.dup; r.created_at = r.updated_at = nil; r }
-
- image_dup = lambda { |i| j = i.dup; j.attachment = i.attachment.clone; j }
-
- variant = master.dup
- variant.sku = 'COPY OF ' + master.sku
- variant.deleted_at = nil
- variant.images = master.images.map { |i| image_dup.call i }
- p.master = variant
-
- # don't dup the actual variants, just the characterising types
- p.option_types = option_types if has_variants?
-
- # allow site to do some customization
- p.send(:duplicate_extra, self) if p.respond_to?(:duplicate_extra)
- p.save!
- p
- end
-
- # use deleted? rather than checking the attribute directly. this
- # allows extensions to override deleted? if they want to provide
- # their own definition.
- def deleted?
- !!deleted_at
- end
-
- # split variants list into hash which shows mapping of opt value onto matching variants
- # eg categorise_variants_from_option(color) => {"red" -> [...], "blue" -> [...]}
- def categorise_variants_from_option(opt_type)
- return {} unless option_types.include?(opt_type)
- variants.active.group_by { |v| v.option_values.detect { |o| o.option_type == opt_type} }
- end
-
- def effective_tax_rate
- if tax_category
- tax_category.effective_amount
- else
- TaxRate.default
- end
- end
-
- def self.like_any(fields, values)
- where_str = fields.map { |field| Array.new(values.size, "#{self.quoted_table_name}.#{field} #{LIKE} ?").join(' OR ') }.join(' OR ')
- self.where([where_str, values.map { |value| "%#{value}%" } * fields.size].flatten)
- end
-
- def empty_option_values?
- options.empty? || options.any? do |opt|
- opt.option_type.option_values.empty?
- end
- end
-
- private
-
- # Builds variants from a hash of option types & values
- def build_variants_from_option_values_hash
- ensure_option_types_exist_for_values_hash
- values = option_values_hash.values
- values = values.inject(values.shift) { |memo, value| memo.product(value).map(&:flatten) }
-
- values.each do |ids|
- variant = variants.create({ :option_value_ids => ids, :price => master.price }, :without_protection => true)
- end
- save
- end
-
- def add_properties_and_option_types_from_prototype
- if prototype_id && prototype = Spree::Prototype.find_by_id(prototype_id)
- prototype.properties.each do |property|
- product_properties.create({:property => property}, :without_protection => true)
- end
- self.option_types = prototype.option_types
- end
- end
-
- def recalculate_count_on_hand
- product_count_on_hand = has_variants? ?
- variants.sum(:count_on_hand) : (master ? master.count_on_hand : 0)
- self.count_on_hand = product_count_on_hand
- end
-
- # the master on_hand is meaningless once a product has variants as the inventory
- # units are now "contained" within the product variants
- def set_master_on_hand_to_zero_when_product_has_variants
- master.on_hand = 0 if has_variants? && Spree::Config[:track_inventory_levels]
- end
-
- # ensures the master variant is flagged as such
- def set_master_variant_defaults
- master.is_master = true
- end
-
- # there's a weird quirk with the delegate stuff that does not automatically save the delegate object
- # when saving so we force a save using a hook.
- def save_master
- master.save if master && (master.changed? || master.new_record?)
- end
- end
-end
-
-require_dependency 'spree/product/scopes'
View
26 app/views/spree/admin/shared/_head.html.erb
@@ -1,26 +0,0 @@
-<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
-<%= csrf_meta_tags %>
-<title><%= "Spree #{t('administration')}: " %>
-<%= t(controller.controller_name, :default => controller.controller_name.titleize) %></title>
-
-<%= javascript_tag do %>
- ajax_urls = <%== {
- :product_search_json => spree.admin_products_url(:format => 'json'),
- :product_search_basic_json => spree.admin_products_url(:format => 'json', :json_format => 'basic', :limit => 10),
- :user_search_basic_json => spree.admin_users_url(:format => 'json', :json_format => 'basic', :limit => 10)
- }.to_json %>;
-
- strings = <%==
- [:no_results, :type_to_search, :searching].
- inject({}){|memo, item| {item => t(item) }}.to_json
- %>
-<% end %>
-
-<%= stylesheet_link_tag 'admin/all' %>
-<%= javascript_include_tag 'admin/all' %>
-<%= javascript_tag do -%>
- jQuery.alerts.dialogClass = 'spree';
- <%== "var AUTH_TOKEN = #{form_authenticity_token.inspect};" if protect_against_forgery? %>
-<% end -%>
-
-<%= yield :head %>
View
20 vendor/plugins/habtm_checkboxes/MIT-LICENSE
@@ -1,20 +0,0 @@
-Copyright (c) 2010 [name of plugin creator]
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
22 vendor/plugins/habtm_checkboxes/README
@@ -1,22 +0,0 @@
-HabtmCheckboxes
-===============
-
-ActionView helper to render checkboxes with labels for a HABTM assignment in a form.
-
- * Labels have the for attribute set correctly
- * Hidden field included so that you can actually delete all of the associations in an update without adjusting your controller
-
-
-Example
-=======
-
- habtm_checkboxes(@organizer, :event_ids, @events, :name)
-
- <%= hidden_field_tag "organizer[event_ids][]", "" %>
- <% @events.each do |event| -%>
- <%= check_box_tag "organizer[event_ids][]", event.id, @organizer.event_ids.include?(event.id), :id => "organizer_events_id_#{event.id}" %>
- <%= label_tag "organizer_events_id_#{event.id}", h(event.name) %>
- <% end -%>
-
-
-Copyright (c) 2010 [John Trupiano], released under the MIT license
View
22 vendor/plugins/habtm_checkboxes/Rakefile
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the habtm_checkboxes plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the habtm_checkboxes plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'HabtmCheckboxes'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
View
1  vendor/plugins/habtm_checkboxes/init.rb
@@ -1 +0,0 @@
-ActionView::Base.send :include, HabtmCheckboxes
View
1  vendor/plugins/habtm_checkboxes/install.rb
@@ -1 +0,0 @@
-# Install hook code here
View
28 vendor/plugins/habtm_checkboxes/lib/habtm_checkboxes.rb
@@ -1,28 +0,0 @@
-# HabtmCheckboxes
-module HabtmCheckboxes
-
- # Generates a set of checkboxes for a HABTM assignment in a form. Labels are properly assigned
- # to the checkboxes and markup is valid HTML.
- #
- # habtm_checkboxes(@organizer, :event_ids, @events, :name)
- #
- # <%= hidden_field_tag "organizer[event_ids][]", "" %>
- # <% @events.each do |event| -%>
- # <%= check_box_tag "organizer[event_ids][]", event.id, @organizer.event_ids.include?(event.id), :id => "organizer_events_id_#{event.id}" %>
- # <%= label_tag "organizer_events_id_#{event.id}", h(event.name) %>
- # <% end -%>
- def habtm_checkboxes(obj, column, assignment_objects, assignment_object_display_column)
- obj_to_s = obj.class.to_s.split("::").last.underscore
- field_name = "#{obj_to_s}[#{column}][]"
-
- html = hidden_field_tag(field_name, "")
- assignment_objects.each do |assignment_obj|
- cbx_id = "#{obj_to_s}_#{column}_#{assignment_obj.id}"
- html += check_box_tag field_name, assignment_obj.id, obj.send(column).include?(assignment_obj.id), :id => cbx_id
- html += label_tag cbx_id, h(assignment_obj.send(assignment_object_display_column))
- html += content_tag(:br)
- end
- html
- end
-end
-
View
42 vendor/plugins/habtm_checkboxes/test/habtm_checkboxes_test.rb
@@ -1,42 +0,0 @@
-require 'test_helper'
-require 'action_controller'
-require 'action_view/helpers'
-require 'habtm_checkboxes'
-
-# Mock objects
-module HabtmCheckboxes
- class Organizer
- def event_ids
- [1]
- end
- end
-
- class Event
- attr_reader :id, :name
- def initialize(id, name)
- @id, @name = id, name
- end
- end
-end
-
-class HabtmCheckboxesTest < ActionController::TestCase
- include ActionView::Helpers
- include HabtmCheckboxes
-
- test "With 2 events and an organizer, all 5 elements are correctly generated and wired up" do
- organizer = Organizer.new
- events = [Event.new(1, "One"), Event.new(2, "Two")]
- html = habtm_checkboxes(organizer, :event_ids, events, :name)
-
- doc = HTML::Document.new html
- assert_select doc.root, 'input', :type => 'hidden', :name => 'organizer[event_ids][]'
- assert_select doc.root, 'input#organizer_event_ids_1', :type => 'checkbox'
- assert_select doc.root, 'label[for=organizer_event_ids_1]'
- assert_select doc.root, 'input#organizer_event_ids_2', :type => 'checkbox'
- assert_select doc.root, 'label[for=organizer_event_ids_2]'
- # Sanity check
- assert_select doc.root, 'label[for=organizer_event_ids_3]', :count => 0
- assert_select doc.root, 'input#organizer_event_ids_3', :count => 0
- end
-end
-
View
3  vendor/plugins/habtm_checkboxes/test/test_helper.rb
@@ -1,3 +0,0 @@
-require 'test/unit'
-require 'rubygems'
-require 'active_support'
View
1  vendor/plugins/habtm_checkboxes/uninstall.rb
@@ -1 +0,0 @@
-# Uninstall hook code here
Please sign in to comment.
Something went wrong with that request. Please try again.