solidus_subscription_boxes 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -10
- data/app/assets/javascripts/solidus_subscription_boxes/subscription_selection.js +18 -0
- data/app/models/solidus_subscription_boxes/subscription_period.rb +1 -1
- data/app/models/solidus_subscription_boxes/subscription_periods_variant.rb +1 -1
- data/db/migrate/20170906021159_create_solidus_subscription_boxes_subscription_periods_variants.rb +1 -1
- data/lib/solidus_subscription_boxes/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bad5a503566baf04da9924b0ac7fa639742b7c4f
|
|
4
|
+
data.tar.gz: c157d9f6caf3deb72923c500dbf46153d3656662
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f7fecf3715c09ef68f06260982373f10074bb83469e1029a2b3968d884208afa6090fd8b717ab09bd92dc63439c494145894ae0109e3c212dc1965d5c5d7e6d
|
|
7
|
+
data.tar.gz: 8d14d44c1ad4148a5c15911cb62e7561e9f4a5d8f596c9c8e29196c1779297195f31b3a575bbbce613d6aafaca6a95d95d06ff0cb4b71ab65a688d40496722eb
|
data/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# SolidusSubscriptionBoxes
|
|
2
|
-
|
|
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
3
|
|
|
4
|
-
|
|
5
|
-
How to use my plugin.
|
|
4
|
+
Courtesy of <a href="https://www.eatlessme.at">Eat Less Meat</a>
|
|
6
5
|
|
|
7
6
|
## Installation
|
|
8
7
|
Add this line to your application's Gemfile:
|
|
@@ -13,16 +12,15 @@ gem 'solidus_subscription_boxes'
|
|
|
13
12
|
|
|
14
13
|
And then execute:
|
|
15
14
|
```bash
|
|
16
|
-
$
|
|
15
|
+
$ bundle exec rake railties:install:migrations FROM=solidus_subscription_boxe
|
|
16
|
+
$ bundle exec rake db:migrate
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
$ gem install solidus_subscription_boxes
|
|
22
|
-
```
|
|
19
|
+
## Usage
|
|
20
|
+
Add a link to '/get-started' and allow users to check out.
|
|
23
21
|
|
|
24
|
-
##
|
|
25
|
-
|
|
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.
|
|
26
24
|
|
|
27
25
|
## License
|
|
28
26
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Meal Selection Page
|
|
2
|
+
$('.meal-selection').click( function(event) {
|
|
3
|
+
if( $('.meal-selection input:checked').length > 3) {
|
|
4
|
+
alert("Please only pick 3 feals");
|
|
5
|
+
event.target.checked = false;
|
|
6
|
+
event.preventDefault();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if( $('.meal-selection input:checked').length == 3) {
|
|
10
|
+
$('input[type=submit]').removeAttr('disabled');
|
|
11
|
+
$('input[type=submit]').attr("value","Subscribe Now");
|
|
12
|
+
} else {
|
|
13
|
+
$('input[type=submit]').attr("disabled","disabled");
|
|
14
|
+
$('input[type=submit]').attr("value","Choose " + (3 - $('.meal-selection input:checked').length).toString() + " More");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
$('.number_more_meals').text(3 - $('.meal-selection input:checked').length);
|
|
18
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module SolidusSubscriptionBoxes
|
|
2
2
|
class SubscriptionPeriod < ApplicationRecord
|
|
3
|
-
has_many :subscription_periods_variants
|
|
3
|
+
has_many :subscription_periods_variants, class_name: 'SolidusSubscriptionBoxes::SubscriptionPeriodsVariant', foreign_key: 'solidus_subscription_boxes_subscription_period_id'
|
|
4
4
|
has_many :variants, through: :subscription_periods_variants, class_name: 'Spree::Variant'
|
|
5
5
|
|
|
6
6
|
def self.current
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
module SolidusSubscriptionBoxes
|
|
2
2
|
class SubscriptionPeriodsVariant < ApplicationRecord
|
|
3
3
|
belongs_to :variant, class_name: 'Spree::Variant', foreign_key: :spree_variant_id
|
|
4
|
-
belongs_to :subscription_period
|
|
4
|
+
belongs_to :subscription_period, class_name: 'SolidusSubscriptionBoxes::SubscriptionPeriod', foreign_key: 'solidus_subscription_boxes_subscription_period_id'
|
|
5
5
|
end
|
|
6
6
|
end
|
data/db/migrate/20170906021159_create_solidus_subscription_boxes_subscription_periods_variants.rb
CHANGED
|
@@ -2,7 +2,7 @@ class CreateSolidusSubscriptionBoxesSubscriptionPeriodsVariants < ActiveRecord::
|
|
|
2
2
|
def change
|
|
3
3
|
create_table :solidus_subscription_boxes_subscription_periods_variants do |t|
|
|
4
4
|
t.references :spree_variant, foreign_key: true, index: {name: 'subscription_box_period_variant'}
|
|
5
|
-
t.references :
|
|
5
|
+
t.references :solidus_subscription_boxes_subscription_period, foreign_key: true, index: {name: 'subscription_box_period_period'}
|
|
6
6
|
|
|
7
7
|
t.timestamps
|
|
8
8
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_subscription_boxes
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Joel Jackson
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-09-
|
|
11
|
+
date: 2017-09-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: solidus
|
|
@@ -133,6 +133,7 @@ files:
|
|
|
133
133
|
- Rakefile
|
|
134
134
|
- app/assets/config/solidus_subscription_boxes_manifest.js
|
|
135
135
|
- app/assets/javascripts/solidus_subscription_boxes/application.js
|
|
136
|
+
- app/assets/javascripts/solidus_subscription_boxes/subscription_selection.js
|
|
136
137
|
- app/assets/stylesheets/solidus_subscription_boxes/application.css
|
|
137
138
|
- app/controllers/solidus_subscription_boxes/application_controller.rb
|
|
138
139
|
- app/controllers/solidus_subscription_boxes/subscription_boxes_controller.rb
|