spree_core 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +1 -1
- data/app/assets/javascripts/admin/admin.js.erb +1 -1
- data/app/assets/javascripts/admin/shipping_methods.js.coffee +1 -1
- data/app/assets/javascripts/admin/spree_core.js +1 -0
- data/app/assets/javascripts/admin/variant_autocomplete.js.erb +1 -1
- data/app/assets/stylesheets/admin/globals/_variables.scss +7 -7
- data/app/assets/stylesheets/admin/plugins/font-awesome.scss +2 -2
- data/app/assets/stylesheets/admin/shared/_forms.scss +19 -16
- data/app/assets/stylesheets/admin/shared/_layout.scss +1 -1
- data/app/assets/stylesheets/admin/shared/_typography.scss +10 -10
- data/app/assets/stylesheets/store/screen.css.scss +50 -50
- data/app/controllers/spree/admin/base_controller.rb +0 -1
- data/app/controllers/spree/admin/images_controller.rb +1 -1
- data/app/controllers/spree/admin/line_items_controller.rb +1 -0
- data/app/controllers/spree/admin/orders_controller.rb +5 -1
- data/app/controllers/spree/admin/payments_controller.rb +2 -1
- data/app/controllers/spree/admin/products_controller.rb +3 -1
- data/app/controllers/spree/admin/resource_controller.rb +15 -4
- data/app/controllers/spree/admin/shipments_controller.rb +6 -1
- data/app/controllers/spree/admin/taxons_controller.rb +0 -6
- data/app/controllers/spree/checkout_controller.rb +0 -4
- data/app/controllers/spree/locale_controller.rb +2 -2
- data/app/controllers/spree/orders_controller.rb +1 -1
- data/app/helpers/spree/admin/base_helper.rb +9 -1
- data/app/helpers/spree/admin/images_helper.rb +14 -0
- data/app/helpers/spree/admin/products_helper.rb +1 -1
- data/app/helpers/spree/base_helper.rb +3 -3
- data/app/models/spree/ability.rb +2 -6
- data/app/models/spree/address.rb +6 -1
- data/app/models/spree/legacy_user.rb +11 -0
- data/app/models/spree/log_entry.rb +11 -0
- data/app/models/spree/order.rb +11 -5
- data/app/models/spree/order_populator.rb +2 -2
- data/app/models/spree/order_updater.rb +11 -11
- data/app/models/spree/payment/processing.rb +2 -2
- data/app/models/spree/payment.rb +20 -1
- data/app/models/spree/payment_method.rb +10 -3
- data/app/models/spree/preference.rb +0 -29
- data/app/models/spree/preferences/store.rb +4 -10
- data/app/models/spree/product/scopes.rb +2 -2
- data/app/models/spree/product.rb +2 -5
- data/app/models/spree/product_property.rb +3 -1
- data/app/models/spree/property.rb +0 -2
- data/app/models/spree/return_authorization.rb +1 -1
- data/app/models/spree/shipment.rb +1 -1
- data/app/models/spree/variant.rb +1 -1
- data/app/views/spree/admin/general_settings/edit.html.erb +2 -2
- data/app/views/spree/admin/images/index.html.erb +6 -33
- data/app/views/spree/admin/orders/_form.html.erb +1 -1
- data/app/views/spree/admin/payment_methods/_form.html.erb +4 -0
- data/app/views/spree/admin/payment_methods/index.html.erb +3 -1
- data/app/views/spree/admin/product_properties/_product_property_fields.html.erb +5 -1
- data/app/views/spree/admin/product_properties/index.html.erb +2 -2
- data/app/views/spree/admin/products/_form.html.erb +1 -6
- data/app/views/spree/admin/products/edit.html.erb +4 -1
- data/app/views/spree/admin/prototypes/_form.html.erb +1 -1
- data/app/views/spree/admin/prototypes/select.js.erb +2 -2
- data/app/views/spree/admin/return_authorizations/index.html.erb +1 -1
- data/app/views/spree/admin/shared/_tabs.html.erb +1 -1
- data/app/views/spree/admin/shared/_translations.html.erb +1 -1
- data/app/views/spree/admin/shipments/_form.html.erb +1 -1
- data/app/views/spree/admin/shipping_methods/_form.html.erb +3 -3
- data/app/views/spree/admin/taxonomies/get_children.json.erb +1 -1
- data/app/views/spree/admin/variants/_autocomplete.js.erb +1 -1
- data/app/views/spree/shared/_order_details.html.erb +1 -1
- data/config/routes.rb +5 -1
- data/db/migrate/20121031162139_split_prices_from_variants.rb +1 -1
- data/db/migrate/20130114053446_add_display_on_to_spree_payment_methods.rb +9 -0
- data/db/migrate/20130120201805_add_position_to_product_properties.spree.rb +6 -0
- data/db/migrate/20130203232234_add_identifier_to_spree_payments.rb +5 -0
- data/lib/generators/spree/install/install_generator.rb +4 -1
- data/lib/spree/core/controller_helpers/common.rb +3 -3
- data/lib/spree/core/controller_helpers.rb +13 -0
- data/lib/spree/core/engine.rb +7 -4
- data/lib/spree/core/permalinks.rb +1 -1
- data/lib/spree/core/ssl_requirement.rb +1 -1
- data/lib/spree/core/testing_support/authorization_helpers.rb +5 -2
- data/lib/spree/core/testing_support/bar_ability.rb +17 -0
- data/lib/spree/core/testing_support/factories/product_factory.rb +4 -2
- data/lib/spree/core/testing_support/factories/variant_factory.rb +9 -3
- data/lib/spree/core/testing_support/preferences.rb +12 -6
- data/lib/spree/core/version.rb +1 -1
- data/lib/spree/core.rb +1 -1
- data/lib/spree/scopes/dynamic.rb +1 -1
- data/lib/tasks/core.rake +3 -3
- data/vendor/assets/javascripts/jquery-migrate-1.0.0.js +498 -0
- metadata +14 -7
|
@@ -90,7 +90,7 @@ module Spree
|
|
|
90
90
|
|
|
91
91
|
def line_items
|
|
92
92
|
if order.complete? and Spree::Config[:track_inventory_levels]
|
|
93
|
-
order.line_items.select { |li| inventory_units.
|
|
93
|
+
order.line_items.select { |li| inventory_units.pluck(:variant_id).include?(li.variant_id) }
|
|
94
94
|
else
|
|
95
95
|
order.line_items
|
|
96
96
|
end
|
data/app/models/spree/variant.rb
CHANGED
|
@@ -87,7 +87,7 @@ module Spree
|
|
|
87
87
|
end
|
|
88
88
|
|
|
89
89
|
def options_text
|
|
90
|
-
values = self.option_values.
|
|
90
|
+
values = self.option_values.joins(:option_type).order("#{Spree::OptionType.table_name}.position asc")
|
|
91
91
|
|
|
92
92
|
values.map! do |ov|
|
|
93
93
|
"#{ov.option_type.presentation}: #{ov.presentation}"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<%= radio_button_tag :currency_symbol_position, "before" %>
|
|
56
56
|
<%= label_tag :currency_symbol_position_before, Spree::Money.new(10, :symbol_position => "before") %>
|
|
57
57
|
</li>
|
|
58
|
-
<li>
|
|
58
|
+
<li class="white-space-nowrap">
|
|
59
59
|
<%= radio_button_tag :currency_symbol_position, "after" %>
|
|
60
60
|
<%= label_tag :currency_symbol_position_after, Spree::Money.new(10, :symbol_position => "after") %>
|
|
61
61
|
</li>
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
<div class="form-buttons filter-actions actions" data-hook="buttons">
|
|
70
70
|
<%= button t(:update), 'icon-refresh' %>
|
|
71
71
|
<span class="or"><%= t(:or) %></span>
|
|
72
|
-
<%= link_to_with_icon 'icon-remove', t(:cancel),
|
|
72
|
+
<%= link_to_with_icon 'icon-remove', t(:cancel), edit_admin_general_settings_url, :class => 'button' %>
|
|
73
73
|
</div>
|
|
74
74
|
|
|
75
75
|
</fieldset>
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
<div id="images" data-hook></div>
|
|
10
10
|
|
|
11
|
-
<% unless @product.images.any? %>
|
|
11
|
+
<% unless @product.images.any? || @product.variant_images.any? %>
|
|
12
12
|
<div class="no-objects-found">
|
|
13
13
|
<%= t(:no_images_found) %>.
|
|
14
14
|
</div>
|
|
@@ -17,10 +17,8 @@
|
|
|
17
17
|
<colgroup>
|
|
18
18
|
<col style="width: 5%">
|
|
19
19
|
<col style="width: 10%">
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<% end %>
|
|
23
|
-
<col style="width: <% if @product.has_variants? %>45%<% else %>70%<% end %>">
|
|
20
|
+
<col style="width: 25%">
|
|
21
|
+
<col style="width: 45%">
|
|
24
22
|
<col style="width: 15%">
|
|
25
23
|
</colgroup>
|
|
26
24
|
<thead>
|
|
@@ -35,7 +33,7 @@
|
|
|
35
33
|
</thead>
|
|
36
34
|
|
|
37
35
|
<tbody>
|
|
38
|
-
<% @product.images.each do |image| %>
|
|
36
|
+
<% (@product.images + @product.variant_images).each do |image| %>
|
|
39
37
|
<tr id="<%= spree_dom_id image %>" data-hook="images_row" class="<%= cycle('odd', 'even')%>">
|
|
40
38
|
<td class="no-border">
|
|
41
39
|
<span class="handle"></span>
|
|
@@ -43,9 +41,7 @@
|
|
|
43
41
|
<td>
|
|
44
42
|
<%= link_to image_tag(image.attachment.url(:mini)), image.attachment.url(:product) %>
|
|
45
43
|
</td>
|
|
46
|
-
|
|
47
|
-
<td><%= t(:all) %></td>
|
|
48
|
-
<% end %>
|
|
44
|
+
<td><%= options_text_for(image) %></td>
|
|
49
45
|
<td><%= image.alt %></td>
|
|
50
46
|
<td class="actions">
|
|
51
47
|
<%= link_to_with_icon 'icon-edit', t(:edit), edit_admin_product_image_url(@product, image), :no_text => true, :data => {:action => 'edit'} %>
|
|
@@ -53,29 +49,6 @@
|
|
|
53
49
|
</td>
|
|
54
50
|
</tr>
|
|
55
51
|
<% end %>
|
|
56
|
-
|
|
57
|
-
<% @product.variants.each do |variant| %>
|
|
58
|
-
<% variant.images.each do |image| %>
|
|
59
|
-
<tr id="<%= spree_dom_id image %>" data-hook="images_row" class="<%= cycle('odd', 'even')%>">
|
|
60
|
-
<td class="no-border">
|
|
61
|
-
<span class="handle"></span>
|
|
62
|
-
</td>
|
|
63
|
-
<td>
|
|
64
|
-
<%= link_to image_tag(image.attachment.url(:mini)), image.attachment.url(:product) %>
|
|
65
|
-
</td>
|
|
66
|
-
<% if @product.has_variants? %>
|
|
67
|
-
<td><%= variant.options_text %></td>
|
|
68
|
-
<% end %>
|
|
69
|
-
<td>
|
|
70
|
-
<%= image.alt %>
|
|
71
|
-
</td>
|
|
72
|
-
<td class="actions">
|
|
73
|
-
<%= link_to_with_icon 'icon-edit', t(:edit), edit_admin_product_image_url(@product, image), :no_text => true, :data => {:action => 'edit'} %>
|
|
74
|
-
<%= link_to_delete image, {:url => admin_product_image_url(@product, image), :no_text => true }%>
|
|
75
|
-
</td>
|
|
76
|
-
</tr>
|
|
77
|
-
<% end %>
|
|
78
|
-
<% end %>
|
|
79
52
|
</tbody>
|
|
80
53
|
</table>
|
|
81
|
-
<% end %>
|
|
54
|
+
<% end %>
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
<tbody id="order-charges" data-hook="admin_order_form_adjustments" class="no-border-top">
|
|
39
39
|
<% @order.adjustments.eligible.each do |adjustment| %>
|
|
40
40
|
<tr>
|
|
41
|
-
<td colspan="3"><strong><%= adjustment.label
|
|
41
|
+
<td colspan="3"><strong><%= adjustment.label %>:</strong></td>
|
|
42
42
|
<td class="total align-center"><span><%= adjustment.display_amount %></span></td>
|
|
43
43
|
<td class="actions"></td>
|
|
44
44
|
</tr>
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
<%= label_tag nil, t(:environment) %>
|
|
22
22
|
<%= collection_select(:payment_method, :environment, Rails.configuration.database_configuration.keys.sort, :to_s, :titleize, {}, {:id => 'gtwy-env', :class => 'select2 fullwidth'}) %>
|
|
23
23
|
</div>
|
|
24
|
+
<div data-hook="display" class="field">
|
|
25
|
+
<%= label_tag nil, t(:display) %>
|
|
26
|
+
<%= select(:payment_method, :display_on, Spree::PaymentMethod::DISPLAY.collect { |display| [t(display), display == :both ? nil : display.to_s] }, {}, {:class => 'select2 fullwidth'}) %>
|
|
27
|
+
</div>
|
|
24
28
|
<div data-hook="active" class="field">
|
|
25
29
|
<%= label_tag nil, t(:active) %>
|
|
26
30
|
<ul>
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
<th><%= t(:name) %></th>
|
|
25
25
|
<th><%= t(:provider) %></th>
|
|
26
26
|
<th><%= t(:environment) %></th>
|
|
27
|
+
<th><%= t(:display) %></th>
|
|
27
28
|
<th><%= t(:active) %></th>
|
|
28
29
|
<th data-hook="admin_payment_methods_index_header_actions" class="actions"></th>
|
|
29
30
|
</tr>
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
<td class="align-center"><%= method.name %></td>
|
|
35
36
|
<td><%= method.type %></td>
|
|
36
37
|
<td class="align-center"><%= method.environment.to_s.titleize %></td>
|
|
38
|
+
<td class="align-center"><%= method.display_on.blank? ? t(:both) : t(method.display_on) %></td>
|
|
37
39
|
<td class="align-center"><%= method.active ? t(:yes) : t(:no) %></td>
|
|
38
40
|
<td data-hook="admin_payment_methods_index_row_actions" class="actions">
|
|
39
41
|
<%= link_to_edit method, :no_text => true %>
|
|
@@ -42,4 +44,4 @@
|
|
|
42
44
|
</tr>
|
|
43
45
|
<% end %>
|
|
44
46
|
</tbody>
|
|
45
|
-
</table>
|
|
47
|
+
</table>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<tr class="product_property fields"
|
|
1
|
+
<tr class="product_property fields" id="spree_<%= dom_id(f.object) %>" data-hook="product_property">
|
|
2
|
+
<td class="no-border">
|
|
3
|
+
<span class="handle"></span>
|
|
4
|
+
<%= f.hidden_field :id %>
|
|
5
|
+
</td>
|
|
2
6
|
<td class='property_name'>
|
|
3
7
|
<%= f.text_field :property_name, :class => 'autocomplete' %>
|
|
4
8
|
</td>
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
<div id="prototypes" data-hook></div>
|
|
25
25
|
<%= image_tag 'spinner.gif', :plugin => 'spree', :style => 'display:none;', :id => 'busy_indicator' %>
|
|
26
26
|
|
|
27
|
-
<table class="index">
|
|
27
|
+
<table class="index sortable" data-hook data-sortable-link="<%= update_positions_admin_product_product_properties_url %>">
|
|
28
28
|
<thead>
|
|
29
29
|
<tr data-hook="product_properties_header">
|
|
30
|
-
<th><%= t(:property) %></th>
|
|
30
|
+
<th colspan="2"><%= t(:property) %></th>
|
|
31
31
|
<th><%= t(:value) %></th>
|
|
32
32
|
<th class="actions"></th>
|
|
33
33
|
</tr>
|
|
@@ -47,12 +47,7 @@
|
|
|
47
47
|
<%= f.field_container :available_on do %>
|
|
48
48
|
<%= f.label :available_on, t(:available_on) %>
|
|
49
49
|
<%= f.error_message_on :available_on %>
|
|
50
|
-
|
|
51
|
-
<% available_on = l(@product.available_on, :format => t('spree.date_picker.format')) %>
|
|
52
|
-
<% else %>
|
|
53
|
-
<% available_on = nil %>
|
|
54
|
-
<% end %>
|
|
55
|
-
<%= f.text_field :available_on, :value => available_on, :class => 'datepicker' %>
|
|
50
|
+
<%= f.text_field :available_on, :value => datepicker_field_value(@product.available_on), :class => 'datepicker' %>
|
|
56
51
|
<% end %>
|
|
57
52
|
|
|
58
53
|
<% unless @product.has_variants? %>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<% content_for :page_actions do %>
|
|
2
|
-
<li><%= button_link_to t(:back_to_products_list), admin_products_url, :icon => 'icon-arrow-left' %></li>
|
|
2
|
+
<li><%= button_link_to t(:back_to_products_list), session[:return_to] || admin_products_url, :icon => 'icon-arrow-left' %></li>
|
|
3
|
+
<li id="new_product_link">
|
|
4
|
+
<%= button_link_to t(:new_product), new_object_url, { :remote => true, :icon => 'icon-plus', :id => 'admin_new_product' } %>
|
|
5
|
+
</li>
|
|
3
6
|
<% end %>
|
|
4
7
|
|
|
5
8
|
<%= render :partial => 'spree/admin/shared/product_sub_menu' %>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<div id='properties' data-hook>
|
|
12
12
|
<%= f.field_container :property_ids do %>
|
|
13
13
|
<%= f.label :property_ids, t(:properties) %><br>
|
|
14
|
-
<%= f.select :property_ids, Spree::Property.
|
|
14
|
+
<%= f.select :property_ids, Spree::Property.all.map { |p| [p.presentation, p.id] }, {}, { :multiple => true, :class => "select2 fullwidth" } %>
|
|
15
15
|
<% end %>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% @prototype_properties.each do |prop| %>
|
|
1
|
+
<% @prototype_properties.sort_by{ |prop| -prop[:id] }.each do |prop| %>
|
|
2
2
|
$("a.add_fields").click();
|
|
3
|
-
$(".product_property.fields:
|
|
3
|
+
$(".product_property.fields:first input:first").val("<%= prop.name %>");
|
|
4
4
|
<% end %>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<i class="icon-arrow-right"></i> <%= t(:return_authorizations) %>
|
|
14
14
|
<% end %>
|
|
15
15
|
|
|
16
|
-
<% if @order.inventory_units.any?
|
|
16
|
+
<% if @order.inventory_units.any?(&:shipped?) || @order.return_authorizations.any? %>
|
|
17
17
|
<table class="index">
|
|
18
18
|
<thead data-hook="rma_header">
|
|
19
19
|
<tr>
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
<%= tab :orders, :payments, :creditcard_payments, :shipments, :credit_cards, :return_authorizations, :icon => 'icon-shopping-cart' %>
|
|
3
3
|
<%= tab :products , :option_types, :properties, :prototypes, :variants, :product_properties, :taxons, :icon => 'icon-th-large' %>
|
|
4
4
|
<%= tab :reports, :icon => 'icon-file' %>
|
|
5
|
-
<%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration', :icon => 'icon-wrench', :url => edit_admin_general_settings_path %>
|
|
5
|
+
<%= tab :configurations, :general_settings, :mail_methods, :tax_categories, :zones, :states, :payment_methods, :inventory_settings, :taxonomies, :shipping_methods, :trackers, :label => 'configuration', :icon => 'icon-wrench', :url => spree.edit_admin_general_settings_path %>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:destroy => I18n.t(:destroy),
|
|
14
14
|
:edit => I18n.t(:edit),
|
|
15
15
|
:loading => I18n.t(:loading),
|
|
16
|
-
:month_names => I18n.t(:month_names, :scope => :date).
|
|
16
|
+
:month_names => I18n.t(:month_names, :scope => :date).reject(&:blank?),
|
|
17
17
|
:more => I18n.t(:more),
|
|
18
18
|
:name => I18n.t(:name),
|
|
19
19
|
:next => I18n.t(:next),
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<%= check_box_tag "inventory_units[#{inventory_unit.id}]",
|
|
18
18
|
:true,
|
|
19
19
|
(inventory_unit.shipment == @shipment),
|
|
20
|
-
{ :disabled => %w(shipped backordered
|
|
20
|
+
{ :disabled => %w(shipped backordered).include?(inventory_unit.state),
|
|
21
21
|
:class => 'inventory_unit'} %>
|
|
22
22
|
</td>
|
|
23
23
|
<td style="vertical-align:top; width:120px;"><%= inventory_unit.variant.sku %></td>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<div data-hook="admin_shipping_method_form_fields">
|
|
1
|
+
<div data-hook="admin_shipping_method_form_fields" class="alpha twelve columns">
|
|
2
2
|
<div class="alpha four columns">
|
|
3
3
|
<%= f.field_container :name do %>
|
|
4
4
|
<%= f.label :name, t(:name) %><br />
|
|
@@ -34,14 +34,14 @@
|
|
|
34
34
|
<% end %>
|
|
35
35
|
|
|
36
36
|
<div class="field">
|
|
37
|
-
<%= label_tag t(:match_rule) %>
|
|
37
|
+
<%= label_tag t(:match_rule) %>
|
|
38
38
|
<ul>
|
|
39
39
|
<li><%= f.check_box :match_none %> <%= f.label :match_none, t('match_choices.none') %></li>
|
|
40
40
|
<li><%= f.check_box :match_one %> <%= f.label :match_one, t('match_choices.one') %></li>
|
|
41
41
|
<li><%= f.check_box :match_all %> <%= f.label :match_all, t('match_choices.all') %></li>
|
|
42
42
|
</ul>
|
|
43
43
|
</div>
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
</fieldset>
|
|
46
46
|
</div>
|
|
47
47
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
{{#if variant.option_values}}
|
|
21
21
|
<ul class='variant-options'>
|
|
22
22
|
{{#each variant.option_values}}
|
|
23
|
-
<li><strong>{{
|
|
23
|
+
<li><strong>{{this.option_type.presentation}}:</strong> {{this.presentation}}</li>
|
|
24
24
|
{{/each}}
|
|
25
25
|
</ul>
|
|
26
26
|
{{/if}}
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
</td>
|
|
79
79
|
<td data-hook="order_item_description">
|
|
80
80
|
<h4><%= item.variant.product.name %></h4>
|
|
81
|
-
<%= truncate(item.variant.product.description, :length => 100, :omission => "...") %>
|
|
81
|
+
<%= truncate(raw(item.variant.product.description), :length => 100, :omission => "...") %>
|
|
82
82
|
<%= "(" + item.variant.options_text + ")" unless item.variant.option_values.empty? %>
|
|
83
83
|
</td>
|
|
84
84
|
<td data-hook="order_item_price" class="price"><span><%= item.variant.display_amount %></span></td>
|
data/config/routes.rb
CHANGED
|
@@ -53,7 +53,11 @@ Spree::Core::Engine.routes.draw do
|
|
|
53
53
|
get :search
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
resources :product_properties
|
|
56
|
+
resources :product_properties do
|
|
57
|
+
collection do
|
|
58
|
+
post :update_positions
|
|
59
|
+
end
|
|
60
|
+
end
|
|
57
61
|
resources :images do
|
|
58
62
|
collection do
|
|
59
63
|
post :update_positions
|
|
@@ -53,14 +53,17 @@ module Spree
|
|
|
53
53
|
return unless File.exists? 'public/robots.txt'
|
|
54
54
|
append_file "public/robots.txt", <<-ROBOTS
|
|
55
55
|
User-agent: *
|
|
56
|
-
Disallow: /
|
|
56
|
+
Disallow: /checkout
|
|
57
|
+
Disallow: /cart
|
|
57
58
|
Disallow: /orders
|
|
58
59
|
Disallow: /countries
|
|
59
60
|
Disallow: /line_items
|
|
60
61
|
Disallow: /password_resets
|
|
61
62
|
Disallow: /states
|
|
62
63
|
Disallow: /user_sessions
|
|
64
|
+
Disallow: /user_registrations
|
|
63
65
|
Disallow: /users
|
|
66
|
+
Disallow: /account
|
|
64
67
|
ROBOTS
|
|
65
68
|
end
|
|
66
69
|
|
|
@@ -38,7 +38,7 @@ module Spree
|
|
|
38
38
|
title_string = @title.present? ? @title : accurate_title
|
|
39
39
|
if title_string.present?
|
|
40
40
|
if Spree::Config[:always_put_site_name_in_title]
|
|
41
|
-
[
|
|
41
|
+
[title_string, default_title].join(' - ')
|
|
42
42
|
else
|
|
43
43
|
title_string
|
|
44
44
|
end
|
|
@@ -76,8 +76,8 @@ module Spree
|
|
|
76
76
|
def set_user_language
|
|
77
77
|
locale = session[:locale]
|
|
78
78
|
locale ||= Rails.application.config.i18n.default_locale
|
|
79
|
-
locale ||= I18n.default_locale unless I18n.available_locales.include?(locale
|
|
80
|
-
I18n.locale = locale
|
|
79
|
+
locale ||= I18n.default_locale unless I18n.available_locales.map(&:to_s).include?(locale)
|
|
80
|
+
I18n.locale = locale
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# Returns which layout to render.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Spree
|
|
2
|
+
module Core
|
|
3
|
+
module ControllerHelpers
|
|
4
|
+
def self.included(base)
|
|
5
|
+
base.class_eval do
|
|
6
|
+
include Spree::Core::ControllerHelpers::Common
|
|
7
|
+
include Spree::Core::ControllerHelpers::Auth
|
|
8
|
+
include Spree::Core::ControllerHelpers::Order
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/spree/core/engine.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'rabl'
|
|
2
|
+
|
|
1
3
|
module Spree
|
|
2
4
|
module Core
|
|
3
5
|
class Engine < ::Rails::Engine
|
|
@@ -14,12 +16,13 @@ module Spree
|
|
|
14
16
|
|
|
15
17
|
config.to_prepare &method(:activate).to_proc
|
|
16
18
|
|
|
17
|
-
Rabl.configure do |config|
|
|
18
|
-
config.include_json_root = false
|
|
19
|
-
config.include_child_root = false
|
|
20
|
-
end
|
|
21
19
|
|
|
22
20
|
config.after_initialize do
|
|
21
|
+
Rabl.configure do |config|
|
|
22
|
+
config.include_json_root = false
|
|
23
|
+
config.include_child_root = false
|
|
24
|
+
end
|
|
25
|
+
|
|
23
26
|
ActiveSupport::Notifications.subscribe(/^spree\./) do |*args|
|
|
24
27
|
event_name, start_time, end_time, id, payload = args
|
|
25
28
|
Activator.active.event_name_starts_with(event_name).each do |activator|
|
|
@@ -42,7 +42,7 @@ module Spree
|
|
|
42
42
|
def save_permalink(permalink_value=self.to_param)
|
|
43
43
|
field = self.class.permalink_field
|
|
44
44
|
# Do other links exist with this permalink?
|
|
45
|
-
other = self.class.where("#{field} LIKE ?", "#{permalink_value}%")
|
|
45
|
+
other = self.class.where("#{self.class.table_name}.#{field} LIKE ?", "#{permalink_value}%")
|
|
46
46
|
if other.any?
|
|
47
47
|
# Find the existing permalink with the highest number, and increment that number.
|
|
48
48
|
# (If none of the existing permalinks have a number, this will evaluate to 1.)
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
module AuthorizationHelpers
|
|
2
2
|
module Controller
|
|
3
3
|
def stub_authorization!
|
|
4
|
+
let(:ability_user) { stub_model(Spree::LegacyUser) }
|
|
5
|
+
|
|
4
6
|
before do
|
|
5
|
-
controller.
|
|
7
|
+
controller.stub(:try_spree_current_user => ability_user)
|
|
8
|
+
controller.should_receive(:authorize!).and_return(true)
|
|
6
9
|
end
|
|
7
10
|
end
|
|
8
11
|
end
|
|
@@ -27,4 +30,4 @@ end
|
|
|
27
30
|
RSpec.configure do |config|
|
|
28
31
|
config.extend AuthorizationHelpers::Controller, :type => :controller
|
|
29
32
|
config.extend AuthorizationHelpers::Request, :type => :request
|
|
30
|
-
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Fake ability for testing administration
|
|
2
|
+
class BarAbility
|
|
3
|
+
include CanCan::Ability
|
|
4
|
+
|
|
5
|
+
def initialize(user)
|
|
6
|
+
user ||= Spree::User.new
|
|
7
|
+
if user.has_spree_role? 'bar'
|
|
8
|
+
# allow dispatch to :index and :show orders on the admin
|
|
9
|
+
can :index, Spree::Order
|
|
10
|
+
can :show, Spree::Order
|
|
11
|
+
can :admin, Spree::Order
|
|
12
|
+
# allow dispatch to :index, :show, :create and :update shipments on the admin
|
|
13
|
+
can :manage, Spree::Shipment
|
|
14
|
+
can :admin, Spree::Shipment
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryGirl.define do
|
|
2
|
-
factory :
|
|
2
|
+
factory :base_product, :class => Spree::Product do
|
|
3
3
|
sequence(:name) { |n| "Product ##{n} - #{Kernel.rand(9999)}" }
|
|
4
4
|
description { Faker::Lorem.paragraphs(1 + Kernel.rand(5)).join("\n") }
|
|
5
5
|
price 19.99
|
|
@@ -7,13 +7,15 @@ FactoryGirl.define do
|
|
|
7
7
|
sku 'ABC'
|
|
8
8
|
available_on 1.year.ago
|
|
9
9
|
deleted_at nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
factory :simple_product, :parent => :base_product do
|
|
10
13
|
on_hand 5
|
|
11
14
|
end
|
|
12
15
|
|
|
13
16
|
factory :product, :parent => :simple_product do
|
|
14
17
|
tax_category { |r| Spree::TaxCategory.first || r.association(:tax_category) }
|
|
15
18
|
shipping_category { |r| Spree::ShippingCategory.first || r.association(:shipping_category) }
|
|
16
|
-
on_hand 5
|
|
17
19
|
end
|
|
18
20
|
|
|
19
21
|
factory :product_with_option_types, :parent => :product do
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
FactoryGirl.define do
|
|
2
|
-
factory :
|
|
2
|
+
factory :base_variant, :class => Spree::Variant do
|
|
3
3
|
price 19.99
|
|
4
4
|
cost_price 17.00
|
|
5
5
|
sku { Faker::Lorem.sentence }
|
|
@@ -7,10 +7,16 @@ FactoryGirl.define do
|
|
|
7
7
|
height { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
|
|
8
8
|
width { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
|
|
9
9
|
depth { BigDecimal.new("#{rand(200)}.#{rand(99)}") }
|
|
10
|
-
on_hand 5
|
|
11
10
|
|
|
12
11
|
# associations:
|
|
13
|
-
product { |p| p.association(:
|
|
12
|
+
product { |p| p.association(:base_product) }
|
|
14
13
|
option_values { [FactoryGirl.create(:option_value)] }
|
|
15
14
|
end
|
|
15
|
+
|
|
16
|
+
factory :variant, :parent => :base_variant do
|
|
17
|
+
on_hand 5
|
|
18
|
+
|
|
19
|
+
# associations:
|
|
20
|
+
product { |p| p.association(:product) }
|
|
21
|
+
end
|
|
16
22
|
end
|
|
@@ -2,17 +2,23 @@ module Spree
|
|
|
2
2
|
module Core
|
|
3
3
|
module TestingSupport
|
|
4
4
|
module Preferences
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
def reset_spree_preferences(&config_block)
|
|
6
|
+
Spree::Preferences::Store.instance.persistence = false
|
|
7
|
+
Spree::Preferences::Store.instance.clear_cache
|
|
8
|
+
|
|
9
|
+
configure_spree_preferences &config_block if block_given?
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# The preference cache is cleared before each test, so the
|
|
13
|
+
# default values will be used. You can define preferences
|
|
14
|
+
# for your spec with:
|
|
7
15
|
#
|
|
8
|
-
#
|
|
16
|
+
# configure_spree_preferences do |config|
|
|
9
17
|
# config.site_name = "my fancy pants store"
|
|
10
18
|
# end
|
|
11
19
|
#
|
|
12
|
-
def
|
|
13
|
-
Spree::Preferences::Store.instance.persistence = false
|
|
20
|
+
def configure_spree_preferences
|
|
14
21
|
config = Rails.application.config.spree.preferences
|
|
15
|
-
config.reset
|
|
16
22
|
yield(config) if block_given?
|
|
17
23
|
end
|
|
18
24
|
|
data/lib/spree/core/version.rb
CHANGED
data/lib/spree/core.rb
CHANGED
data/lib/spree/scopes/dynamic.rb
CHANGED
data/lib/tasks/core.rake
CHANGED
|
@@ -3,13 +3,13 @@ require 'spree/core/custom_fixtures'
|
|
|
3
3
|
|
|
4
4
|
namespace :db do
|
|
5
5
|
desc %q{Loads a specified fixture file:
|
|
6
|
-
For .yml
|
|
6
|
+
For .yml use rake db:load_file[spree/filename.yml,/absolute/path/to/parent/]
|
|
7
7
|
For .rb use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
8
8
|
|
|
9
9
|
task :load_file , [:file, :dir] => :environment do |t, args|
|
|
10
10
|
file = Pathname.new(args.file)
|
|
11
11
|
|
|
12
|
-
if %w{.
|
|
12
|
+
if %w{.yml}.include? file.extname
|
|
13
13
|
puts "loading fixture #{Pathname.new(args.dir).join(file)}"
|
|
14
14
|
Spree::Core::Fixtures.create_fixtures(args.dir, file.to_s.sub(file.extname, ""))
|
|
15
15
|
elsif file.exist?
|
|
@@ -25,7 +25,7 @@ For .rb use rake db:load_file[/absolute/path/to/sample/filename.rb]}
|
|
|
25
25
|
|
|
26
26
|
fixtures = ActiveSupport::OrderedHash.new
|
|
27
27
|
ruby_files = ActiveSupport::OrderedHash.new
|
|
28
|
-
Dir.glob(File.join(dir , '**/*.{yml,
|
|
28
|
+
Dir.glob(File.join(dir , '**/*.{yml,rb}')).each do |fixture_file|
|
|
29
29
|
ext = File.extname fixture_file
|
|
30
30
|
if ext == ".rb"
|
|
31
31
|
ruby_files[File.basename(fixture_file, '.*')] = fixture_file
|