solidus_friendly_promotions 1.0.0.rc.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +3 -3
  3. data/CHANGELOG.md +50 -8
  4. data/app/controllers/solidus_friendly_promotions/admin/base_controller.rb +4 -0
  5. data/app/controllers/solidus_friendly_promotions/admin/promotion_actions_controller.rb +1 -1
  6. data/app/controllers/solidus_friendly_promotions/admin/promotion_code_batches_controller.rb +12 -0
  7. data/app/models/solidus_friendly_promotions/promotion.rb +4 -2
  8. data/app/models/solidus_friendly_promotions/promotion_action.rb +11 -1
  9. data/app/models/solidus_friendly_promotions/promotion_code.rb +2 -0
  10. data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/_form_fields.html.erb +22 -0
  11. data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/download.csv.ruby +8 -0
  12. data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/index.html.erb +65 -0
  13. data/app/views/solidus_friendly_promotions/admin/promotion_code_batches/new.html.erb +8 -0
  14. data/app/views/solidus_friendly_promotions/admin/promotions/_table.html.erb +3 -3
  15. data/app/views/solidus_friendly_promotions/admin/promotions/_table_filter.html.erb +9 -0
  16. data/bin/sandbox +1 -0
  17. data/config/locales/en.yml +10 -0
  18. data/db/migrate/20240124104855_add_deleted_at_to_promotions.rb +6 -0
  19. data/db/migrate/20240125102050_drop_deleted_at_from_promotion_actions.rb +5 -0
  20. data/lib/solidus_friendly_promotions/version.rb +1 -1
  21. data/lib/solidus_friendly_promotions.rb +9 -4
  22. data/solidus_friendly_promotions.gemspec +2 -2
  23. metadata +12 -8
  24. data/app/models/solidus_friendly_promotions.rb +0 -7
  25. data/config/initializers/solidus_friendly_promotions.rb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb47848b0ee568a1116d827ac87f0071afd5790eff84d501860c0ed68eb37ac1
4
- data.tar.gz: fd5c9d4ac486641ab72f87129cfbf7a7a44ea5b3c1a18970c479794f410dcd9f
3
+ metadata.gz: 5cc3437f15c2341c8a233e48b1443996b09e923cf84727fb834baa766dd1bee7
4
+ data.tar.gz: 9c534dc4a7ce6f3a09bb6c14d046ea8d6c9e313dbea3c5f1e6767000d8eb0cca
5
5
  SHA512:
6
- metadata.gz: 71269bc48e02192efa3d41c83fe461bed7b3b0c8b1d123cfa555671ee5baea159f7e49521d203124ec1c23e2bedecc641e2a6b44ff5b18ad013438c2255fee50
7
- data.tar.gz: 91b12062bff9c7324c9efdce8398ce6eac5ffd50b353848b1249c9a4146411b137c8354fee594861d03f490db9e4a05d0556f5bade2160596d04c56a7e3c452b
6
+ metadata.gz: c345c4dbd052db90957b5a2c886c39c7a328452b616822ce326b2b4170d6b2232be827dc43f7374a33e116fc50b2f9229c5d0b34c46ca3d2a09e26a486319143
7
+ data.tar.gz: 9a2ef29fa7045ae95d884903fe80beadacfc6e89f5fa096f61c5c53709f836f3cf76b6483e11fc488d9140ad1720dee41cdd7cb78f22c1649b1bb107540ef609
data/.circleci/config.yml CHANGED
@@ -21,7 +21,7 @@ jobs:
21
21
  - checkout
22
22
  - solidusio_extensions/dependencies
23
23
  - solidusio_extensions/run-tests-solidus-current
24
- # - solidusio_extensions/run-tests-solidus-main
24
+ - solidusio_extensions/run-tests-solidus-main
25
25
  run-specs-with-postgres:
26
26
  executor:
27
27
  name: solidusio_extensions/postgres
@@ -31,7 +31,7 @@ jobs:
31
31
  - checkout
32
32
  - solidusio_extensions/dependencies
33
33
  - solidusio_extensions/run-tests-solidus-current
34
- # - solidusio_extensions/run-tests-solidus-main
34
+ - solidusio_extensions/run-tests-solidus-main
35
35
  run-specs-with-sqlite:
36
36
  executor:
37
37
  name: solidusio_extensions/sqlite
@@ -41,7 +41,7 @@ jobs:
41
41
  - checkout
42
42
  - solidusio_extensions/dependencies
43
43
  - solidusio_extensions/run-tests-solidus-current
44
- # - solidusio_extensions/run-tests-solidus-main
44
+ - solidusio_extensions/run-tests-solidus-main
45
45
  workflows:
46
46
  Run specs on supported Solidus versions:
47
47
  jobs:
data/CHANGELOG.md CHANGED
@@ -1,8 +1,33 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased](https://github.com/FriendlyCart/solidus_friendly_promotions/tree/HEAD)
3
+ ## [v1.0.0](https://github.com/friendlycart/solidus_friendly_promotions/tree/v1.0.0) (2024-01-25)
4
4
 
5
- ## [v1.0.0.rc.2](https://github.com/FriendlyCart/solidus_friendly_promotions/tree/v1.0.0.rc.3) (2024-01-16)
5
+ [Full Changelog](https://github.com/friendlycart/solidus_friendly_promotions/compare/v1.0.0.rc.3...v1.0.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Implement better soft-delete [\#30](https://github.com/friendlycart/solidus_friendly_promotions/issues/30)
10
+
11
+ **Closed issues:**
12
+
13
+ - Cannot delete promotion with promotion code [\#94](https://github.com/friendlycart/solidus_friendly_promotions/issues/94)
14
+ - Missing action for button: Promotion code batch [\#93](https://github.com/friendlycart/solidus_friendly_promotions/issues/93)
15
+
16
+ **Merged pull requests:**
17
+
18
+ - Improve soft-deletion faculty [\#102](https://github.com/friendlycart/solidus_friendly_promotions/pull/102) ([mamhoff](https://github.com/mamhoff))
19
+ - Add missing association between promo codes and order promotions [\#101](https://github.com/friendlycart/solidus_friendly_promotions/pull/101) ([mamhoff](https://github.com/mamhoff))
20
+ - Revert "Temporarily disable running specs for Solidus main" [\#100](https://github.com/friendlycart/solidus_friendly_promotions/pull/100) ([mamhoff](https://github.com/mamhoff))
21
+ - Add admin UI for promotion code batches [\#99](https://github.com/friendlycart/solidus_friendly_promotions/pull/99) ([mamhoff](https://github.com/mamhoff))
22
+ - Define SolidusFriendlyPromotions.table\_name\_prefix early [\#98](https://github.com/friendlycart/solidus_friendly_promotions/pull/98) ([mamhoff](https://github.com/mamhoff))
23
+
24
+ ## [v1.0.0.rc.3](https://github.com/friendlycart/solidus_friendly_promotions/tree/v1.0.0.rc.3) (2024-01-16)
25
+
26
+ [Full Changelog](https://github.com/friendlycart/solidus_friendly_promotions/compare/v1.0.0.rc.2...v1.0.0.rc.3)
27
+
28
+ **Closed issues:**
29
+
30
+ - Provide Integration Instructions for Starter Frontend [\#90](https://github.com/friendlycart/solidus_friendly_promotions/issues/90)
6
31
 
7
32
  **Merged pull requests:**
8
33
 
@@ -13,9 +38,9 @@
13
38
  - Fix typo [\#89](https://github.com/friendlycart/solidus_friendly_promotions/pull/89) ([jarednorman](https://github.com/jarednorman))
14
39
  - Pass untranslated strings through i18n [\#88](https://github.com/friendlycart/solidus_friendly_promotions/pull/88) ([mamhoff](https://github.com/mamhoff))
15
40
 
16
- ## [v1.0.0.rc.2](https://github.com/FriendlyCart/solidus_friendly_promotions/tree/v1.0.0.rc.2) (2023-11-11)
41
+ ## [v1.0.0.rc.2](https://github.com/friendlycart/solidus_friendly_promotions/tree/v1.0.0.rc.2) (2023-11-11)
17
42
 
18
- [Full Changelog](https://github.com/FriendlyCart/solidus_friendly_promotions/compare/v1.0.0.rc.1...v1.0.0.rc.2)
43
+ [Full Changelog](https://github.com/friendlycart/solidus_friendly_promotions/compare/v1.0.0.rc.1...v1.0.0.rc.2)
19
44
 
20
45
  **Merged pull requests:**
21
46
 
@@ -28,18 +53,35 @@
28
53
  - Promotions index improvements [\#79](https://github.com/friendlycart/solidus_friendly_promotions/pull/79) ([mamhoff](https://github.com/mamhoff))
29
54
  - Lint: Fix standardrb error [\#78](https://github.com/friendlycart/solidus_friendly_promotions/pull/78) ([mamhoff](https://github.com/mamhoff))
30
55
 
31
- ## [v1.0.0.rc.1](https://github.com/FriendlyCart/solidus_friendly_promotions/tree/v1.0.0.rc.1) (2023-11-07)
56
+ ## [v1.0.0.rc.1](https://github.com/friendlycart/solidus_friendly_promotions/tree/v1.0.0.rc.1) (2023-11-07)
57
+
58
+ [Full Changelog](https://github.com/friendlycart/solidus_friendly_promotions/compare/v1.0.0.pre...v1.0.0.rc.1)
59
+
60
+ **Implemented enhancements:**
32
61
 
33
- [Full Changelog](https://github.com/FriendlyCart/solidus_friendly_promotions/compare/v1.0.0.pre...v1.0.0.rc.1)
62
+ - Implement Free items [\#31](https://github.com/friendlycart/solidus_friendly_promotions/issues/31)
34
63
 
35
64
  **Merged pull requests:**
36
65
 
37
66
  - Goodies! [\#75](https://github.com/friendlycart/solidus_friendly_promotions/pull/75) ([mamhoff](https://github.com/mamhoff))
38
67
  - Add a null promotion handler [\#71](https://github.com/friendlycart/solidus_friendly_promotions/pull/71) ([mamhoff](https://github.com/mamhoff))
39
68
 
40
- ## [v1.0.0.pre](https://github.com/FriendlyCart/solidus_friendly_promotions/tree/v1.0.0.pre) (2023-11-07)
69
+ ## [v1.0.0.pre](https://github.com/friendlycart/solidus_friendly_promotions/tree/v1.0.0.pre) (2023-11-07)
70
+
71
+ [Full Changelog](https://github.com/friendlycart/solidus_friendly_promotions/compare/e14802957fdb55d7f4e2730341e4cbb118ebf993...v1.0.0.pre)
72
+
73
+ **Implemented enhancements:**
74
+
75
+ - Migrator: Copy promotion codes [\#34](https://github.com/friendlycart/solidus_friendly_promotions/issues/34)
76
+ - Add original\_promotion\_{action\_}id on promotions and promotion actions [\#33](https://github.com/friendlycart/solidus_friendly_promotions/issues/33)
77
+
78
+ **Fixed bugs:**
79
+
80
+ - Migrator: Add support for promotion categories [\#37](https://github.com/friendlycart/solidus_friendly_promotions/issues/37)
81
+
82
+ **Closed issues:**
41
83
 
42
- [Full Changelog](https://github.com/FriendlyCart/solidus_friendly_promotions/compare/e14802957fdb55d7f4e2730341e4cbb118ebf993...v1.0.0.pre)
84
+ - Document DB tables [\#35](https://github.com/friendlycart/solidus_friendly_promotions/issues/35)
43
85
 
44
86
  **Merged pull requests:**
45
87
 
@@ -49,6 +49,10 @@ module SolidusFriendlyPromotions
49
49
  def routes_proxy
50
50
  solidus_friendly_promotions
51
51
  end
52
+
53
+ def parent_model_name
54
+ self.class.parent_data[:model_name].gsub("solidus_friendly_promotions/", "")
55
+ end
52
56
  end
53
57
  end
54
58
  end
@@ -53,7 +53,7 @@ module SolidusFriendlyPromotions
53
53
 
54
54
  def destroy
55
55
  @promotion_action = @promotion.actions.find(params[:id])
56
- if @promotion_action.discard
56
+ if @promotion_action.destroy
57
57
  flash[:success] =
58
58
  t("spree.successfully_removed", resource: SolidusFriendlyPromotions::PromotionAction.model_name.human)
59
59
  end
@@ -25,6 +25,18 @@ module SolidusFriendlyPromotions
25
25
  def build_promotion_code_batch
26
26
  @promotion_code_batch.process
27
27
  end
28
+
29
+ def model_class
30
+ SolidusFriendlyPromotions::PromotionCodeBatch
31
+ end
32
+
33
+ def collection
34
+ parent.code_batches
35
+ end
36
+
37
+ def build_resource
38
+ parent.code_batches.build
39
+ end
28
40
  end
29
41
  end
30
42
  end
@@ -2,11 +2,13 @@
2
2
 
3
3
  module SolidusFriendlyPromotions
4
4
  class Promotion < Spree::Base
5
+ include Spree::SoftDeletable
6
+
5
7
  belongs_to :category, class_name: "SolidusFriendlyPromotions::PromotionCategory",
6
8
  foreign_key: :promotion_category_id, optional: true
7
9
  belongs_to :original_promotion, class_name: "Spree::Promotion", optional: true
8
10
  has_many :rules, class_name: "SolidusFriendlyPromotions::PromotionRule", dependent: :destroy
9
- has_many :actions, class_name: "SolidusFriendlyPromotions::PromotionAction", dependent: :nullify
11
+ has_many :actions, class_name: "SolidusFriendlyPromotions::PromotionAction", dependent: :destroy
10
12
  has_many :codes, class_name: "SolidusFriendlyPromotions::PromotionCode", dependent: :destroy
11
13
  has_many :code_batches, class_name: "SolidusFriendlyPromotions::PromotionCodeBatch", dependent: :destroy
12
14
  has_many :order_promotions, class_name: "SolidusFriendlyPromotions::OrderPromotion", dependent: :destroy
@@ -49,7 +51,7 @@ module SolidusFriendlyPromotions
49
51
 
50
52
  self.allowed_ransackable_associations = ["codes"]
51
53
  self.allowed_ransackable_attributes = %w[name customer_label path promotion_category_id lane updated_at]
52
- self.allowed_ransackable_scopes = %i[active]
54
+ self.allowed_ransackable_scopes = %i[active with_discarded]
53
55
 
54
56
  # All orders that have been discounted using this promotion
55
57
  def discounted_orders
@@ -9,9 +9,10 @@ module SolidusFriendlyPromotions
9
9
  # by an event and determined to be eligible.
10
10
  class PromotionAction < Spree::Base
11
11
  include Spree::Preferences::Persistable
12
- include Spree::SoftDeletable
13
12
  include Spree::CalculatedAdjustments
14
13
  include Spree::AdjustmentSource
14
+ before_destroy :remove_adjustments_from_incomplete_orders
15
+ before_destroy :raise_for_adjustments_for_completed_orders
15
16
 
16
17
  belongs_to :promotion, inverse_of: :actions
17
18
  belongs_to :original_promotion_action, class_name: "Spree::PromotionAction", optional: true
@@ -69,5 +70,14 @@ module SolidusFriendlyPromotions
69
70
  def available_calculators
70
71
  SolidusFriendlyPromotions.config.promotion_calculators[self.class] || (raise NotImplementedError)
71
72
  end
73
+
74
+ private
75
+
76
+ def raise_for_adjustments_for_completed_orders
77
+ if adjustments.joins(:order).merge(Spree::Order.complete).any?
78
+ errors.add(:base, :cannot_destroy_if_order_completed)
79
+ throw(:abort)
80
+ end
81
+ end
72
82
  end
73
83
  end
@@ -4,6 +4,8 @@ module SolidusFriendlyPromotions
4
4
  class PromotionCode < Spree::Base
5
5
  belongs_to :promotion, inverse_of: :codes
6
6
  belongs_to :promotion_code_batch, inverse_of: :promotion_codes, optional: true
7
+
8
+ has_many :order_promotions, class_name: "SolidusFriendlyPromotions::OrderPromotion", dependent: :destroy
7
9
  has_many :adjustments, class_name: "Spree::Adjustment"
8
10
 
9
11
  before_validation :normalize_code
@@ -0,0 +1,22 @@
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>
@@ -0,0 +1,8 @@
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
@@ -0,0 +1,65 @@
1
+ <% admin_breadcrumb(link_to plural_resource_name(SolidusFriendlyPromotions::Promotion), solidus_friendly_promotions.admin_promotions_path) %>
2
+ <% admin_breadcrumb(link_to @promotion.name, solidus_friendly_promotions.edit_admin_promotion_path(@promotion.id)) %>
3
+ <% admin_breadcrumb(plural_resource_name(SolidusFriendlyPromotions::PromotionCodeBatch)) %>
4
+
5
+ <% content_for :page_actions do %>
6
+ <li>
7
+ <% if can?(:create, SolidusFriendlyPromotions::PromotionCodeBatch) %>
8
+ <%= link_to t('solidus_friendly_promotions.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><%= SolidusFriendlyPromotions::PromotionCodeBatch.human_attribute_name(:base_code) %></th>
18
+ <th><%= SolidusFriendlyPromotions::PromotionCodeBatch.human_attribute_name(:total_codes) %></th>
19
+ <th><%= SolidusFriendlyPromotions::PromotionCodeBatch.human_attribute_name(:status) %></th>
20
+ <th><%= SolidusFriendlyPromotions::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
+ "solidus_friendly_promotions.promotion_code_batches.errored",
32
+ error: promotion_code_batch.error
33
+ ) %>
34
+ <% elsif promotion_code_batch.finished? %>
35
+ <%= t(
36
+ "solidus_friendly_promotions.promotion_code_batches.finished",
37
+ number_of_codes: promotion_code_batch.number_of_codes
38
+ ) %>
39
+ <%= link_to(
40
+ t('solidus_friendly_promotions.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
+ "solidus_friendly_promotions.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: SolidusFriendlyPromotions::PromotionCodeBatch,
63
+ new_resource_url: new_object_url %>
64
+ </div>
65
+ <% end %>
@@ -0,0 +1,8 @@
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 %>
@@ -14,7 +14,7 @@
14
14
  </thead>
15
15
  <tbody>
16
16
  <% promotions.each do |promotion| %>
17
- <tr id="<%= spree_dom_id promotion %>">
17
+ <tr class="<%= 'deleted' if promotion.discarded? %>" id="<%= spree_dom_id promotion %>">
18
18
  <td><%= promotion.name %></td>
19
19
  <td>
20
20
  <%= (promotion.codes.size == 1) ? promotion.codes.pluck(:value).first : t('solidus_friendly_promotions.number_of_codes', count: promotion.codes.size) %>
@@ -43,10 +43,10 @@
43
43
  <%= l(promotion.updated_at, format: :short) %>
44
44
  </td>
45
45
  <td class="actions">
46
- <% if can?(:edit, promotion) %>
46
+ <% if can?(:edit, promotion) && !promotion.discarded? %>
47
47
  <%= link_to_edit promotion, no_text: true %>
48
48
  <% end %>
49
- <% if can?(:destroy, promotion) %>
49
+ <% if can?(:destroy, promotion) && !promotion.discarded? %>
50
50
  <%= link_to_delete promotion, no_text: true %>
51
51
  <% end %>
52
52
  </td>
@@ -43,6 +43,15 @@
43
43
  </div>
44
44
  </div>
45
45
 
46
+ <div class="col-2">
47
+ <div class="field checkbox">
48
+ <label>
49
+ <%= f.check_box :with_discarded, { checked: params[:q][:with_discarded] == 'true', class: 'js-with-discarded-input' }, 'true', 'false' %>
50
+ <%= t('spree.show_deleted') %>
51
+ </label>
52
+ </div>
53
+ </div>
54
+
46
55
  <div class="col-2">
47
56
  <div class="field">
48
57
  <%= label_tag :q_promotion_category_id_eq, SolidusFriendlyPromotions::PromotionCategory.model_name.human %><br>
data/bin/sandbox CHANGED
@@ -65,6 +65,7 @@ unbundled bundle exec rake db:drop db:create
65
65
 
66
66
  unbundled bin/rails generate solidus:install \
67
67
  --auto-accept \
68
+ --admin_preview=false \
68
69
  $@
69
70
 
70
71
  unbundled bundle exec rails generate solidus:auth:install --auto-run-migrations
@@ -39,6 +39,9 @@ en:
39
39
  no_rules_added: No Rules Added
40
40
  promotion_successfully_created: Promotion has been successfully created!
41
41
  promotion_total_changed_before_complete: One or more of the promotions on your order have become ineligible and were removed. Please check the new order amounts and try again.
42
+ promotion_code_batches:
43
+ finished: Finished
44
+ errored: Errored
42
45
  view_promotion_codes_list: View codes list
43
46
  promotion_rules:
44
47
  line_item_product:
@@ -190,6 +193,9 @@ en:
190
193
  solidus_friendly_promotions/rules/user: User
191
194
  solidus_friendly_promotions/rules/user_logged_in: User Logged In
192
195
  solidus_friendly_promotions/rules/user_role: User Role(s)
196
+ solidus_friendly_promotions/promotion_code_batch:
197
+ one: Code batch
198
+ other: Code batches
193
199
  attributes:
194
200
  solidus_friendly_promotions/promotion:
195
201
  active: Active
@@ -308,6 +314,10 @@ en:
308
314
 
309
315
  errors:
310
316
  models:
317
+ solidus_friendly_promotions/promotion_action:
318
+ attributes:
319
+ base:
320
+ cannot_destroy_if_order_completed: Action has been applied to complete orders. It cannot be destroyed.
311
321
  solidus_friendly_promotions/promotion_code:
312
322
  attributes:
313
323
  base:
@@ -0,0 +1,6 @@
1
+ class AddDeletedAtToPromotions < ActiveRecord::Migration[7.0]
2
+ def change
3
+ add_column :friendly_promotions, :deleted_at, :datetime
4
+ add_index :friendly_promotions, :deleted_at
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ class DropDeletedAtFromPromotionActions < ActiveRecord::Migration[7.0]
2
+ def change
3
+ remove_column :friendly_promotion_actions, :deleted_at, :datetime, null: true
4
+ end
5
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusFriendlyPromotions
4
- VERSION = "1.0.0.rc.3"
4
+ VERSION = "1.0.0"
5
5
  end
@@ -7,13 +7,18 @@ require "turbo-rails"
7
7
  require "importmap-rails"
8
8
  require "stimulus-rails"
9
9
  require "ransack-enum"
10
- require "solidus_friendly_promotions/nested_class_set"
11
- require "solidus_friendly_promotions/configuration"
12
- require "solidus_friendly_promotions/version"
13
- require "solidus_friendly_promotions/engine"
14
10
 
15
11
  module SolidusFriendlyPromotions
12
+ def self.table_name_prefix
13
+ "friendly_"
14
+ end
15
+
16
16
  # JS Importmap instance
17
17
  singleton_class.attr_accessor :importmap
18
18
  self.importmap = Importmap::Map.new
19
19
  end
20
+
21
+ require "solidus_friendly_promotions/nested_class_set"
22
+ require "solidus_friendly_promotions/configuration"
23
+ require "solidus_friendly_promotions/version"
24
+ require "solidus_friendly_promotions/engine"
@@ -14,8 +14,8 @@ Gem::Specification.new do |spec|
14
14
  spec.license = "BSD-3-Clause"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
- spec.metadata["source_code_uri"] = "https://github.com/solidusio-contrib/solidus_friendly_promotions"
18
- spec.metadata["changelog_uri"] = "https://github.com/solidusio-contrib/solidus_friendly_promotions/blob/master/CHANGELOG.md"
17
+ spec.metadata["source_code_uri"] = "https://github.com/friendlycart/solidus_friendly_promotions"
18
+ spec.metadata["changelog_uri"] = "https://github.com/friendlycart/solidus_friendly_promotions/blob/master/CHANGELOG.md"
19
19
 
20
20
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5", "< 4")
21
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_friendly_promotions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc.3
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-16 00:00:00.000000000 Z
11
+ date: 2024-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: solidus_core
@@ -209,7 +209,6 @@ files:
209
209
  - app/models/concerns/solidus_friendly_promotions/rules/line_item_level_rule.rb
210
210
  - app/models/concerns/solidus_friendly_promotions/rules/order_level_rule.rb
211
211
  - app/models/concerns/solidus_friendly_promotions/rules/shipment_level_rule.rb
212
- - app/models/solidus_friendly_promotions.rb
213
212
  - app/models/solidus_friendly_promotions/actions/adjust_line_item.rb
214
213
  - app/models/solidus_friendly_promotions/actions/adjust_line_item_quantity_groups.rb
215
214
  - app/models/solidus_friendly_promotions/actions/adjust_shipment.rb
@@ -291,6 +290,10 @@ files:
291
290
  - app/views/solidus_friendly_promotions/admin/promotion_categories/edit.html.erb
292
291
  - app/views/solidus_friendly_promotions/admin/promotion_categories/index.html.erb
293
292
  - app/views/solidus_friendly_promotions/admin/promotion_categories/new.html.erb
293
+ - app/views/solidus_friendly_promotions/admin/promotion_code_batches/_form_fields.html.erb
294
+ - app/views/solidus_friendly_promotions/admin/promotion_code_batches/download.csv.ruby
295
+ - app/views/solidus_friendly_promotions/admin/promotion_code_batches/index.html.erb
296
+ - app/views/solidus_friendly_promotions/admin/promotion_code_batches/new.html.erb
294
297
  - app/views/solidus_friendly_promotions/admin/promotion_codes/index.csv.ruby
295
298
  - app/views/solidus_friendly_promotions/admin/promotion_codes/index.html.erb
296
299
  - app/views/solidus_friendly_promotions/admin/promotion_codes/new.html.erb
@@ -335,7 +338,6 @@ files:
335
338
  - bin/sandbox
336
339
  - bin/setup
337
340
  - config/importmap.rb
338
- - config/initializers/solidus_friendly_promotions.rb
339
341
  - config/locales/en.yml
340
342
  - config/routes.rb
341
343
  - db/migrate/20230703101637_create_promotions.rb
@@ -363,6 +365,8 @@ files:
363
365
  - db/migrate/20231012120928_add_db_comments_to_friendly_promotion_categories.rb
364
366
  - db/migrate/20231013181921_add_original_promotion_ids.rb
365
367
  - db/migrate/20231104135812_add_managed_by_order_action_to_line_items.rb
368
+ - db/migrate/20240124104855_add_deleted_at_to_promotions.rb
369
+ - db/migrate/20240125102050_drop_deleted_at_from_promotion_actions.rb
366
370
  - lib/generators/solidus_friendly_promotions/install/install_generator.rb
367
371
  - lib/generators/solidus_friendly_promotions/install/templates/initializer.rb
368
372
  - lib/solidus_friendly_promotions.rb
@@ -390,8 +394,8 @@ licenses:
390
394
  - BSD-3-Clause
391
395
  metadata:
392
396
  homepage_uri: https://github.com/solidusio-contrib/solidus_friendly_promotions#readme
393
- source_code_uri: https://github.com/solidusio-contrib/solidus_friendly_promotions
394
- changelog_uri: https://github.com/solidusio-contrib/solidus_friendly_promotions/blob/master/CHANGELOG.md
397
+ source_code_uri: https://github.com/friendlycart/solidus_friendly_promotions
398
+ changelog_uri: https://github.com/friendlycart/solidus_friendly_promotions/blob/master/CHANGELOG.md
395
399
  post_install_message:
396
400
  rdoc_options: []
397
401
  require_paths:
@@ -406,9 +410,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
406
410
  version: '4'
407
411
  required_rubygems_version: !ruby/object:Gem::Requirement
408
412
  requirements:
409
- - - ">"
413
+ - - ">="
410
414
  - !ruby/object:Gem::Version
411
- version: 1.3.1
415
+ version: '0'
412
416
  requirements: []
413
417
  rubygems_version: 3.4.20
414
418
  signing_key:
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SolidusFriendlyPromotions
4
- def self.table_name_prefix
5
- "friendly_"
6
- end
7
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative SolidusFriendlyPromotions::Engine.root.join("app/models/solidus_friendly_promotions.rb")