solidus_backend 4.3.5 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spree/backend/namespaces.js +0 -1
  3. data/app/assets/javascripts/spree/backend/templates/index.js +0 -3
  4. data/app/assets/javascripts/spree/backend/variant_autocomplete.js +11 -8
  5. data/app/assets/javascripts/spree/backend/views/cart/empty_cart_button.js +1 -1
  6. data/app/assets/javascripts/spree/backend/views/index.js +0 -2
  7. data/app/assets/javascripts/spree/backend/views/order/details_adjustments.js +1 -2
  8. data/app/assets/javascripts/spree/backend.js +0 -2
  9. data/app/assets/stylesheets/spree/backend/sections/_adjustments.scss +0 -3
  10. data/app/assets/stylesheets/spree/backend/sections/index.scss +0 -1
  11. data/app/controllers/spree/admin/cancellations_controller.rb +1 -1
  12. data/app/controllers/spree/admin/dashboards_controller.rb +4 -0
  13. data/app/controllers/spree/admin/option_types_controller.rb +1 -1
  14. data/app/controllers/spree/admin/orders/customer_details_controller.rb +2 -2
  15. data/app/controllers/spree/admin/resource_controller.rb +1 -1
  16. data/app/helpers/spree/admin/base_helper.rb +2 -2
  17. data/app/helpers/spree/admin/navigation_helper.rb +1 -1
  18. data/app/views/spree/admin/adjustments/_adjustment.html.erb +0 -1
  19. data/app/views/spree/admin/dashboards/home.html.erb +1 -0
  20. data/app/views/spree/admin/orders/_adjustments.html.erb +1 -1
  21. data/app/views/spree/admin/orders/_order_details.html.erb +3 -3
  22. data/app/views/spree/admin/orders/confirm.html.erb +3 -3
  23. data/app/views/spree/admin/orders/index.html.erb +4 -82
  24. data/app/views/spree/admin/products/index.html.erb +2 -2
  25. data/app/views/spree/admin/shared/_locale_selection_solidus_admin.html.erb +1 -1
  26. data/app/views/spree/admin/shared/search_fields/_checkbox.html.erb +8 -0
  27. data/app/views/spree/admin/shared/search_fields/_date_range_picker.html.erb +16 -0
  28. data/app/views/spree/admin/shared/search_fields/_select.html.erb +6 -0
  29. data/app/views/spree/admin/shared/search_fields/_text_field.html.erb +6 -0
  30. data/app/views/spree/admin/shared/search_fields/_variant_autocomplete.html.erb +6 -0
  31. data/app/views/spree/admin/tax_rates/index.html.erb +1 -1
  32. data/app/views/spree/admin/users/index.html.erb +1 -1
  33. data/app/views/spree/admin/users/items.html.erb +3 -3
  34. data/app/views/spree/admin/users/orders.html.erb +3 -3
  35. data/app/views/spree/admin/variants/_form.html.erb +1 -1
  36. data/app/views/spree/admin/zones/index.html.erb +1 -1
  37. data/config/routes.rb +0 -11
  38. data/lib/spree/backend_configuration.rb +83 -18
  39. data/solidus_backend.gemspec +2 -2
  40. metadata +13 -73
  41. data/app/assets/javascripts/spree/backend/promotions/activation.js +0 -26
  42. data/app/assets/javascripts/spree/backend/promotions.js +0 -35
  43. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_flat_rate.hbs +0 -23
  44. data/app/assets/javascripts/spree/backend/templates/promotions/calculators/fields/tiered_percent.hbs +0 -23
  45. data/app/assets/javascripts/spree/backend/templates/promotions/rules/option_values.hbs +0 -12
  46. data/app/assets/javascripts/spree/backend/views/calculators/tiered.js +0 -54
  47. data/app/assets/javascripts/spree/backend/views/promotions/option_values_rule.js +0 -79
  48. data/app/assets/stylesheets/spree/backend/sections/_promotions.scss +0 -138
  49. data/app/controllers/spree/admin/promotion_actions_controller.rb +0 -51
  50. data/app/controllers/spree/admin/promotion_categories_controller.rb +0 -8
  51. data/app/controllers/spree/admin/promotion_code_batches_controller.rb +0 -30
  52. data/app/controllers/spree/admin/promotion_codes_controller.rb +0 -48
  53. data/app/controllers/spree/admin/promotion_rules_controller.rb +0 -60
  54. data/app/controllers/spree/admin/promotions_controller.rb +0 -67
  55. data/app/helpers/spree/admin/promotions_helper.rb +0 -15
  56. data/app/helpers/spree/promotion_rules_helper.rb +0 -12
  57. data/app/views/spree/admin/promotion_actions/create.js.erb +0 -10
  58. data/app/views/spree/admin/promotion_actions/destroy.js.erb +0 -1
  59. data/app/views/spree/admin/promotion_categories/_form.html.erb +0 -14
  60. data/app/views/spree/admin/promotion_categories/edit.html.erb +0 -10
  61. data/app/views/spree/admin/promotion_categories/index.html.erb +0 -47
  62. data/app/views/spree/admin/promotion_categories/new.html.erb +0 -10
  63. data/app/views/spree/admin/promotion_code_batches/_form_fields.html.erb +0 -22
  64. data/app/views/spree/admin/promotion_code_batches/download.csv.ruby +0 -8
  65. data/app/views/spree/admin/promotion_code_batches/index.html.erb +0 -65
  66. data/app/views/spree/admin/promotion_code_batches/new.html.erb +0 -8
  67. data/app/views/spree/admin/promotion_codes/index.csv.ruby +0 -8
  68. data/app/views/spree/admin/promotion_codes/index.html.erb +0 -32
  69. data/app/views/spree/admin/promotion_codes/new.html.erb +0 -31
  70. data/app/views/spree/admin/promotion_rules/create.js.erb +0 -8
  71. data/app/views/spree/admin/promotion_rules/destroy.js.erb +0 -3
  72. data/app/views/spree/admin/promotions/_actions.html.erb +0 -37
  73. data/app/views/spree/admin/promotions/_activations_edit.html.erb +0 -22
  74. data/app/views/spree/admin/promotions/_activations_new.html.erb +0 -43
  75. data/app/views/spree/admin/promotions/_form.html.erb +0 -67
  76. data/app/views/spree/admin/promotions/_promotion_action.html.erb +0 -13
  77. data/app/views/spree/admin/promotions/_promotion_rule.html.erb +0 -12
  78. data/app/views/spree/admin/promotions/_rules.html.erb +0 -42
  79. data/app/views/spree/admin/promotions/actions/_create_adjustment.html.erb +0 -2
  80. data/app/views/spree/admin/promotions/actions/_create_item_adjustments.html.erb +0 -6
  81. data/app/views/spree/admin/promotions/actions/_create_quantity_adjustments.html.erb +0 -10
  82. data/app/views/spree/admin/promotions/actions/_free_shipping.html.erb +0 -0
  83. data/app/views/spree/admin/promotions/actions/_promotion_calculators_with_custom_fields.html.erb +0 -29
  84. data/app/views/spree/admin/promotions/calculators/_default_fields.html.erb +0 -6
  85. data/app/views/spree/admin/promotions/calculators/distributed_amount/_fields.html.erb +0 -56
  86. data/app/views/spree/admin/promotions/calculators/flat_rate/_fields.html.erb +0 -6
  87. data/app/views/spree/admin/promotions/calculators/tiered_flat_rate/_fields.html.erb +0 -30
  88. data/app/views/spree/admin/promotions/calculators/tiered_percent/_fields.html.erb +0 -30
  89. data/app/views/spree/admin/promotions/edit.html.erb +0 -35
  90. data/app/views/spree/admin/promotions/index.html.erb +0 -124
  91. data/app/views/spree/admin/promotions/new.html.erb +0 -9
  92. data/app/views/spree/admin/promotions/rules/_first_order.html.erb +0 -0
  93. data/app/views/spree/admin/promotions/rules/_first_repeat_purchase_since.html.erb +0 -13
  94. data/app/views/spree/admin/promotions/rules/_item_total.html.erb +0 -14
  95. data/app/views/spree/admin/promotions/rules/_minimum_quantity.html.erb +0 -5
  96. data/app/views/spree/admin/promotions/rules/_nth_order.html.erb +0 -12
  97. data/app/views/spree/admin/promotions/rules/_one_use_per_user.html.erb +0 -0
  98. data/app/views/spree/admin/promotions/rules/_option_value.html.erb +0 -13
  99. data/app/views/spree/admin/promotions/rules/_product.html.erb +0 -15
  100. data/app/views/spree/admin/promotions/rules/_store.html.erb +0 -6
  101. data/app/views/spree/admin/promotions/rules/_taxon.html.erb +0 -9
  102. data/app/views/spree/admin/promotions/rules/_user.html.erb +0 -4
  103. data/app/views/spree/admin/promotions/rules/_user_logged_in.html.erb +0 -0
  104. data/app/views/spree/admin/promotions/rules/_user_role.html.erb +0 -12
  105. data/bin/rails +0 -13
@@ -1,138 +0,0 @@
1
- #general_fields, #expiry_fields {
2
- border-bottom: none;
3
- margin-bottom: 0;
4
- padding-bottom: 0;
5
- }
6
-
7
- #rules_container, #actions_container {
8
- position: relative;
9
-
10
- fieldset {
11
- position: static !important;
12
- }
13
- }
14
-
15
- .promotion-block {
16
- padding: 0 1.25rem 0.5rem;
17
- background-color: lighten($color-border, 5);
18
- border: 1px solid $color-border;
19
- border-radius: 3px;
20
- margin-bottom: 15px;
21
- position: relative;
22
-
23
- .row {
24
- margin-bottom: 0;
25
- }
26
-
27
- // Fix the padding added by the .fa icon rule
28
- .fa:before {
29
- padding-right: 0;
30
- }
31
-
32
- .promo-rule-option-value {
33
- position: relative;
34
- padding-bottom: 10px;
35
-
36
- .remove {
37
- cursor: pointer;
38
- position: absolute;
39
- right: 0;
40
- top: 10px;
41
-
42
- &:hover {
43
- color: $color-red;
44
- }
45
- }
46
- }
47
-
48
- .tier {
49
- position: relative;
50
- padding-bottom: 10px;
51
-
52
- > .row {
53
- margin-left: 10px;
54
- }
55
-
56
- .remove {
57
- position: absolute;
58
- cursor: pointer;
59
- left: 0;
60
- top: 10px;
61
-
62
- &:hover {
63
- color: $color-red;
64
- }
65
- }
66
- }
67
-
68
- .right-align {
69
- text-align: right;
70
- }
71
-
72
- .calculator-fields {
73
- padding-bottom: 10px;
74
- }
75
-
76
- .field {
77
- &.alpha {
78
- margin-left: -1px;
79
- padding-left: 11px;
80
- }
81
-
82
- &.omega {
83
- margin-right: -1px;
84
- padding-right: 11px;
85
- }
86
- }
87
-
88
- &.action-remove {
89
- background-color: lighten($color-red, 50);
90
- border-color: lighten($color-red, 45);
91
- text-decoration: line-through;
92
-
93
- .promotion-title, input[type="text"], input[type="number"],
94
- .token-input-list {
95
- border-color: lighten($color-red, 45);
96
- }
97
- }
98
-
99
- .add-line-item {
100
- #add_quantity {
101
- width: 50px;
102
- margin-top: 15px;
103
- }
104
- button.add {
105
- min-width: 80px;
106
- margin-top: 30px;
107
-
108
- &:before {
109
- padding-right: 5px;
110
- }
111
- }
112
- }
113
-
114
- a.delete {
115
- position: absolute;
116
- top: 1.25rem;
117
- right: 1.25rem;
118
- cursor: pointer;
119
-
120
- &:hover {
121
- color: theme-color("danger");
122
- }
123
- }
124
- }
125
-
126
- .promotion-title {
127
- text-align: left;
128
- font-size: 1rem;
129
- border-bottom: 1px solid $color-border;
130
- padding: 0.75rem 0;
131
- margin-bottom: 0.75rem;
132
-
133
- &.no-text {
134
- border: none;
135
- padding-bottom: 0;
136
- margin-bottom: 0.25rem;
137
- }
138
- }
@@ -1,51 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Spree::Admin::PromotionActionsController < Spree::Admin::BaseController
4
- before_action :load_promotion, only: [:create, :destroy]
5
- before_action :validate_promotion_action_type, only: :create
6
-
7
- def create
8
- @calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
9
- @promotion_action = @promotion_action_type.new(params[:promotion_action])
10
- @promotion_action.promotion = @promotion
11
- if @promotion_action.save
12
- flash[:success] = t('spree.successfully_created', resource: t('spree.promotion_action'))
13
- end
14
- respond_to do |format|
15
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
16
- format.js { render layout: false }
17
- end
18
- end
19
-
20
- def destroy
21
- @promotion_action = @promotion.promotion_actions.find(params[:id])
22
- if @promotion_action.discard
23
- flash[:success] = t('spree.successfully_removed', resource: t('spree.promotion_action'))
24
- end
25
- respond_to do |format|
26
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
27
- format.js { render layout: false }
28
- end
29
- end
30
-
31
- private
32
-
33
- def load_promotion
34
- @promotion = Spree::Promotion.find(params[:promotion_id])
35
- end
36
-
37
- def validate_promotion_action_type
38
- requested_type = params[:action_type]
39
- promotion_action_types = Rails.application.config.spree.promotions.actions
40
- @promotion_action_type = promotion_action_types.detect do |klass|
41
- klass.name == requested_type
42
- end
43
- if !@promotion_action_type
44
- flash[:error] = t('spree.invalid_promotion_action')
45
- respond_to do |format|
46
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
47
- format.js { render layout: false }
48
- end
49
- end
50
- end
51
- end
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module Admin
5
- class PromotionCategoriesController < ResourceController
6
- end
7
- end
8
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module Admin
5
- class PromotionCodeBatchesController < ResourceController
6
- belongs_to 'spree/promotion'
7
-
8
- create.after :build_promotion_code_batch
9
-
10
- def download
11
- require "csv"
12
-
13
- @promotion_code_batch = Spree::PromotionCodeBatch.find(
14
- params[:promotion_code_batch_id]
15
- )
16
-
17
- send_data(
18
- render_to_string,
19
- filename: "promotion-code-batch-list-#{@promotion_code_batch.id}.csv"
20
- )
21
- end
22
-
23
- private
24
-
25
- def build_promotion_code_batch
26
- @promotion_code_batch.process
27
- end
28
- end
29
- end
30
- end
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'csv'
4
-
5
- module Spree
6
- module Admin
7
- class PromotionCodesController < Spree::Admin::ResourceController
8
- def index
9
- @promotion = Spree::Promotion.accessible_by(current_ability, :show).find(params[:promotion_id])
10
- @promotion_codes = @promotion.promotion_codes.order(:value)
11
-
12
- respond_to do |format|
13
- format.html do
14
- @promotion_codes = @promotion_codes.page(params[:page]).per(50)
15
- end
16
- format.csv do
17
- filename = "promotion-code-list-#{@promotion.id}.csv"
18
- headers["Content-Type"] = "text/csv"
19
- headers["Content-disposition"] = "attachment; filename=\"#{filename}\""
20
- end
21
- end
22
- end
23
-
24
- def new
25
- @promotion = Spree::Promotion.accessible_by(current_ability, :show).find(params[:promotion_id])
26
- if @promotion.apply_automatically
27
- flash[:error] = t('activerecord.errors.models.spree/promotion_code.attributes.base.disallowed_with_apply_automatically')
28
- redirect_to admin_promotion_promotion_codes_url(@promotion)
29
- else
30
- @promotion_code = @promotion.promotion_codes.build
31
- end
32
- end
33
-
34
- def create
35
- @promotion = Spree::Promotion.accessible_by(current_ability, :show).find(params[:promotion_id])
36
- @promotion_code = @promotion.promotion_codes.build(value: params[:promotion_code][:value])
37
-
38
- if @promotion_code.save
39
- flash[:success] = flash_message_for(@promotion_code, :successfully_created)
40
- redirect_to admin_promotion_promotion_codes_url(@promotion)
41
- else
42
- flash.now[:error] = @promotion_code.errors.full_messages.to_sentence
43
- render_after_create_error
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Spree::Admin::PromotionRulesController < Spree::Admin::BaseController
4
- helper 'spree/promotion_rules'
5
-
6
- before_action :load_promotion, only: [:create, :destroy]
7
- before_action :validate_promotion_rule_type, only: :create
8
-
9
- def create
10
- @promotion_rule = @promotion_rule_type.new(promotion_rule_params)
11
- @promotion_rule.promotion = @promotion
12
- if @promotion_rule.save
13
- flash[:success] = t('spree.successfully_created', resource: t('spree.promotion_rule'))
14
- end
15
- respond_to do |format|
16
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
17
- format.js { render layout: false }
18
- end
19
- end
20
-
21
- def destroy
22
- @promotion_rule = @promotion.promotion_rules.find(params[:id])
23
- if @promotion_rule.destroy
24
- flash[:success] = t('spree.successfully_removed', resource: t('spree.promotion_rule'))
25
- end
26
- respond_to do |format|
27
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
28
- format.js { render layout: false }
29
- end
30
- end
31
-
32
- private
33
-
34
- def load_promotion
35
- @promotion = Spree::Promotion.find(params[:promotion_id])
36
- end
37
-
38
- def model_class
39
- Spree::PromotionRule
40
- end
41
-
42
- def validate_promotion_rule_type
43
- requested_type = params[:promotion_rule].delete(:type)
44
- promotion_rule_types = Rails.application.config.spree.promotions.rules
45
- @promotion_rule_type = promotion_rule_types.detect do |klass|
46
- klass.name == requested_type
47
- end
48
- if !@promotion_rule_type
49
- flash[:error] = t('spree.invalid_promotion_rule')
50
- respond_to do |format|
51
- format.html { redirect_to spree.edit_admin_promotion_path(@promotion) }
52
- format.js { render layout: false }
53
- end
54
- end
55
- end
56
-
57
- def promotion_rule_params
58
- params[:promotion_rule].permit!
59
- end
60
- end
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module Admin
5
- class PromotionsController < ResourceController
6
- before_action :load_data
7
-
8
- helper 'spree/promotion_rules'
9
-
10
- def show
11
- redirect_to action: :edit
12
- end
13
-
14
- def create
15
- @promotion = Spree::Promotion.new(permitted_resource_params)
16
- @promotion.codes.new(value: params[:single_code]) if params[:single_code].present?
17
-
18
- if params[:promotion_code_batch]
19
- @promotion_code_batch = @promotion.promotion_code_batches.new(promotion_code_batch_params)
20
- end
21
-
22
- if @promotion.save
23
- @promotion_code_batch.process if @promotion_code_batch
24
- flash[:success] = t('spree.promotion_successfully_created')
25
- redirect_to location_after_save
26
- else
27
- flash[:error] = @promotion.errors.full_messages.to_sentence
28
- render action: 'new'
29
- end
30
- end
31
-
32
- private
33
-
34
- def location_after_save
35
- spree.edit_admin_promotion_url(@promotion)
36
- end
37
-
38
- def load_data
39
- @calculators = Rails.application.config.spree.calculators.promotion_actions_create_adjustments
40
- @promotion_categories = Spree::PromotionCategory.order(:name)
41
- end
42
-
43
- def collection
44
- return @collection if @collection
45
- params[:q] ||= HashWithIndifferentAccess.new
46
- params[:q][:s] ||= 'id desc'
47
-
48
- @collection = super
49
- @search = @collection.ransack(params[:q])
50
- @collection = @search.result(distinct: true).
51
- includes(promotion_includes).
52
- page(params[:page]).
53
- per(params[:per_page] || Spree::Config[:promotions_per_page])
54
-
55
- @collection
56
- end
57
-
58
- def promotion_code_batch_params
59
- params.require(:promotion_code_batch).permit!
60
- end
61
-
62
- def promotion_includes
63
- [:promotion_actions]
64
- end
65
- end
66
- end
67
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module Admin
5
- module PromotionsHelper
6
- def admin_promotion_status(promotion)
7
- return :active if promotion.active?
8
- return :not_started if promotion.not_started?
9
- return :expired if promotion.expired?
10
-
11
- :inactive
12
- end
13
- end
14
- end
15
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Spree
4
- module PromotionRulesHelper
5
- def options_for_promotion_rule_types(promotion)
6
- existing = promotion.rules.map { |rule| rule.class.name }
7
- rules = Rails.application.config.spree.promotions.rules.reject { |rule| existing.include? rule.name }
8
- options = rules.map { |rule| [rule.model_name.human, rule.name] }
9
- options_for_select(options)
10
- end
11
- end
12
- end
@@ -1,10 +0,0 @@
1
- $('#actions').append('<%= escape_javascript( render(partial: 'spree/admin/promotions/promotion_action', object: @promotion_action) ) %>');
2
- $('#actions .no-objects-found').hide();
3
- $(".variant_autocomplete").variantAutocomplete();
4
-
5
- initPromotionActions();
6
-
7
-
8
- $('#<%= dom_id @promotion_action %>').hide();
9
- $('#<%= dom_id @promotion_action %>').fadeIn();
10
- new Spree.CalculatorEditView({el: $('#<%= dom_id @promotion_action %> .js-calculator-fields')});
@@ -1 +0,0 @@
1
- $('#<%= dom_id @promotion_action %>').fadeOut().remove();
@@ -1,14 +0,0 @@
1
- <%= render partial: 'spree/shared/error_messages', locals: { target: @promotion_category } %>
2
-
3
- <div class='row'>
4
- <div class='col-4'>
5
- <%= f.field_container :name do %>
6
- <%= f.label :name %>
7
- <%= f.text_field :name, class: 'fullwidth' %>
8
- <% end %>
9
- <%= f.field_container :code do %>
10
- <%= f.label :code %>
11
- <%= f.text_field :code, class: 'fullwidth' %>
12
- <% end %>
13
- </div>
14
- </div>
@@ -1,10 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
2
- <% admin_breadcrumb(link_to plural_resource_name(Spree::PromotionCategory), spree.admin_promotion_categories_path) %>
3
- <% admin_breadcrumb(@promotion_category.name) %>
4
-
5
- <%= form_for @promotion_category, url: object_url, method: :put do |f| %>
6
- <fieldset class="no-border-top">
7
- <%= render partial: 'form', locals: { f: f } %>
8
- <%= render partial: 'spree/admin/shared/edit_resource_links' %>
9
- </fieldset>
10
- <% end %>
@@ -1,47 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
2
- <% admin_breadcrumb(plural_resource_name(Spree::PromotionCategory)) %>
3
-
4
- <% content_for :page_actions do %>
5
- <% if can?(:create, Spree::PromotionCategory) %>
6
- <li>
7
- <%= link_to t('spree.new_promotion_category'), spree.new_admin_promotion_category_path, class: 'btn btn-primary' %>
8
- </li>
9
- <% end %>
10
- <% end %>
11
-
12
- <% if @promotion_categories.any? %>
13
- <table class="index">
14
- <colgroup>
15
- <col style="width: 40%">
16
- <col style="width: 40%">
17
- <col style="width: 20%">
18
- </colgroup>
19
- <thead>
20
- <th><%= Spree::PromotionCategory.human_attribute_name :name %></th>
21
- <th><%= Spree::PromotionCategory.human_attribute_name :code %></th>
22
- <th class='actions'></th>
23
- </thead>
24
- <tbody>
25
- <% @promotion_categories.each do |promotion_category| %>
26
- <tr>
27
- <td><%= promotion_category.name %></td>
28
- <td><%= promotion_category.code %></td>
29
- <td class="actions">
30
- <% if can?(:update, promotion_category) %>
31
- <%= link_to_edit promotion_category, no_text: true %>
32
- <% end %>
33
- <% if can?(:destroy, promotion_category) %>
34
- <%= link_to_delete promotion_category, no_text: true %>
35
- <% end %>
36
- </td>
37
- </tr>
38
- <% end %>
39
- </tbody>
40
- </table>
41
- <% else %>
42
- <div class="no-objects-found">
43
- <%= render 'spree/admin/shared/no_objects_found',
44
- resource: Spree::PromotionCategory,
45
- new_resource_url: new_object_url %>
46
- </div>
47
- <% end %>
@@ -1,10 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
2
- <% admin_breadcrumb(link_to plural_resource_name(Spree::PromotionCategory), spree.admin_promotion_categories_path) %>
3
- <% admin_breadcrumb(t('spree.new_promotion_category')) %>
4
-
5
- <%= form_for :promotion_category, url: collection_url do |f| %>
6
- <fieldset class="no-border-top">
7
- <%= render partial: 'form', locals: { f: f } %>
8
- <%= render partial: 'spree/admin/shared/new_resource_links' %>
9
- </fieldset>
10
- <% end %>
@@ -1,22 +0,0 @@
1
- <div class="field">
2
- <%= batch.label :base_code, class: "required" %>
3
- <%= batch.text_field :base_code, class: "fullwidth", required: true %>
4
- </div>
5
- <div class="field">
6
- <%= batch.label :number_of_codes, class: "required" %>
7
- <%= batch.number_field :number_of_codes, class: "fullwidth", min: 1, required: true %>
8
- </div>
9
- <div class="field">
10
- <%= batch.label :join_characters %>
11
- <%= batch.text_field :join_characters, class: "fullwidth" %>
12
- </div>
13
- <% unless promotion_id %>
14
- <div class="field">
15
- <%= f.label :per_code_usage_limit %>
16
- <%= f.text_field :per_code_usage_limit, class: "fullwidth" %>
17
- </div>
18
- <% end %>
19
- <div class="field">
20
- <%= batch.label :email %>
21
- <%= batch.text_field :email, class: "fullwidth" %>
22
- </div>
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- CSV.generate do |csv|
4
- csv << ['Code']
5
- @promotion_code_batch.promotion_codes.order(:id).pluck(:value).each do |value|
6
- csv << [value]
7
- end
8
- end
@@ -1,65 +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.id)) %>
3
- <% admin_breadcrumb(plural_resource_name(Spree::PromotionCodeBatch)) %>
4
-
5
- <% content_for :page_actions do %>
6
- <li>
7
- <% if can?(:create, Spree::PromotionCodeBatch) %>
8
- <%= link_to t('spree.new_promotion_code_batch'), new_object_url, class: 'btn btn-primary' %>
9
- <% end %>
10
- </li>
11
- <% end %>
12
-
13
- <% if @promotion_code_batches.any? %>
14
- <table>
15
- <thead>
16
- <tr>
17
- <th><%= Spree::PromotionCodeBatch.human_attribute_name(:base_code) %></th>
18
- <th><%= Spree::PromotionCodeBatch.human_attribute_name(:total_codes) %></th>
19
- <th><%= Spree::PromotionCodeBatch.human_attribute_name(:status) %></th>
20
- <th><%= Spree::PromotionCodeBatch.human_attribute_name(:email) %></th>
21
- </tr>
22
- </thead>
23
- <tbody>
24
- <% @promotion_code_batches.each do |promotion_code_batch| %>
25
- <tr>
26
- <td><%= promotion_code_batch.base_code %></td>
27
- <td><%= promotion_code_batch.number_of_codes %></td>
28
- <td>
29
- <% if promotion_code_batch.error.present? %>
30
- <%= t(
31
- "spree.promotion_code_batches.errored",
32
- error: promotion_code_batch.error
33
- ) %>
34
- <% elsif promotion_code_batch.finished? %>
35
- <%= t(
36
- "spree.promotion_code_batches.finished",
37
- number_of_codes: promotion_code_batch.number_of_codes
38
- ) %>
39
- <%= link_to(
40
- t('spree.download_promotion_codes_list'),
41
- admin_promotion_promotion_code_batch_download_path(
42
- promotion_code_batch_id: promotion_code_batch.id,
43
- format: :csv
44
- )
45
- ) %>
46
- <% else %>
47
- <%= t(
48
- "spree.promotion_code_batches.processing",
49
- number_of_codes: promotion_code_batch.number_of_codes,
50
- number_of_codes_processed: promotion_code_batch.promotion_codes.count
51
- ) %>
52
- <% end %>
53
- </td>
54
- <td><%= promotion_code_batch.email %></td>
55
- </tr>
56
- <% end %>
57
- </tbody>
58
- </table>
59
- <% else %>
60
- <div class="no-objects-found">
61
- <%= render 'spree/admin/shared/no_objects_found',
62
- resource: Spree::PromotionCodeBatch,
63
- new_resource_url: new_object_url %>
64
- </div>
65
- <% end %>
@@ -1,8 +0,0 @@
1
- <% admin_breadcrumb(link_to plural_resource_name(Spree::Promotion), spree.admin_promotions_path) %>
2
- <% admin_breadcrumb(link_to @promotion.name, spree.admin_promotion_path(@promotion.id)) %>
3
- <% admin_breadcrumb(plural_resource_name(Spree::PromotionCodeBatch)) %>
4
- <%= form_for :promotion_code_batch, url: collection_url do |batch| %>
5
- <%= batch.hidden_field :promotion_id, value: params[:promotion_id] %>
6
- <%= render partial: 'form_fields', locals: {batch: batch, promotion_id: params[:promotion_id]} %>
7
- <%= batch.submit t('spree.actions.create'), class: 'btn btn-primary' %>
8
- <% end %>
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- CSV.generate do |csv|
4
- csv << ['Code']
5
- @promotion_codes.order(:id).pluck(:value).each do |value|
6
- csv << [value]
7
- end
8
- end