-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 1-3-stable: (28 commits) update readme cleanup gemfile added email_spec dependency bump deface building against 1-3-stable and master added version file refactored taxons : permalink generation from ancestors, using override to form taxons and bump capybara Revert "bump globalize" bump globalize fixed product#duplicate removed config default locale force data-ajax-root-path to '/' bump spree_core spree 1-3-stable support fix : readme to use globalize3 repo Deleting language dropdown in option type index Deleting migrate_data_for_taxons migration because it breaks the translation Add ability to translate product properties Update spree version to 1.2.x Add ability to clone products with the translations ...
- Loading branch information
Showing
33 changed files
with
393 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,5 @@ script: | |
|
||
branches: | ||
only: | ||
- 1-0-stable | ||
- 1-1-stable | ||
- master | ||
- 1-3-stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ source 'http://rubygems.org' | |
|
||
group :test do | ||
gem 'ffaker' | ||
gem 'debugger' | ||
end | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Spree | ||
OptionValue.class_eval do | ||
translates :presentation | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
module Spree | ||
Spree::Order.class_eval do | ||
# Finalizes an in progress order after checkout is complete. | ||
# Called after transition to complete state when payments will have been processed | ||
def finalize! | ||
update_attribute(:completed_at, Time.now) | ||
update_attribute(:locale, I18n.locale) | ||
InventoryUnit.assign_opening_inventory(self) | ||
# lock any optional adjustments (coupon promotions, etc.) | ||
adjustments.optional.each { |adjustment| adjustment.update_attribute('locked', true) } | ||
deliver_order_confirmation_email | ||
|
||
self.state_changes.create({ | ||
:previous_state => 'cart', | ||
:next_state => 'complete', | ||
:name => 'order' , | ||
:user_id => (User.respond_to?(:current) && User.current.try(:id)) || self.user_id | ||
}, :without_protection => true) | ||
# override this to also set current user locale for email i18n | ||
def deliver_order_confirmation_email | ||
update_attribute(:locale, I18n.locale) | ||
begin | ||
OrderMailer.confirm_email(self).deliver | ||
rescue Exception => e | ||
logger.error("#{e.class.name}: #{e.message}") | ||
logger.error(e.backtrace * "\n") | ||
end | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,50 @@ | ||
Spree::Product.class_eval do | ||
translates :name, :description, :meta_description, :meta_keywords, :permalink | ||
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 | ||
|
||
(SpreeMultiLingual.languages).each do |locale| | ||
locale_suffix = locale.empty? ? "" : "_#{locale}" | ||
|
||
name_locale = (I18n.t :copy_of, :locale => locale) + read_attribute(:name, :locale => locale) | ||
description_locale = read_attribute(:description, :locale => locale) | ||
meta_description_locale = read_attribute(:meta_description, :locale => locale) | ||
meta_keywords_locale = read_attribute(:meta_keywords, :locale => locale) | ||
permalink_locale = (I18n.t :copy_of_permalink, :locale => locale) + read_attribute(:permalink, :locale => locale) | ||
|
||
eval("p.name"+locale_suffix+" = name_locale") | ||
eval("p.description"+locale_suffix+" = description_locale") | ||
eval("p.meta_description"+locale_suffix+" = meta_description_locale") | ||
eval("p.meta_keywords"+locale_suffix+" = meta_keywords_locale") | ||
eval("p.permalink"+locale_suffix+" = permalink_locale") | ||
end | ||
|
||
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 } | ||
variant.price = master.price | ||
variant.currency = master.currency | ||
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 | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Spree::ProductProperty.class_eval do | ||
translates :value | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
Spree::Variant.class_eval do | ||
alias_method :old_price=, :price= | ||
# Spree::Variant.class_eval do | ||
# alias_method :old_price=, :price= | ||
|
||
def price=(value) | ||
write_attribute(:price, value.to_s.tr(',', '.').to_f) | ||
end | ||
# def price=(value) | ||
# write_attribute(:price, value.to_s.tr(',', '.').to_f) | ||
# end | ||
|
||
[:cost_price, :weight, :height, :width, :depth].each do |attribute| | ||
define_method("#{attribute}=") do |value| | ||
write_attribute(attribute, value.to_s.tr(',', '.').to_f) | ||
end | ||
end | ||
end | ||
# [:cost_price, :weight, :height, :width, :depth].each do |attribute| | ||
# define_method("#{attribute}=") do |value| | ||
# write_attribute(attribute, value.to_s.tr(',', '.').to_f) | ||
# end | ||
# end | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,6 @@ | ||
Deface::Override.new( | ||
:virtual_path => "spree/admin/option_types/index", | ||
:insert_before => "div#new_option_type", | ||
:text => '<%= render "spree/admin/shared/language_dropdown", :object => Spree::OptionType.new -%>', | ||
:name => "option_type_add_language_dropdown" | ||
) | ||
|
||
Deface::Override.new( | ||
:virtual_path => "spree/admin/option_types/edit", | ||
:insert_before => "fieldset", | ||
:text => '<%= render "spree/admin/shared/language_dropdown", :object => @option_type -%>', | ||
:name => "option_type_add_language_dropdown" | ||
) | ||
) |
6 changes: 6 additions & 0 deletions
6
app/overrides/spree/admin/taxons/_form/replace_permalink_part_by_permalink.html.erb.deface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<!-- replace "code[erb-loud]:contains('f.field_container :permalink_part do')" closing_selector 'code[erb-silent]:contains("end")' enabled --> | ||
|
||
<%= f.field_container :permalink do %> | ||
<%= f.label :permalink, t(:permalink) %><span class="required">*</span><br /> | ||
<%= @taxon.permalink.split("/")[0...-1].join("/") + "/" %><%= text_field_tag "taxon[permalink]", @permalink_part %> | ||
<% end %> |
2 changes: 2 additions & 0 deletions
2
app/overrides/spree/layouts/admin/layout_ajax_root_path.deface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set_attributes "body.admin" | ||
attributes :'data-ajax-root-path' => '/' #spree.root_path(:locale => false) |
15 changes: 15 additions & 0 deletions
15
app/views/spree/admin/product_properties/_product_property_fields.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<tr class="product_property fields" data-hook="product_property"> | ||
<td class='property_name'> | ||
<%= f.text_field :property_name, :class => 'autocomplete' %> | ||
</td> | ||
<%- SpreeMultiLingual.languages.each do |locale| %> | ||
<td class='value'> | ||
<% fieldsym = "value_#{locale}".to_sym %> | ||
<%= f.text_field fieldsym, :class => 'autocomplete' %> | ||
</td> | ||
<% end %> | ||
|
||
<td class="actions"> | ||
<%= link_to_remove_fields t(:remove), f %> | ||
</td> | ||
</tr> |
Oops, something went wrong.