solidus_subscription_boxes 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +29 -29
  3. data/README.md +26 -26
  4. data/Rakefile +47 -47
  5. data/app/assets/config/solidus_subscription_boxes_manifest.js +2 -2
  6. data/app/assets/javascripts/solidus_subscription_boxes/application.js +13 -13
  7. data/app/assets/javascripts/solidus_subscription_boxes/subscription_selection.js +54 -54
  8. data/app/assets/stylesheets/_solidus_subscription_boxes.scss +16 -16
  9. data/app/assets/stylesheets/solidus_subscription_boxes/subscription_box.css.scss +33 -35
  10. data/app/controllers/solidus_subscription_boxes/application_controller.rb +4 -4
  11. data/app/controllers/solidus_subscription_boxes/subscription_boxes_controller.rb +6 -6
  12. data/app/decorators/solidus_subscriptions/models/checkout/update_preference_decorator.rb +14 -14
  13. data/app/decorators/spree/controllers/api/v1/subscriptions/meal_preference_decorator.rb +20 -20
  14. data/app/decorators/spree/controllers/orders/meal_preference_decorator.rb +24 -24
  15. data/app/decorators/spree/controllers/users/set_box_preference_decorator.rb +30 -30
  16. data/app/decorators/spree/orders/preference_decorator.rb +14 -14
  17. data/app/decorators/spree/products/boxable_decorator.rb +11 -11
  18. data/app/helpers/solidus_subscription_boxes/application_helper.rb +11 -11
  19. data/app/jobs/solidus_subscription_boxes/application_job.rb +4 -4
  20. data/app/mailers/solidus_subscription_boxes/application_mailer.rb +6 -6
  21. data/app/models/solidus_subscription_boxes/application_record.rb +5 -5
  22. data/app/models/solidus_subscription_boxes/box_preference.rb +10 -10
  23. data/app/models/solidus_subscription_boxes/subscription_period.rb +15 -15
  24. data/app/models/solidus_subscription_boxes/subscription_periods_variant.rb +6 -6
  25. data/app/overrides/views/admin_boxable_checkbox.rb +5 -5
  26. data/app/views/layouts/solidus_subscription_boxes/application.html.erb +14 -14
  27. data/app/views/solidus_subscription_boxes/subscription_boxes/_box_variants.html.erb +12 -12
  28. data/app/views/solidus_subscription_boxes/subscription_boxes/_manage.html.erb +39 -39
  29. data/app/views/solidus_subscription_boxes/subscription_boxes/get_started.html.erb +52 -44
  30. data/app/views/spree/admin/products/_boxable_checkbox.html.erb +8 -8
  31. data/app/views/spree/admin/variants/_boxable_checkbox.html.erb +8 -8
  32. data/config/routes.rb +4 -4
  33. data/db/migrate/20170609065436_create_solidus_subscription_boxes_box_preferences.rb +10 -10
  34. data/db/migrate/20170906015531_create_solidus_subscription_boxes_subscription_periods.rb +9 -9
  35. data/db/migrate/20170906021159_create_solidus_subscription_boxes_subscription_periods_variants.rb +10 -10
  36. data/db/migrate/20170919054537_add_boxable_to_spree_variants.rb +5 -5
  37. data/db/migrate/20170919063437_add_boxable_variant_id_to_solidus_subscription_boxes_subscription_periods.rb +5 -5
  38. data/lib/solidus_subscription_boxes.rb +4 -4
  39. data/lib/solidus_subscription_boxes/engine.rb +13 -13
  40. data/lib/solidus_subscription_boxes/version.rb +3 -3
  41. data/lib/tasks/solidus_subscription_boxes_tasks.rake +4 -4
  42. data/test/integration/navigation_test.rb +8 -8
  43. data/test/solidus_subscription_boxes_test.rb +7 -7
  44. data/test/test_helper.rb +21 -21
  45. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9227e03c389cc35ac8ed64cbdd1c3972d0df6076
4
- data.tar.gz: b0822b741b38056b1345428f38fd2f79580ed5f7
3
+ metadata.gz: 8fd705fac70ca23e84c8ada45cc35b1ddd926797
4
+ data.tar.gz: '0496a2a0f59c99a83c0dcc6a7f189ac8577471d3'
5
5
  SHA512:
6
- metadata.gz: 9f879111848a3b97caaaf8056fcea32afdcf872b925acdaa5ef74364953977bc024c1e8066343df0bbc587e1dc19d94e17e1de2b73710e912cef9ac496a69905
7
- data.tar.gz: 7cc44a4d5b6c360467132380da5c53305322922e33ca1404720f22d4278538ec0f49de48213aae161858c3878bf55c63cb3891b1ab6789c05df4e7495aa27506
6
+ metadata.gz: d32da59ab6966707077235e0853c9c73844601691b3fcc2022572871467aa703d4591a029d1f5755d6a8c09fb0e6184e25addf47df31c2aee5e796e464728e93
7
+ data.tar.gz: 8100e8d58dd2a5d5c3673bd81daf56f045b57f741dd0a748c3e01ea1f300898a86779cc4c23bfef4598c9c6e11fdd6fd8a8062d046f8f8fcb5d6e208e2cfd447
data/LICENSE CHANGED
@@ -1,29 +1,29 @@
1
- BSD 3-Clause License
2
-
3
- Copyright (c) 2017, Joel Jackson
4
- All rights reserved.
5
-
6
- Redistribution and use in source and binary forms, with or without
7
- modification, are permitted provided that the following conditions are met:
8
-
9
- * Redistributions of source code must retain the above copyright notice, this
10
- list of conditions and the following disclaimer.
11
-
12
- * Redistributions in binary form must reproduce the above copyright notice,
13
- this list of conditions and the following disclaimer in the documentation
14
- and/or other materials provided with the distribution.
15
-
16
- * Neither the name of the copyright holder nor the names of its
17
- contributors may be used to endorse or promote products derived from
18
- this software without specific prior written permission.
19
-
20
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
- SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
- CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2017, Joel Jackson
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ * Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,26 +1,26 @@
1
- # SolidusSubscriptionBoxes
2
- This project adds subscription box functionality to solidus. It allows an admin to specify some group of products to allow users to choose from every week. For example each week a customer spends $40 and is able to pick 4 of 8 different products. This is extremely pre-alpha, but if you want to use it, star the repo and I'll keep adding.
3
-
4
- Courtesy of <a href="https://www.eatlessme.at">Eat Less Meat</a>
5
-
6
- ## Installation
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'solidus_subscription_boxes'
11
- ```
12
-
13
- And then execute:
14
- ```bash
15
- $ bundle exec rake railties:install:migrations FROM=solidus_subscription_boxe
16
- $ bundle exec rake db:migrate
17
- ```
18
-
19
- ## Usage
20
- Add a link to '/get-started' and allow users to check out.
21
-
22
- ## Limitations
23
- This only works at the moment if the subscribable variant created through solidus subscriptions is the first variant. Generation of subscription options on following orders is not yet finished.
24
-
25
- ## License
26
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
1
+ # SolidusSubscriptionBoxes
2
+ This project adds subscription box functionality to solidus. It allows an admin to specify some group of products to allow users to choose from every week. For example each week a customer spends $40 and is able to pick 4 of 8 different products. This is extremely pre-alpha, but if you want to use it, star the repo and I'll keep adding.
3
+
4
+ Courtesy of <a href="https://www.eatlessme.at">Eat Less Meat</a>
5
+
6
+ ## Installation
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'solidus_subscription_boxes'
11
+ ```
12
+
13
+ And then execute:
14
+ ```bash
15
+ $ bundle exec rake railties:install:migrations FROM=solidus_subscription_boxe
16
+ $ bundle exec rake db:migrate
17
+ ```
18
+
19
+ ## Usage
20
+ Add a link to '/get-started' and allow users to check out.
21
+
22
+ ## Limitations
23
+ This only works at the moment if the subscribable variant created through solidus subscriptions is the first variant. Generation of subscription options on following orders is not yet finished.
24
+
25
+ ## License
26
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,47 +1,47 @@
1
- begin
2
- require 'bundler/setup'
3
- rescue LoadError
4
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
- end
6
-
7
- require 'rdoc/task'
8
-
9
- RDoc::Task.new(:rdoc) do |rdoc|
10
- rdoc.rdoc_dir = 'rdoc'
11
- rdoc.title = 'SolidusSubscriptionBoxes'
12
- rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
14
- rdoc.rdoc_files.include('lib/**/*.rb')
15
- end
16
-
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
- load 'rails/tasks/engine.rake'
19
-
20
-
21
- load 'rails/tasks/statistics.rake'
22
-
23
-
24
-
25
- Bundler::GemHelper.install_tasks
26
-
27
- require 'rake/testtask'
28
-
29
- Rake::TestTask.new(:test) do |t|
30
- t.libs << 'lib'
31
- t.libs << 'test'
32
- t.pattern = 'test/**/*_test.rb'
33
- t.verbose = false
34
- end
35
-
36
-
37
- task default: :test
38
- require 'rake/testtask'
39
-
40
- Rake::TestTask.new(:test) do |t|
41
- t.libs << 'test'
42
- t.pattern = 'test/**/*_test.rb'
43
- t.verbose = false
44
- end
45
-
46
-
47
- task default: :test
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'SolidusSubscriptionBoxes'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+ load 'rails/tasks/statistics.rake'
22
+
23
+
24
+
25
+ Bundler::GemHelper.install_tasks
26
+
27
+ require 'rake/testtask'
28
+
29
+ Rake::TestTask.new(:test) do |t|
30
+ t.libs << 'lib'
31
+ t.libs << 'test'
32
+ t.pattern = 'test/**/*_test.rb'
33
+ t.verbose = false
34
+ end
35
+
36
+
37
+ task default: :test
38
+ require 'rake/testtask'
39
+
40
+ Rake::TestTask.new(:test) do |t|
41
+ t.libs << 'test'
42
+ t.pattern = 'test/**/*_test.rb'
43
+ t.verbose = false
44
+ end
45
+
46
+
47
+ task default: :test
@@ -1,2 +1,2 @@
1
- //= link_directory ../javascripts/solidus_subscription_boxes .js
2
- //= link_directory ../stylesheets/solidus_subscription_boxes .css
1
+ //= link_directory ../javascripts/solidus_subscription_boxes .js
2
+ //= link_directory ../stylesheets/solidus_subscription_boxes .css
@@ -1,13 +1,13 @@
1
- // This is a manifest file that'll be compiled into application.js, which will include all the files
2
- // listed below.
3
- //
4
- // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
- //
7
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
9
- //
10
- // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
- // about supported directives.
12
- //
13
- //= require_tree .
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -1,54 +1,54 @@
1
- // Meal Selection Page
2
- function subscriptionFormatDate(date) {
3
- var monthNames = [
4
- "January", "February", "March",
5
- "April", "May", "June", "July",
6
- "August", "September", "October",
7
- "November", "December"
8
- ];
9
-
10
- var day = date.getDate();
11
- var monthIndex = date.getMonth();
12
-
13
- return monthNames[monthIndex] + ' ' + day;
14
- }
15
-
16
-
17
- $('.meal-selection').click( function(event) {
18
- if( $('body.get_started').length > 0 ) {
19
- var submitButtonText = "Subscribe Now";
20
- } else {
21
- var submitButtonText = "Update My Order";
22
- }
23
-
24
- if( $('.meal-selection input:checked').length > 3 ) {
25
- alert("Please only pick 3 meals");
26
- event.target.checked = false;
27
- event.preventDefault();
28
- }
29
-
30
- if( $('.meal-selection input:checked').length == 3 ) {
31
- $('input[type=submit].meal-update').removeAttr('disabled');
32
- $('input[type=submit].meal-update').attr("value",submitButtonText);
33
- } else {
34
- $('input[type=submit].meal-update').attr("disabled","disabled");
35
- $('input[type=submit].meal-update').attr("value","Choose " + (3 - $('.meal-selection input:checked').length).toString() + " More");
36
- }
37
-
38
- $('.number_more_meals').text(3 - $('.meal-selection input:checked').length);
39
- });
40
-
41
- $(document).ajaxSuccess(function( event, xhr, settings ) {
42
- if( settings.url.match(/\/api\/v1\/subscriptions\/\d*\/skip/) ) {
43
- var actionableDate = new Date(Date.parse(xhr.responseJSON.actionable_date));
44
- $('.actionable-date-update').text(subscriptionFormatDate(actionableDate));
45
- }
46
- if( settings.url.match(/\/api\/v1\/subscriptions\/\d*\/cancel/) ) {
47
- $('.manage-subscription').remove();
48
- }
49
- if( settings.url.match(/\/api\/v1\/subscriptions\/\d*$/)) {
50
- alert("You've updated your subscription.")
51
- }
52
- });
53
-
54
-
1
+ // Meal Selection Page
2
+ function subscriptionFormatDate(date) {
3
+ var monthNames = [
4
+ "January", "February", "March",
5
+ "April", "May", "June", "July",
6
+ "August", "September", "October",
7
+ "November", "December"
8
+ ];
9
+
10
+ var day = date.getDate();
11
+ var monthIndex = date.getMonth();
12
+
13
+ return monthNames[monthIndex] + ' ' + day;
14
+ }
15
+
16
+
17
+ $('.meal-selection').click( function(event) {
18
+ if( $('body.get_started').length > 0 ) {
19
+ var submitButtonText = "Subscribe Now";
20
+ } else {
21
+ var submitButtonText = "Update My Order";
22
+ }
23
+
24
+ if( $('.meal-selection input:checked').length > 3 ) {
25
+ alert("Only choose 3 meals");
26
+ event.target.checked = false;
27
+ event.preventDefault();
28
+ }
29
+
30
+ if( $('.meal-selection input:checked').length == 3 ) {
31
+ $('input[type=submit].meal-update').removeAttr('disabled');
32
+ $('input[type=submit].meal-update').attr("value",submitButtonText);
33
+ } else {
34
+ $('input[type=submit].meal-update').attr("disabled","disabled");
35
+ $('input[type=submit].meal-update').attr("value","Choose " + (3 - $('.meal-selection input:checked').length).toString() + " More");
36
+ }
37
+
38
+ $('.number_more_meals').text(3 - $('.meal-selection input:checked').length);
39
+ });
40
+
41
+ $(document).ajaxSuccess(function( event, xhr, settings ) {
42
+ if( settings.url.match(/\/api\/v1\/subscriptions\/\d*\/skip/) ) {
43
+ var actionableDate = new Date(Date.parse(xhr.responseJSON.actionable_date));
44
+ $('.actionable-date-update').text(subscriptionFormatDate(actionableDate));
45
+ }
46
+ if( settings.url.match(/\/api\/v1\/subscriptions\/\d*\/cancel/) ) {
47
+ $('.manage-subscription').remove();
48
+ }
49
+ if( settings.url.match(/\/api\/v1\/subscriptions\/\d*$/)) {
50
+ alert("You've updated your subscription.")
51
+ }
52
+ });
53
+
54
+
@@ -1,16 +1,16 @@
1
- /*
2
- * This is a manifest file that'll be compiled into application.css, which will include all the files
3
- * listed below.
4
- *
5
- * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
- *
8
- * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
12
- *
13
- */
14
-
15
- @import "solidus_subscription_boxes/subscription_box"
16
-
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ */
14
+
15
+ @import "solidus_subscription_boxes/subscription_box"
16
+
@@ -1,36 +1,34 @@
1
- $color-disabled: #283428;
2
-
3
- .meal img {
4
- width: 100%;
5
- }
6
- .row-centered {
7
- text-align: center;
8
- -webkit-justify-content: center; /* Safari */
9
- justify-content: center;
10
- }
11
- .col-centered {
12
- display: inline-block;
13
- float: none;
14
- /* reset the text-align */
15
- text-align: left;
16
- /* inline-block space fix */
17
- margin-right: -4px;
18
- }
19
- .flash.notice {
20
- background-color: green;
21
- }
22
- .flash.success {
23
- background-color: green;
24
- }
25
- .meal-selector .meal-selection, {
26
- .image {
27
- border: 4px transparent solid;
28
- cursor: pointer;
29
- &:hover {
30
- border: 4px $color-disabled solid;
31
- }
32
- }
33
- input:checked + .image {
34
- border: 4px green solid;
35
- }
1
+ .meal img {
2
+ width: 100%;
3
+ }
4
+ .row-centered {
5
+ text-align: center;
6
+ -webkit-justify-content: center; /* Safari */
7
+ justify-content: center;
8
+ }
9
+ .col-centered {
10
+ display: inline-block;
11
+ float: none;
12
+ /* reset the text-align */
13
+ text-align: left;
14
+ /* inline-block space fix */
15
+ margin-right: -4px;
16
+ }
17
+ .flash.notice {
18
+ background-color: green;
19
+ }
20
+ .flash.success {
21
+ background-color: green;
22
+ }
23
+ .meal-selector .meal-selection, {
24
+ .image {
25
+ border: 3px transparent solid;
26
+ cursor: pointer;
27
+ &:hover {
28
+ border: 3px $gray-500 solid;
29
+ }
30
+ }
31
+ input:checked + .image {
32
+ border: 3px $btn-box-shadow-color solid;
33
+ }
36
34
  }