solidus_backend 4.3.4 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/spree/backend/namespaces.js +0 -1
- data/app/assets/javascripts/spree/backend/templates/index.js +0 -3
- data/app/assets/javascripts/spree/backend/variant_autocomplete.js +11 -8
- data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +1 -1
- data/app/assets/javascripts/spree/backend/views/index.js +0 -2
- data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +1 -2
- data/app/assets/javascripts/spree/backend.js +0 -2
- data/app/assets/stylesheets/spree/backend/sections/_adjustments.scss +0 -3
- data/app/assets/stylesheets/spree/backend/sections/index.scss +0 -1
- data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
- data/app/controllers/spree/admin/dashboards_controller.rb +4 -0
- data/app/controllers/spree/admin/option_types_controller.rb +1 -1
- data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
- data/app/controllers/spree/admin/resource_controller.rb +1 -1
- data/app/helpers/spree/admin/base_helper.rb +2 -2
- data/app/helpers/spree/admin/navigation_helper.rb +1 -1
- data/app/views/spree/admin/adjustments/_adjustment.html.erb +0 -1
- data/app/views/spree/admin/dashboards/home.html.erb +1 -0
- data/app/views/spree/admin/orders/_adjustments.html.erb +1 -1
- data/app/views/spree/admin/orders/_order_details.html.erb +3 -3
- data/app/views/spree/admin/orders/confirm.html.erb +3 -3
- data/app/views/spree/admin/orders/index.html.erb +4 -82
- data/app/views/spree/admin/products/index.html.erb +2 -2
- data/app/views/spree/admin/shared/_locale_selection_solidus_admin.html.erb +1 -1
- data/app/views/spree/admin/shared/search_fields/_checkbox.html.erb +8 -0
- data/app/views/spree/admin/shared/search_fields/_date_range_picker.html.erb +16 -0
- data/app/views/spree/admin/shared/search_fields/_select.html.erb +6 -0
- data/app/views/spree/admin/shared/search_fields/_text_field.html.erb +6 -0
- data/app/views/spree/admin/shared/search_fields/_variant_autocomplete.html.erb +6 -0
- data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
- data/app/views/spree/admin/users/index.html.erb +1 -1
- data/app/views/spree/admin/users/items.html.erb +3 -3
- data/app/views/spree/admin/users/orders.html.erb +3 -3
- data/app/views/spree/admin/variants/_form.html.erb +1 -1
- data/app/views/spree/admin/zones/index.html.erb +1 -1
- data/config/routes.rb +0 -11
- data/lib/spree/backend_configuration.rb +83 -18
- data/solidus_backend.gemspec +1 -1
- metadata +13 -72
- data/app/assets/javascripts/spree/backend/promotions/activation.js +0 -26
- data/app/assets/javascripts/spree/backend/promotions.js +0 -35
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +0 -23
- data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +0 -23
- data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +0 -12
- data/app/assets/javascripts/spree/backend/views/calculators/tiered.js +0 -54
- data/app/assets/javascripts/spree/backend/views/promotions/option_values_rule.js +0 -79
- data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +0 -138
- data/app/controllers/spree/admin/promotion_actions_controller.rb +0 -51
- data/app/controllers/spree/admin/promotion_categories_controller.rb +0 -8
- data/app/controllers/spree/admin/promotion_code_batches_controller.rb +0 -30
- data/app/controllers/spree/admin/promotion_codes_controller.rb +0 -48
- data/app/controllers/spree/admin/promotion_rules_controller.rb +0 -60
- data/app/controllers/spree/admin/promotions_controller.rb +0 -67
- data/app/helpers/spree/admin/promotions_helper.rb +0 -15
- data/app/helpers/spree/promotion_rules_helper.rb +0 -12
- data/app/views/spree/admin/promotion_actions/create.js.erb +0 -10
- data/app/views/spree/admin/promotion_actions/destroy.js.erb +0 -1
- data/app/views/spree/admin/promotion_categories/_form.html.erb +0 -14
- data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -10
- data/app/views/spree/admin/promotion_categories/index.html.erb +0 -47
- data/app/views/spree/admin/promotion_categories/new.html.erb +0 -10
- data/app/views/spree/admin/promotion_code_batches/_form_fields.html.erb +0 -22
- data/app/views/spree/admin/promotion_code_batches/download.csv.ruby +0 -8
- data/app/views/spree/admin/promotion_code_batches/index.html.erb +0 -65
- data/app/views/spree/admin/promotion_code_batches/new.html.erb +0 -8
- data/app/views/spree/admin/promotion_codes/index.csv.ruby +0 -8
- data/app/views/spree/admin/promotion_codes/index.html.erb +0 -32
- data/app/views/spree/admin/promotion_codes/new.html.erb +0 -31
- data/app/views/spree/admin/promotion_rules/create.js.erb +0 -8
- data/app/views/spree/admin/promotion_rules/destroy.js.erb +0 -3
- data/app/views/spree/admin/promotions/_actions.html.erb +0 -37
- data/app/views/spree/admin/promotions/_activations_edit.html.erb +0 -22
- data/app/views/spree/admin/promotions/_activations_new.html.erb +0 -43
- data/app/views/spree/admin/promotions/_form.html.erb +0 -67
- data/app/views/spree/admin/promotions/_promotion_action.html.erb +0 -13
- data/app/views/spree/admin/promotions/_promotion_rule.html.erb +0 -12
- data/app/views/spree/admin/promotions/_rules.html.erb +0 -42
- data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +0 -2
- data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +0 -6
- data/app/views/spree/admin/promotions/actions/_create_quantity_adjustments.html.erb +0 -10
- data/app/views/spree/admin/promotions/actions/_free_shipping.html.erb +0 -0
- data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +0 -29
- data/app/views/spree/admin/promotions/calculators/_default_fields.html.erb +0 -6
- data/app/views/spree/admin/promotions/calculators/distributed_amount/_fields.html.erb +0 -56
- data/app/views/spree/admin/promotions/calculators/flat_rate/_fields.html.erb +0 -6
- data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +0 -30
- data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +0 -30
- data/app/views/spree/admin/promotions/edit.html.erb +0 -35
- data/app/views/spree/admin/promotions/index.html.erb +0 -124
- data/app/views/spree/admin/promotions/new.html.erb +0 -9
- data/app/views/spree/admin/promotions/rules/_first_order.html.erb +0 -0
- data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +0 -13
- data/app/views/spree/admin/promotions/rules/_item_total.html.erb +0 -14
- data/app/views/spree/admin/promotions/rules/_minimum_quantity.html.erb +0 -5
- data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +0 -12
- data/app/views/spree/admin/promotions/rules/_one_use_per_user.html.erb +0 -0
- data/app/views/spree/admin/promotions/rules/_option_value.html.erb +0 -13
- data/app/views/spree/admin/promotions/rules/_product.html.erb +0 -15
- data/app/views/spree/admin/promotions/rules/_store.html.erb +0 -6
- data/app/views/spree/admin/promotions/rules/_taxon.html.erb +0 -9
- data/app/views/spree/admin/promotions/rules/_user.html.erb +0 -4
- data/app/views/spree/admin/promotions/rules/_user_logged_in.html.erb +0 -0
- data/app/views/spree/admin/promotions/rules/_user_role.html.erb +0 -12
@@ -1,32 +0,0 @@
|
|
1
|
-
<% admin_breadcrumb link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path %>
|
2
|
-
<% admin_breadcrumb link_to(@promotion.name, spree.edit_admin_promotion_path(@promotion)) %>
|
3
|
-
<% admin_breadcrumb plural_resource_name(Spree::PromotionCode) %>
|
4
|
-
|
5
|
-
<% content_for :page_actions do %>
|
6
|
-
<li>
|
7
|
-
<% if can?(:create, Spree::PromotionCode) && !@promotion.apply_automatically? %>
|
8
|
-
<%= link_to t('spree.create_promotion_code'), new_admin_promotion_promotion_code_path(promotion_id: @promotion.id), class: 'btn btn-primary' %>
|
9
|
-
<% end %>
|
10
|
-
|
11
|
-
<%= link_to t('spree.download_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %>
|
12
|
-
</li>
|
13
|
-
<% end %>
|
14
|
-
|
15
|
-
<div class="pagination-summary">
|
16
|
-
<%= page_entries_info(@promotion_codes) %>
|
17
|
-
</div>
|
18
|
-
|
19
|
-
<table>
|
20
|
-
<thead>
|
21
|
-
<th><%= Spree::PromotionCode.human_attribute_name :value %></th>
|
22
|
-
</thead>
|
23
|
-
<tbody>
|
24
|
-
<% @promotion_codes.each do |promotion_code| %>
|
25
|
-
<tr>
|
26
|
-
<td><%= promotion_code.value %></td>
|
27
|
-
</tr>
|
28
|
-
<% end %>
|
29
|
-
</tbody>
|
30
|
-
</table>
|
31
|
-
|
32
|
-
<%= paginate @promotion_codes, theme: "solidus_admin" %>
|
@@ -1,31 +0,0 @@
|
|
1
|
-
<% admin_breadcrumb link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path %>
|
2
|
-
<% admin_breadcrumb link_to(@promotion.name, spree.edit_admin_promotion_path(@promotion)) %>
|
3
|
-
<% admin_breadcrumb plural_resource_name(Spree::PromotionCode) %>
|
4
|
-
|
5
|
-
<% content_for :page_actions do %>
|
6
|
-
<li>
|
7
|
-
<%= link_to t('spree.view_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id), class: 'btn btn-primary' %>
|
8
|
-
|
9
|
-
<%= link_to t('spree.download_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %>
|
10
|
-
</li>
|
11
|
-
<% end %>
|
12
|
-
|
13
|
-
<%= form_for [:admin, @promotion, @promotion_code], method: :post do |f| %>
|
14
|
-
<fieldset class="no-border-top">
|
15
|
-
<%= render partial: 'spree/shared/error_messages', locals: { target: @promotion_code } %>
|
16
|
-
|
17
|
-
<div class="row">
|
18
|
-
<div class="col-4">
|
19
|
-
<%= f.field_container :value do %>
|
20
|
-
<%= f.label :value, class: 'required' %>
|
21
|
-
<%= f.text_field :value, class: 'fullwidth', required: true %>
|
22
|
-
<% end %>
|
23
|
-
</div>
|
24
|
-
</div>
|
25
|
-
|
26
|
-
<div class="form-buttons filter-actions actions" data-hook="buttons">
|
27
|
-
<%= f.submit t('spree.actions.create'), class: 'btn btn-primary' %>
|
28
|
-
<%= link_to t('spree.actions.cancel'), admin_promotion_promotion_codes_url(@promotion), class: 'button' %>
|
29
|
-
</div>
|
30
|
-
</fieldset>
|
31
|
-
<% end %>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
$('#rules').append('<%= escape_javascript( render(partial: 'spree/admin/promotions/promotion_rule', object: @promotion_rule) ) %>');
|
2
|
-
$('#rules .no-objects-found').hide();
|
3
|
-
|
4
|
-
$('.product_picker').productAutocomplete();
|
5
|
-
$('.user_picker').userAutocomplete();
|
6
|
-
$('.taxon_picker').taxonAutocomplete();
|
7
|
-
|
8
|
-
$('#promotion_rule_type').html('<%= escape_javascript options_for_promotion_rule_types(@promotion) %>');
|
@@ -1,37 +0,0 @@
|
|
1
|
-
<fieldset id="action_fields" class="no-border-top">
|
2
|
-
|
3
|
-
<%= form_tag spree.admin_promotion_promotion_actions_path(@promotion), remote: true, id: 'new_promotion_action_form' do %>
|
4
|
-
<% options = options_for_select( Rails.application.config.spree.promotions.actions.map {|action| [ action.model_name.human, action.name] } ) %>
|
5
|
-
<fieldset>
|
6
|
-
<legend align="center"><%= t('spree.promotion_actions') %></legend>
|
7
|
-
<% if can?(:update, @promotion) %>
|
8
|
-
<div class="field">
|
9
|
-
<%= label_tag :action_type, t('spree.adjustment_type') %>
|
10
|
-
<%= admin_hint t('spree.adjustment_type'), t(:promotions, scope: [:spree, :hints, "spree/calculator"]) %>
|
11
|
-
<%= select_tag 'action_type', options, include_blank: t(:choose_promotion_action, scope: 'spree'), class: 'custom-select fullwidth', required: true %>
|
12
|
-
</div>
|
13
|
-
<div class="filter-actions actions">
|
14
|
-
<%= button_tag t('spree.actions.add'), class: 'btn btn-primary' %>
|
15
|
-
</div>
|
16
|
-
<% end %>
|
17
|
-
</fieldset>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<%= form_for @promotion, url: spree.admin_promotion_path(@promotion), method: :put do |f| %>
|
21
|
-
<div id="actions" class="filter_list">
|
22
|
-
<% if @promotion.actions.any? %>
|
23
|
-
<%= render partial: 'promotion_action', collection: @promotion.actions %>
|
24
|
-
<% else %>
|
25
|
-
<div class="no-objects-found">
|
26
|
-
<%= t('spree.no_actions_added') %>
|
27
|
-
</div>
|
28
|
-
<% end %>
|
29
|
-
</div>
|
30
|
-
<% if can?(:update, @promotion) %>
|
31
|
-
<div class="filter-actions actions promotion-update">
|
32
|
-
<%= button_tag t('spree.actions.update'), class: 'btn btn-primary' %>
|
33
|
-
</div>
|
34
|
-
<% end %>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
</fieldset>
|
@@ -1,22 +0,0 @@
|
|
1
|
-
<% if @promotion.apply_automatically? %>
|
2
|
-
<p>
|
3
|
-
<%= t('.auto') %>
|
4
|
-
</p>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<% if @promotion.codes.count == 1 %>
|
8
|
-
<p>
|
9
|
-
<%= t('.single_code_html', code: @promotion.codes.first.value) %>
|
10
|
-
</p>
|
11
|
-
<% elsif @promotion.codes.count > 1 %>
|
12
|
-
<p>
|
13
|
-
<%= t('.multiple_codes_html', count: @promotion.codes.count) %>
|
14
|
-
</p>
|
15
|
-
<% end %>
|
16
|
-
|
17
|
-
<% if @promotion.path %>
|
18
|
-
<div class="field">
|
19
|
-
<%= f.label :path %>
|
20
|
-
<%= f.text_field :path, class: "fullwidth" %>
|
21
|
-
</div>
|
22
|
-
<% end %>
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<% activation_type = params[:activation_type] || 'single_code' %>
|
2
|
-
<div class="row" id="js_promotion_activation">
|
3
|
-
<div class="col-3">
|
4
|
-
<div class="form-check">
|
5
|
-
<label class="form-check-label">
|
6
|
-
<%= radio_button_tag('activation_type', 'auto', activation_type == 'auto') %>
|
7
|
-
<%= t('.auto') %> <%= f.field_hint :promo_code_will_be_disabled %>
|
8
|
-
</label>
|
9
|
-
</div>
|
10
|
-
<div class="form-check">
|
11
|
-
<label class="form-check-label">
|
12
|
-
<%= radio_button_tag('activation_type', 'single_code', activation_type == 'single_code') %>
|
13
|
-
<%= t('.single_code') %>
|
14
|
-
</label>
|
15
|
-
</div>
|
16
|
-
<div class="form-check">
|
17
|
-
<label class="form-check-label">
|
18
|
-
<%= radio_button_tag('activation_type', 'multiple_codes', activation_type == 'multiple_codes') %>
|
19
|
-
<%= t('.multiple_codes') %>
|
20
|
-
</label>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
<div class="col-9">
|
24
|
-
<input name="promotion[apply_automatically]" type="hidden" value="0">
|
25
|
-
<div data-activation-type="auto">
|
26
|
-
<input name="promotion[apply_automatically]" type="hidden" value="1">
|
27
|
-
</div>
|
28
|
-
|
29
|
-
<div data-activation-type="single_code">
|
30
|
-
<div class="field">
|
31
|
-
<%= label_tag :single_code, Spree::PromotionCode.model_name.human, class: "required" %>
|
32
|
-
<%= text_field_tag :single_code, @promotion.codes.first.try!(:value), class: "fullwidth", required: true %>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div data-activation-type="multiple_codes">
|
37
|
-
<%= fields_for :promotion_code_batch, @promotion_code_batch do |batch| %>
|
38
|
-
<%= render partial: 'spree/admin/promotion_code_batches/form_fields', locals: {f: f, batch: batch, promotion_id: params[:promotion_id]} %>
|
39
|
-
<% end %>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
</div>
|
43
|
-
</div>
|
@@ -1,67 +0,0 @@
|
|
1
|
-
<%= render partial: 'spree/shared/error_messages', locals: { target: @promotion } %>
|
2
|
-
<fieldset class="form-group no-border-bottom no-border-top">
|
3
|
-
<div class="row">
|
4
|
-
<div id="general_fields" class="col-9">
|
5
|
-
<div class="row">
|
6
|
-
<div class="col-12">
|
7
|
-
<%= f.field_container :name do %>
|
8
|
-
<%= f.label :name, class: 'required' %>
|
9
|
-
<%= f.text_field :name, class: 'fullwidth', required: true %>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<%= f.field_container :description do %>
|
13
|
-
<%= f.label :description %><br>
|
14
|
-
<%= f.text_area :description, rows: 7, class: 'fullwidth' %>
|
15
|
-
<span class="info">
|
16
|
-
<%= t('spree.character_limit') %>
|
17
|
-
</span>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<%= f.field_container :category do %>
|
21
|
-
<%= f.label :promotion_category_id, Spree::PromotionCategory.model_name.human %><br>
|
22
|
-
<%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { include_blank: t('spree.match_choices.none') }, { class: 'custom-select fullwidth' }) %>
|
23
|
-
<% end %>
|
24
|
-
</div>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div id="expiry_fields" class="col-3">
|
29
|
-
<%= f.field_container :overall_usage_limit do %>
|
30
|
-
<%= f.label :usage_limit %><br>
|
31
|
-
<%= f.number_field :usage_limit, min: 0, class: 'fullwidth' %><br>
|
32
|
-
<span class="info">
|
33
|
-
<%= t('spree.current_promotion_usage', count: @promotion.usage_count) %>
|
34
|
-
</span>
|
35
|
-
<% end %>
|
36
|
-
|
37
|
-
<% if @promotion.persisted? %>
|
38
|
-
<%= f.field_container :per_code_usage_limit do %>
|
39
|
-
<%= f.label :per_code_usage_limit %><br>
|
40
|
-
<%= f.number_field :per_code_usage_limit, min: 0, class: 'fullwidth' %><br>
|
41
|
-
<% end %>
|
42
|
-
<% end %>
|
43
|
-
|
44
|
-
<div id="starts_at_field" class="field">
|
45
|
-
<%= f.label :starts_at %>
|
46
|
-
<%= f.field_hint :starts_at %>
|
47
|
-
<%= f.text_field :starts_at, value: datepicker_field_value(@promotion.starts_at, with_time: true), placeholder: t(".starts_at_placeholder"), class: 'datepicker datepicker-from fullwidth', data: { :'enable-time' => true, :'default-hour' => 0 } %>
|
48
|
-
</div>
|
49
|
-
|
50
|
-
<div id="expires_at_field" class="field">
|
51
|
-
<%= f.label :expires_at %>
|
52
|
-
<%= f.field_hint :expires_at %>
|
53
|
-
<%= f.text_field :expires_at, value: datepicker_field_value(@promotion.expires_at, with_time: true), placeholder: t(".expires_at_placeholder"), class: 'datepicker datepicker-to fullwidth', data: { :'enable-time' => true, :'default-hour' => 0 } %>
|
54
|
-
</div>
|
55
|
-
</div>
|
56
|
-
</div>
|
57
|
-
</fieldset>
|
58
|
-
|
59
|
-
<fieldset class="form-group no-border-bottom">
|
60
|
-
<legend><%= t '.activation' %></legend>
|
61
|
-
|
62
|
-
<% if @promotion.new_record? %>
|
63
|
-
<%= render 'spree/admin/promotions/activations_new', f: f %>
|
64
|
-
<% else %>
|
65
|
-
<%= render 'spree/admin/promotions/activations_edit', f: f %>
|
66
|
-
<% end %>
|
67
|
-
</fieldset>
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<div class="promotion_action promotion-block <%= promotion_action.model_name.element %>" id="<%= dom_id promotion_action %>">
|
2
|
-
<h6 class="promotion-title"><%= promotion_action.class.human_attribute_name(:description) %></h6>
|
3
|
-
<% if can?(:destroy, promotion_action) %>
|
4
|
-
<%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_action_path(@promotion, promotion_action), remote: true, method: :delete, class: 'delete' %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
<% param_prefix = "promotion[promotion_actions_attributes][#{promotion_action.id}]" %>
|
8
|
-
<%= hidden_field_tag "#{param_prefix}[id]", promotion_action.id %>
|
9
|
-
|
10
|
-
<%= render partial: "spree/shared/error_messages", locals: { target: promotion_action } %>
|
11
|
-
<%= render partial: promotion_action.to_partial_path,
|
12
|
-
locals: { promotion_action: promotion_action, param_prefix: param_prefix } %>
|
13
|
-
</div>
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<div class="promotion_rule promotion-block col-12" id="<%= dom_id promotion_rule %>">
|
2
|
-
<% type_name = promotion_rule.model_name.element %>
|
3
|
-
<h6 class='promotion-title <%= 'no-text' if type_name.in? %w(user_logged_in first_order one_use_per_user) %>'><%= promotion_rule.class.human_attribute_name(:description) %></h6>
|
4
|
-
<% if can?(:destroy, promotion_rule) %>
|
5
|
-
<%= link_to_with_icon 'trash', '', spree.admin_promotion_promotion_rule_path(@promotion, promotion_rule), remote: true, method: :delete, class: 'delete' %>
|
6
|
-
<% end %>
|
7
|
-
|
8
|
-
<% param_prefix = "promotion[promotion_rules_attributes][#{promotion_rule.id}]" %>
|
9
|
-
<%= hidden_field_tag "#{param_prefix}[id]", promotion_rule.id %>
|
10
|
-
<%= render partial: "spree/shared/error_messages", locals: { target: promotion_rule } %>
|
11
|
-
<%= render partial: promotion_rule.to_partial_path, locals: { promotion_rule: promotion_rule, param_prefix: param_prefix } %>
|
12
|
-
</div>
|
@@ -1,42 +0,0 @@
|
|
1
|
-
<fieldset id="rule_fields" class="no-border-bottom no-border-top">
|
2
|
-
|
3
|
-
<%= form_tag spree.admin_promotion_promotion_rules_path(@promotion), remote: true, id: 'new_product_rule_form' do %>
|
4
|
-
<fieldset>
|
5
|
-
<legend align="center"><%= t('spree.rules') %></legend>
|
6
|
-
|
7
|
-
<% if can?(:update, @promotion) %>
|
8
|
-
<div class="field">
|
9
|
-
<%= label_tag :promotion_rule_type, t('spree.discount_rules') %>
|
10
|
-
<%= select_tag('promotion_rule[type]', options_for_promotion_rule_types(@promotion), include_blank: t(:choose_promotion_rule, scope: 'spree'), class: 'custom-select fullwidth', required: true) %>
|
11
|
-
</div>
|
12
|
-
<div class="filter-actions actions">
|
13
|
-
<%= button_tag t('spree.actions.add'), class: 'btn btn-primary' %>
|
14
|
-
</div>
|
15
|
-
<% end %>
|
16
|
-
</fieldset>
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<%= form_for @promotion, url: object_url, method: :put do |f| %>
|
20
|
-
<fieldset class="no-border-top">
|
21
|
-
<div id="rules" class="filter_list">
|
22
|
-
<% if @promotion.rules.any? %>
|
23
|
-
<div class="col-12">
|
24
|
-
<div class="row">
|
25
|
-
<%= render partial: 'promotion_rule', collection: @promotion.rules, locals: {} %>
|
26
|
-
</div>
|
27
|
-
</div>
|
28
|
-
<% else %>
|
29
|
-
<div class="no-objects-found">
|
30
|
-
<%= t('spree.no_rules_added') %>
|
31
|
-
</div>
|
32
|
-
<% end %>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<% if can?(:update, @promotion) %>
|
36
|
-
<div class="promotion-update filter-actions actions">
|
37
|
-
<%= button_tag t('spree.actions.update'), class: 'btn btn-primary' %>
|
38
|
-
</div>
|
39
|
-
<% end %>
|
40
|
-
</fieldset>
|
41
|
-
<% end %>
|
42
|
-
</fieldset>
|
@@ -1,10 +0,0 @@
|
|
1
|
-
<div class="field">
|
2
|
-
<% field_name = "#{param_prefix}[preferred_group_size]" %>
|
3
|
-
<%= label_tag field_name, t('spree.group_size') %>
|
4
|
-
<%= number_field_tag field_name, promotion_action.preferred_group_size, class: "fullwidth", min: 1 %>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<%= render "spree/admin/promotions/actions/promotion_calculators_with_custom_fields",
|
8
|
-
calculators: Rails.application.config.spree.calculators.promotion_actions_create_quantity_adjustments,
|
9
|
-
promotion_action: promotion_action,
|
10
|
-
param_prefix: param_prefix %>
|
File without changes
|
data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
<div class="calculator-fields js-calculator-fields row">
|
2
|
-
<div class="col-6">
|
3
|
-
<div class="field">
|
4
|
-
<% field_name = "#{param_prefix}[calculator_type]" %>
|
5
|
-
<%= label_tag field_name, t('spree.admin.promotions.actions.calculator_label') %>
|
6
|
-
<%= select_tag field_name,
|
7
|
-
options_from_collection_for_select(calculators, :to_s, :description, promotion_action.calculator.type),
|
8
|
-
class: 'type-select js-calculator-type custom-select fullwidth' %>
|
9
|
-
</div>
|
10
|
-
</div>
|
11
|
-
<div class="col-6">
|
12
|
-
<div class="settings">
|
13
|
-
<% calculators.each do |calculator_class| %>
|
14
|
-
<% calculator = promotion_action.calculator.class == calculator_class ? promotion_action.calculator : calculator_class.new %>
|
15
|
-
<div class="js-calculator-preferences" data-calculator-type="<%= calculator_class %>">
|
16
|
-
<% type_name = calculator.type.demodulize.underscore %>
|
17
|
-
<% if lookup_context.exists?("fields",
|
18
|
-
["spree/admin/promotions/calculators/#{type_name}"], true) %>
|
19
|
-
<%= render "spree/admin/promotions/calculators/#{type_name}/fields",
|
20
|
-
calculator: calculator, prefix: param_prefix %>
|
21
|
-
<% else %>
|
22
|
-
<%= render "spree/admin/promotions/calculators/default_fields",
|
23
|
-
calculator: calculator, prefix: param_prefix %>
|
24
|
-
<% end %>
|
25
|
-
</div>
|
26
|
-
<% end %>
|
27
|
-
</div>
|
28
|
-
</div>
|
29
|
-
</div>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<% calculator.admin_form_preference_names.map do |name| %>
|
2
|
-
<%= render "spree/admin/shared/preference_fields/#{calculator.preference_type(name)}",
|
3
|
-
name: "#{prefix}[calculator_attributes][preferred_#{name}]",
|
4
|
-
value: calculator.get_preference(name),
|
5
|
-
label: t(name.to_s, scope: 'spree', default: name.to_s.humanize) %>
|
6
|
-
<% end %>
|
@@ -1,56 +0,0 @@
|
|
1
|
-
<div class="field">
|
2
|
-
<%= fields_for "#{prefix}[calculator_attributes]", calculator do |f| %>
|
3
|
-
<%= f.label :preferred_amount %>
|
4
|
-
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %>
|
5
|
-
<% end %>
|
6
|
-
</div>
|
7
|
-
|
8
|
-
<div class="field">
|
9
|
-
<p>
|
10
|
-
<%= admin_hint(
|
11
|
-
calculator.model_name.human,
|
12
|
-
"""
|
13
|
-
<p>
|
14
|
-
This amount will be distributed to line items weighted relative to
|
15
|
-
their price. More expensive line items will receive a greater share
|
16
|
-
of the adjustment.
|
17
|
-
</p>
|
18
|
-
|
19
|
-
<p>
|
20
|
-
For example, with three line items and a preferred amount of $15 we
|
21
|
-
would end up with the following distribution:
|
22
|
-
</p>
|
23
|
-
|
24
|
-
<table>
|
25
|
-
<thead>
|
26
|
-
<tr>
|
27
|
-
<th></th>
|
28
|
-
<th>Price</th>
|
29
|
-
<th>Weighted Adj.</th>
|
30
|
-
</tr>
|
31
|
-
</thead>
|
32
|
-
<tbody>
|
33
|
-
<tr>
|
34
|
-
<td>Socks</td>
|
35
|
-
<td>$5</td>
|
36
|
-
<td>-$1.5</td>
|
37
|
-
</tr>
|
38
|
-
<tr>
|
39
|
-
<td>Shoes</td>
|
40
|
-
<td>$30</td>
|
41
|
-
<td>-$9</td>
|
42
|
-
</tr>
|
43
|
-
<tr>
|
44
|
-
<td>Slippers</td>
|
45
|
-
<td>$15</td>
|
46
|
-
<td>-$4.5</td>
|
47
|
-
</tr>
|
48
|
-
</tbody>
|
49
|
-
</table>
|
50
|
-
"""
|
51
|
-
) %>
|
52
|
-
|
53
|
-
This amount will be the <strong>total</strong> discount spread amongst all
|
54
|
-
of the line items.
|
55
|
-
</p>
|
56
|
-
</div>
|
@@ -1,6 +0,0 @@
|
|
1
|
-
<div class="field">
|
2
|
-
<%= fields_for "#{prefix}[calculator_attributes]", calculator do |f| %>
|
3
|
-
<%= f.label :preferred_amount %>
|
4
|
-
<%= render "spree/admin/shared/number_with_currency", f: f, amount_attr: :preferred_amount, currency_attr: :preferred_currency %>
|
5
|
-
<% end %>
|
6
|
-
</div>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<%= render "spree/admin/shared/preference_fields/#{calculator.preference_type(:base_amount)}",
|
2
|
-
name: "#{prefix}[calculator_attributes][preferred_base_amount]",
|
3
|
-
value: calculator.preferred_base_amount, label: t('spree.base_amount') %>
|
4
|
-
|
5
|
-
<div class="field">
|
6
|
-
<%= label_tag(
|
7
|
-
"#{prefix}[calculator_attributes][preferred_currency]",
|
8
|
-
t('spree.currency')
|
9
|
-
) %>
|
10
|
-
<%= select_tag(
|
11
|
-
"#{prefix}[calculator_attributes][preferred_currency]",
|
12
|
-
options_for_select(
|
13
|
-
Spree::Config.available_currencies,
|
14
|
-
calculator.preferred_currency || Spree::Config[:currency]
|
15
|
-
),
|
16
|
-
{ class: 'custom-select fullwidth' }
|
17
|
-
) %>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div class="field">
|
21
|
-
<%= label_tag nil, t('spree.tiers') %>
|
22
|
-
<div class="js-tiered-calculator">
|
23
|
-
<%= content_tag :div, nil, class: "js-tiers", data: {
|
24
|
-
'original-tiers' => Hash[calculator.preferred_tiers.sort],
|
25
|
-
'form-prefix' => prefix,
|
26
|
-
'calculator' => 'tiered_flat_rate'
|
27
|
-
} %>
|
28
|
-
<a class="button js-add-tier"><%= t('spree.actions.add') %></a>
|
29
|
-
</div>
|
30
|
-
</div>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
<%= render "spree/admin/shared/preference_fields/#{calculator.preference_type(:base_percent)}",
|
2
|
-
name: "#{prefix}[calculator_attributes][preferred_base_percent]",
|
3
|
-
value: calculator.preferred_base_percent, label: t('spree.base_percent') %>
|
4
|
-
|
5
|
-
<div class="field">
|
6
|
-
<%= label_tag(
|
7
|
-
"#{prefix}[calculator_attributes][preferred_currency]",
|
8
|
-
t('spree.currency')
|
9
|
-
) %>
|
10
|
-
<%= select_tag(
|
11
|
-
"#{prefix}[calculator_attributes][preferred_currency]",
|
12
|
-
options_for_select(
|
13
|
-
Spree::Config.available_currencies,
|
14
|
-
calculator.preferred_currency || Spree::Config[:currency]
|
15
|
-
),
|
16
|
-
{ class: 'custom-select fullwidth' }
|
17
|
-
) %>
|
18
|
-
</div>
|
19
|
-
|
20
|
-
<div class="field">
|
21
|
-
<%= label_tag nil, t('spree.tiers') %>
|
22
|
-
<div class="js-tiered-calculator">
|
23
|
-
<%= content_tag :div, nil, class: "js-tiers", data: {
|
24
|
-
'original-tiers' => Hash[calculator.preferred_tiers.sort],
|
25
|
-
'form-prefix' => prefix,
|
26
|
-
'calculator' => 'tiered_percent'
|
27
|
-
} %>
|
28
|
-
<a class="button js-add-tier"><%= t('spree.actions.add') %></a>
|
29
|
-
</div>
|
30
|
-
</div>
|
@@ -1,35 +0,0 @@
|
|
1
|
-
<% admin_layout "full-width" %>
|
2
|
-
|
3
|
-
<% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
|
4
|
-
<% admin_breadcrumb(@promotion.name) %>
|
5
|
-
|
6
|
-
<% content_for :page_actions do %>
|
7
|
-
<li>
|
8
|
-
<% if can?(:show, Spree::PromotionCode) %>
|
9
|
-
<%= link_to t('spree.view_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id), class: 'btn btn-primary' %>
|
10
|
-
|
11
|
-
<%= link_to t('spree.download_promotion_codes_list'), admin_promotion_promotion_codes_path(promotion_id: @promotion.id, format: :csv), class: 'btn btn-primary' %>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<% if can?(:show, Spree::PromotionCodeBatch) %>
|
15
|
-
<%= link_to plural_resource_name(Spree::PromotionCodeBatch), admin_promotion_promotion_code_batches_path(promotion_id: @promotion.id), class: 'btn btn-primary' %>
|
16
|
-
<% end %>
|
17
|
-
</li>
|
18
|
-
<% end %>
|
19
|
-
|
20
|
-
<%= form_for @promotion, url: object_url, method: :put do |f| %>
|
21
|
-
<%= render partial: 'form', locals: { f: f } %>
|
22
|
-
<% if can?(:update, @promotion) %>
|
23
|
-
<%= render partial: 'spree/admin/shared/edit_resource_links' %>
|
24
|
-
<% end %>
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<div id="promotion-filters" class="row">
|
28
|
-
<div id="rules_container" class="col-6">
|
29
|
-
<%= render partial: 'rules' %>
|
30
|
-
</div>
|
31
|
-
|
32
|
-
<div id="actions_container" class="col-6">
|
33
|
-
<%= render partial: 'actions' %>
|
34
|
-
</div>
|
35
|
-
</div>
|