Skip to content
Browse files

Merge branch 'master' of git@github.com:railsdog/spree

  • Loading branch information...
2 parents 3ac657e + 02d6c98 commit d6c2ec5c7512daf18e8d366fe9386b02d17a0b67 @schof schof committed Jul 5, 2009
View
2 app/controllers/products_controller.rb
@@ -1,5 +1,5 @@
class ProductsController < Spree::BaseController
- before_filter :setup_admin_user
+ before_filter(:setup_admin_user) unless RAILS_ENV == "test"
resource_controller
helper :taxons
View
4 app/models/creditcard.rb
@@ -101,7 +101,7 @@ def prepare #:nodoc:
self.number = number.to_s.gsub(/[^\d]/, "")
self.display_number = ActiveMerchant::Billing::CreditCard.mask(number)
self.cc_type.downcase! if cc_type.respond_to?(:downcase)
- self.cc_type = self.class.type?(number) if cc_type.blank?
+ self.cc_type = spree_cc_type if cc_type.blank?
self.first_name = address.firstname if address
self.last_name = address.lastname if address
end
@@ -127,7 +127,7 @@ def validate_essential_attributes #:nodoc:
end
def validate_switch_or_solo_attributes #:nodoc:
- if %w[switch solo].include?(type)
+ if %w[switch solo].include?(cc_type)
unless valid_month?(@start_month) && valid_start_year?(@start_year) || valid_issue_number?(@issue_number)
errors.add :start_month, "is invalid" unless valid_month?(@start_month)
errors.add :start_year, "is invalid" unless valid_start_year?(@start_year)
View
16 app/models/image.rb
@@ -4,4 +4,18 @@ class Image < Asset
:default_style => :product,
:url => "/assets/products/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/products/:id/:style/:basename.:extension"
-end
+
+ before_save :find_dimensions
+
+ # save the w,h of the original image
+ # assumes ImageMagick toolset installed
+ def find_dimensions
+ original_file = File.join('.', 'public', attachment.url(:original).gsub(/\?\d+$/, ''))
+ `identify #{original_file}` =~ /.*?(\d+)x(\d+).*/
+
+ unless $1.blank? || $2.blank?
+ self.attachment_width = $1
+ self.attachment_height = $2
+ end
+ end
+end
View
2 app/views/checkouts/_shipping_method.html.erb
@@ -7,7 +7,7 @@
<% if Spree::Config[:shipping_instructions] %>
<p id="minstrs">
<label for=""><%= t("shipping_instructions") %></label>
- <%= order_form.text_area :special_instructions, :cols => 40, :rows => 7 -%>
+ <%= checkout_form.text_area :special_instructions, :cols => 40, :rows => 7 -%>
</p>
<% end %>
View
10 config/locales/en-GB.yml
@@ -444,7 +444,7 @@ en-GB:
secure_connection_type: Secure Connection Type
select: Select
select_from_prototype: "Select From Prototype"
- select_preferred_shipping_option: "Select preferred shipping option"
+ select_preferred_shipping_option: "Select preferred delivery option"
send_copy_of_all_mails_to: Send Copy of All Mails To
send_copy_of_orders_mails_to: Send Copy of Order Mails To
send_mails_as: Send Mails As
@@ -464,7 +464,7 @@ en-GB:
shipping_error: "Delivery Error"
shipping_instructions: "Delivery Instructions"
shipping_method: "Delivery Method"
- shipping_methods: "Shipping Methods"
+ shipping_methods: "Delivery Methods"
shipping_methods_description: "Manage shipping methods"
shipping_total: "Delivery Total"
shop_by_taxonomy: "Shop by {{taxonomy}}"
@@ -536,7 +536,7 @@ en-GB:
tree: Tree
try_again: "Try Again"
type: Type
- unable_ship_method: "Unable to generate shipping methods due to a server error."
+ unable_ship_method: "Unable to generate delivery methods due to a server error."
unable_to_authorize_credit_card: "Unable to Authorize Credit Card"
unable_to_capture_credit_card: "Unable to Capture Credit Card"
unable_to_save_order: "Unable to Save Order"
@@ -545,9 +545,9 @@ en-GB:
update_password: "Update my password and log me in"
updated_successfully:
updating: Updating
- use_as_shipping_address: Use as Shipping Address
+ use_as_shipping_address: Use as Delivery Address
use_billing_address: Use Billing Address
- use_different_shipping_address: "Use Different Shipping Address"
+ use_different_shipping_address: "Use Different Delivery Address"
user: User
user_account: User Account
user_details: "User Details"
View
12 db/migrate/20090705101511_add_image_dimensions.rb
@@ -0,0 +1,12 @@
+class AddImageDimensions < ActiveRecord::Migration
+ def self.up
+ add_column :assets, :attachment_width, :integer
+ add_column :assets, :attachment_height, :integer
+ end
+
+
+ def self.down
+ remove_column :assets, :attachment_width
+ remove_column :assets, :attachment_height
+ end
+end
View
5 vendor/extensions/payment_gateway/lib/spree/payment_gateway.rb
@@ -90,6 +90,11 @@ def minimal_gateway_options
:subtotal => checkout.order.item_total * 100}
end
+ def spree_cc_type
+ return "visa" if ENV['RAILS_ENV'] == "development" and Spree::Gateway::Config[:use_bogus]
+ self.class.type?(number)
+ end
+
# instantiates the selected gateway and configures with the options stored in the database
def payment_gateway
return Spree::BogusGateway.new if ENV['RAILS_ENV'] == "development" and Spree::Gateway::Config[:use_bogus]

0 comments on commit d6c2ec5

Please sign in to comment.
Something went wrong with that request. Please try again.