spree_waiting_list 1.0.0 → 1.1.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94ce597e1f1cb22e6ccc49eb75a4d95dfe2cfa53
4
- data.tar.gz: 8d70c57816a1554c80e8a0c18f128317a45d61e9
3
+ metadata.gz: 3e407d10f69fe65d64600bcdf96142c14431f799
4
+ data.tar.gz: 996b6a2d4ed2b91e7cd2f5527a3f9d41461d8f28
5
5
  SHA512:
6
- metadata.gz: 0e73e4207bacaac4a20dbc6d0e8d0493732a504718ffd13c3f8bd214f78c00e95dab0850a9686094b6df2d9f796c0e927ae718e37addaf653cce6be6ccc8d898
7
- data.tar.gz: 614634f1c4c94def5e48a2b2258ff19403c55f5f0b88055ecd33ea8d2524e3044fd15bdaf106f35b2298cdc0fdca44ffc238f754db1e36b757eebfcbdd7a81de
6
+ metadata.gz: 7da5efbffc2d42ce8d8b7b1e024d608738b253e7e68de14e3c878bbd668dc634b42b32194ac9443bb6e469d619c6774841d027a20f26af98de084ad8d602c621
7
+ data.tar.gz: affbe5c16b896e9ebb9871ee25a4ab09f8636c4002e513db53ac32ebd659f5fd4e6e1c44cc3938c591af04edd3bdc64d63785d620f7cf3440c42f10ae46adf67
data/LICENSE CHANGED
@@ -1,23 +1,23 @@
1
- Redistribution and use in source and binary forms, with or without modification,
2
- are permitted provided that the following conditions are met:
3
-
4
- * Redistributions of source code must retain the above copyright notice,
5
- this list of conditions and the following disclaimer.
6
- * Redistributions in binary form must reproduce the above copyright notice,
7
- this list of conditions and the following disclaimer in the documentation
8
- and/or other materials provided with the distribution.
9
- * Neither the name of the Rails Dog LLC nor the names of its
10
- contributors may be used to endorse or promote products derived from this
11
- software without specific prior written permission.
12
-
13
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1
+ Redistribution and use in source and binary forms, with or without modification,
2
+ are permitted provided that the following conditions are met:
3
+
4
+ * Redistributions of source code must retain the above copyright notice,
5
+ this list of conditions and the following disclaimer.
6
+ * Redistributions in binary form must reproduce the above copyright notice,
7
+ this list of conditions and the following disclaimer in the documentation
8
+ and/or other materials provided with the distribution.
9
+ * Neither the name of the Rails Dog LLC nor the names of its
10
+ contributors may be used to endorse or promote products derived from this
11
+ software without specific prior written permission.
12
+
13
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
16
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
21
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23
23
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md CHANGED
@@ -1,44 +1,44 @@
1
- Spree Waiting List
2
- ================
3
- [![Code Climate](https://codeclimate.com/github/DynamoMTL/spree_waiting_list/badges/gpa.svg)](https://codeclimate.com/github/DynamoMTL/spree_waiting_list)
4
-
5
- A waiting list extension for Spree.
6
-
7
- Users and guests can request to be notified via email when a product/variant comes back in stock.
8
-
9
-
10
- Installation
11
- ------------
12
-
13
- Add spree_waiting_list to your Gemfile:
14
-
15
- ```ruby
16
- gem 'spree_waiting_list'
17
- ```
18
-
19
- Bundle your dependencies and run the installation generator:
20
-
21
- ```shell
22
- bundle
23
- bundle exec rails g spree_waiting_list:install
24
- ```
25
-
26
- Testing
27
- -------
28
-
29
- First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
30
-
31
- ```shell
32
- bundle
33
- bundle exec rake
34
- ```
35
-
36
- When testing your applications integration with this extension you may use it's factories.
37
- Simply add this require statement to your spec_helper:
38
-
39
- ```ruby
40
- require 'spree_waiting_list/factories'
41
- ```
42
-
43
-
44
- Copyright (c) 2011 Joshua Nussbaum, released under the New BSD License
1
+ Spree Waiting List
2
+ ================
3
+ [![Code Climate](https://codeclimate.com/github/DynamoMTL/spree_waiting_list/badges/gpa.svg)](https://codeclimate.com/github/DynamoMTL/spree_waiting_list) [![Build Status](https://travis-ci.org/DynamoMTL/spree_waiting_list.svg?branch=master)](https://travis-ci.org/DynamoMTL/spree_waiting_list) [![Gem Version](https://badge.fury.io/rb/spree_waiting_list.svg)](http://badge.fury.io/rb/spree_waiting_list)
4
+
5
+ A waiting list extension for Spree.
6
+
7
+ Users and guests can request to be notified via email when a product/variant comes back in stock.
8
+
9
+
10
+ Installation
11
+ ------------
12
+
13
+ Add spree_waiting_list to your Gemfile:
14
+
15
+ ```ruby
16
+ gem 'spree_waiting_list'
17
+ ```
18
+
19
+ Bundle your dependencies and run the installation generator:
20
+
21
+ ```shell
22
+ bundle
23
+ bundle exec rails g spree_waiting_list:install
24
+ ```
25
+
26
+ Testing
27
+ -------
28
+
29
+ First bundle your dependencies, then run `rake`. `rake` will default to building the dummy app if it does not exist, then it will run specs. The dummy app can be regenerated by using `rake test_app`.
30
+
31
+ ```shell
32
+ bundle
33
+ bundle exec rake
34
+ ```
35
+
36
+ When testing your applications integration with this extension you may use it's factories.
37
+ Simply add this require statement to your spec_helper:
38
+
39
+ ```ruby
40
+ require 'spree_waiting_list/factories'
41
+ ```
42
+
43
+
44
+ Copyright (c) 2011 Joshua Nussbaum, released under the New BSD License
@@ -1,10 +1,8 @@
1
- Spree::Admin::ReportsController.class_eval do
2
-
3
- add_available_report! :stock_requests
4
-
5
- def stock_requests
6
- @search = Spree::StockRequest.ransack(params[:q])
7
- @stock_requests = @search.result
8
- end
9
-
10
- end
1
+ Spree::Admin::ReportsController.class_eval do
2
+ add_available_report! :stock_requests
3
+
4
+ def stock_requests
5
+ @search = Spree::StockRequest.ransack(params[:q])
6
+ @stock_requests = @search.result
7
+ end
8
+ end
@@ -1,32 +1,30 @@
1
- module Spree
2
- class StockRequestsController < StoreController
3
- layout false
4
-
5
- def new
6
- @stock_request = StockRequest.new(stock_request_params)
7
- end
8
-
9
- def create
10
- @stock_request = StockRequest.new(stock_request_params)
11
- @stock_request.email = try_spree_current_user.email if try_spree_current_user
12
-
13
- respond_to do |format|
14
- if @stock_request.save
15
- format.html { redirect_to root_path, :notice => Spree.t(:successful_stock_request) }
16
- format.js
17
- else
18
- format.html { render :action => 'new'}
19
- format.json { render json: @stock_request.errors, status: :unprocessable_entity }
20
- end
21
- end
22
- end
23
-
24
- private
25
-
26
- def stock_request_params
27
- params.require(:stock_request).permit(permitted_attributes.stock_request_attributes)
28
- end
29
-
30
- end
31
- end
32
-
1
+ module Spree
2
+ class StockRequestsController < StoreController
3
+ layout false
4
+
5
+ def new
6
+ @stock_request = StockRequest.new(stock_request_params)
7
+ end
8
+
9
+ def create
10
+ @stock_request = StockRequest.new(stock_request_params)
11
+ @stock_request.email = try_spree_current_user.email if try_spree_current_user
12
+
13
+ respond_to do |format|
14
+ if @stock_request.save
15
+ format.html { redirect_to root_path, :notice => Spree.t(:successful_stock_request) }
16
+ format.js
17
+ else
18
+ format.html { render :action => 'new'}
19
+ format.json { render json: @stock_request.errors, status: :unprocessable_entity }
20
+ end
21
+ end
22
+ end
23
+
24
+ private
25
+
26
+ def stock_request_params
27
+ params.require(:stock_request).permit(permitted_attributes.stock_request_attributes)
28
+ end
29
+ end
30
+ end
@@ -1,11 +1,11 @@
1
- Spree::UserMailer.class_eval do
2
- def back_in_stock(stock_request)
3
- @request = stock_request
4
- @product = stock_request.product
5
- @variant = stock_request.variant
6
-
7
- mail(:subject => Spree.t(:back_in_stock_subject, :product_name => @product.name),
8
- :from => from_address,
9
- :to => stock_request.email)
10
- end
1
+ Spree::UserMailer.class_eval do
2
+ def back_in_stock(stock_request)
3
+ @request = stock_request
4
+ @product = stock_request.product
5
+ @variant = stock_request.variant
6
+
7
+ mail(:subject => Spree.t(:back_in_stock_subject, :product_name => @product.name),
8
+ :from => from_address,
9
+ :to => stock_request.email)
10
+ end
11
11
  end
@@ -1,16 +1,13 @@
1
- Spree::PermittedAttributes.class_eval do
2
- @@stock_request_attributes = [:email, :product_id, :variant_id]
3
- end
4
-
5
- module Spree
6
- module PermittedAttributes
7
-
8
- class << self
9
-
10
- mattr_reader :stock_request_attributes
11
-
12
- ATTRIBUTES << :stock_request_attributes
13
-
14
- end
15
- end
16
- end
1
+ Spree::PermittedAttributes.class_eval do
2
+ @@stock_request_attributes = [:email, :variant_id]
3
+ end
4
+
5
+ module Spree
6
+ module PermittedAttributes
7
+ class << self
8
+ mattr_reader :stock_request_attributes
9
+
10
+ ATTRIBUTES << :stock_request_attributes
11
+ end
12
+ end
13
+ end
@@ -1,20 +1,16 @@
1
- module Spree
2
-
3
- StockItem.class_eval do
4
-
5
- around_save :notify_availability
6
-
7
- private
8
- def notify_availability
9
- available = count_on_hand_was <= 0 && count_on_hand > 0 && count_on_hand_changed?
10
-
11
- yield
12
-
13
- if available
14
- variant.notify_waiting_list
15
- end
16
- end
17
-
18
- end
19
-
20
- end
1
+ module Spree
2
+ StockItem.class_eval do
3
+ around_save :notify_availability
4
+
5
+ private
6
+ def notify_availability
7
+ available = count_on_hand_was <= 0 && count_on_hand > 0 && count_on_hand_changed?
8
+
9
+ yield
10
+
11
+ if available
12
+ variant.notify_waiting_list
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,29 +1,28 @@
1
- module Spree
2
- class StockRequest < ActiveRecord::Base
3
- belongs_to :product
4
- belongs_to :variant
5
-
6
- validates :email, :presence => true,
7
- :format => {with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i}
8
-
9
- default_scope { order('created_at desc') }
10
-
11
- scope :notified, lambda { |is_notified| where(:status => is_notified ? 'notified' : 'new') }
12
- scope :without_variant, -> { where(:variant_id => nil) }
13
-
14
- state_machine :status, :initial => 'new' do
15
- event :notify do
16
- transition :from => 'new', :to => 'notified'
17
- end
18
-
19
- after_transition :to => 'notified', :do => :send_email
20
- end
21
-
22
- private
23
-
24
- def send_email
25
- UserMailer.back_in_stock(self).deliver
26
- end
27
-
28
- end
29
- end
1
+ module Spree
2
+ class StockRequest < ActiveRecord::Base
3
+ belongs_to :variant
4
+ delegate :product, :to => :variant
5
+
6
+ validates :email, :presence => true,
7
+ :format => {with: /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i}
8
+
9
+ default_scope { order('created_at desc') }
10
+
11
+ scope :notified, lambda { |is_notified| where(:status => is_notified ? 'notified' : 'new') }
12
+
13
+ state_machine :status, :initial => 'new' do
14
+ event :notify do
15
+ transition :from => 'new', :to => 'notified'
16
+ end
17
+
18
+ after_transition :to => 'notified', :do => :send_email
19
+ end
20
+
21
+ private
22
+
23
+ def send_email
24
+ UserMailer.back_in_stock(self).deliver
25
+ end
26
+
27
+ end
28
+ end
@@ -1,12 +1,12 @@
1
- module Spree
2
-
3
- Variant.class_eval do
4
- has_many :stock_requests
5
-
6
- def notify_waiting_list
7
- stock_requests.notified(false).each &:notify!
8
- product.notify_waiting_list
9
- end
10
- end
11
-
12
- end
1
+ module Spree
2
+
3
+ Variant.class_eval do
4
+ has_many :stock_requests
5
+
6
+ def notify_waiting_list
7
+ stock_requests.notified(false).each &:notify!
8
+ product.notify_waiting_list
9
+ end
10
+ end
11
+
12
+ end
@@ -1,9 +1,9 @@
1
- <%= %w(email sku product variant status requested).collect{|h| "\"#{t(h)}\""}.join(',').html_safe %>
2
- <% @stock_requests.each do |request| %>
3
- <%= [request.email,
4
- request.variant ? request.variant.sku : request.product.sku,
5
- request.product.name,
6
- request.variant ? request.variant.options_text : '',
7
- request.status.titleize,
8
- request.created_at.to_s(:short)].collect{|cell| "\"#{cell}\"" }.join(",").html_safe %>
1
+ <%= %w(email sku product variant status requested).collect{|h| "\"#{t(h)}\""}.join(',').html_safe %>
2
+ <% @stock_requests.each do |request| %>
3
+ <%= [request.email,
4
+ request.variant.sku,
5
+ request.product.name,
6
+ request.variant.options_text,
7
+ request.status.titleize,
8
+ request.created_at.to_s(:short)].collect{|cell| "\"#{cell}\"" }.join(",").html_safe %>
9
9
  <% end %>
@@ -1,27 +1,27 @@
1
- - content_for :page_title do
2
- = Spree.t(:stock_requests)
3
- - content_for :page_actions do
4
- %li= link_to_with_icon 'icon-arrow-left', Spree.t(:back_to_reports_list), spree.admin_reports_url, :class => 'button'
5
- - content_for :table_filter_title do
6
- = Spree.t(:date_range)
7
- - content_for :table_filter do
8
- = render :partial => 'spree/admin/shared/stock_report_criteria', :locals => {}
9
- %table.admin-report{"data-hook" => "stock_requests"}
10
- %thead
11
- %tr
12
- %th= sort_link @search, :email
13
- %th= Spree.t(:product)
14
- %th= Spree.t(:variant)
15
- %th= sort_link @search, :status
16
- %th= sort_link @search, :created_at, Spree.t(:requested)
17
- %tbody
18
- - @stock_requests.each do |stock_request|
19
- - next if stock_request.product.nil?
20
- %tr{:class => "cycle('even', 'odd')"}
21
- %td= stock_request.email
22
- %td= link_to stock_request.product.name, edit_admin_product_path(stock_request.product)
23
- %td= stock_request.variant.options_text if stock_request.variant
24
- %td= stock_request.status.titleize
25
- %td
26
- = time_ago_in_words(stock_request.created_at)
1
+ - content_for :page_title do
2
+ = Spree.t(:stock_requests)
3
+ - content_for :page_actions do
4
+ %li= link_to_with_icon 'icon-arrow-left', Spree.t(:back_to_reports_list), spree.admin_reports_url, :class => 'button'
5
+ - content_for :table_filter_title do
6
+ = Spree.t(:date_range)
7
+ - content_for :table_filter do
8
+ = render :partial => 'spree/admin/shared/stock_report_criteria', :locals => {}
9
+ %table.admin-report{"data-hook" => "stock_requests"}
10
+ %thead
11
+ %tr
12
+ %th= sort_link @search, :email
13
+ %th= Spree.t(:product)
14
+ %th= Spree.t(:variant)
15
+ %th= sort_link @search, :status
16
+ %th= sort_link @search, :created_at, Spree.t(:requested)
17
+ %tbody
18
+ - @stock_requests.each do |stock_request|
19
+ - next if stock_request.product.nil?
20
+ %tr{:class => "cycle('even', 'odd')"}
21
+ %td= stock_request.email
22
+ %td= link_to stock_request.product.name, edit_admin_product_path(stock_request.product)
23
+ %td= stock_request.variant.options_text if stock_request.variant
24
+ %td= stock_request.status.titleize
25
+ %td
26
+ = time_ago_in_words(stock_request.created_at)
27
27
  = Spree.t(:ago)
@@ -1,10 +1,10 @@
1
- = search_form_for @search, :url => spree.stock_requests_admin_reports_path do |s|
2
- .date-range-filter.field.align-center
3
- = label_tag nil, Spree.t(:start), :class => 'inline'
4
- = s.text_field :created_at_gt, :class => 'datepicker datepicker-from'
5
- %span.range-divider
6
- %i.icon-arrow-right
7
- = s.text_field :created_at_lt, :class => 'datepicker datepicker-to'
8
- = label_tag nil, Spree.t(:end), :class => 'inline'
9
- .actions.filter-actions
1
+ = search_form_for @search, :url => spree.stock_requests_admin_reports_path do |s|
2
+ .date-range-filter.field.align-center
3
+ = label_tag nil, Spree.t(:start), :class => 'inline'
4
+ = s.text_field :created_at_gt, :class => 'datepicker datepicker-from'
5
+ %span.range-divider
6
+ %i.icon-arrow-right
7
+ = s.text_field :created_at_lt, :class => 'datepicker datepicker-to'
8
+ = label_tag nil, Spree.t(:end), :class => 'inline'
9
+ .actions.filter-actions
10
10
  = button Spree.t(:search), 'icon-search'
@@ -1 +1 @@
1
- alert('You have been added to the waiting list!');
1
+ alert('You have been added to the waiting list!');
@@ -1,12 +1,11 @@
1
- %h1= Spree.t(:new_stock_request)
2
- = render "spree/shared/error_messages", :target => @stock_request
3
- = form_for @stock_request do |f|
4
- = f.hidden_field :product_id
5
- = f.hidden_field :variant_id
6
- %p
7
- = f.label :email
8
- - if spree_current_user
9
- = spree_current_user.email
10
- - else
11
- = f.text_field :email
1
+ %h1= Spree.t(:new_stock_request)
2
+ = render "spree/shared/error_messages", :target => @stock_request
3
+ = form_for @stock_request do |f|
4
+ = f.hidden_field :variant_id
5
+ %p
6
+ = f.label :email
7
+ - if spree_current_user
8
+ = spree_current_user.email
9
+ - else
10
+ = f.text_field :email
12
11
  = f.submit Spree.t(:submit_stock_request)
@@ -1 +1 @@
1
- <%= link_to @product.name, @product %> is back in stock
1
+ <%= link_to @product.name, @product %> is back in stock
@@ -1,31 +1,31 @@
1
- module SpreeWaitingList
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
-
5
- class_option :auto_run_migrations, :type => :boolean, :default => false
6
-
7
- def add_javascripts
8
- # append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_waiting_list\n"
9
- # append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_waiting_list\n"
10
- end
11
-
12
- def add_stylesheets
13
- # inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_waiting_list\n", :before => /\*\//, :verbose => true
14
- # inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_waiting_list\n", :before => /\*\//, :verbose => true
15
- end
16
-
17
- def add_migrations
18
- run 'bundle exec rake railties:install:migrations FROM=spree_waiting_list'
19
- end
20
-
21
- def run_migrations
22
- run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
23
- if run_migrations
24
- run 'bundle exec rake db:migrate'
25
- else
26
- puts 'Skipping rake db:migrate, don\'t forget to run it!'
27
- end
28
- end
29
- end
30
- end
31
- end
1
+ module SpreeWaitingList
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+
5
+ class_option :auto_run_migrations, :type => :boolean, :default => false
6
+
7
+ def add_javascripts
8
+ # append_file 'vendor/assets/javascripts/spree/frontend/all.js', "//= require spree/frontend/spree_waiting_list\n"
9
+ # append_file 'vendor/assets/javascripts/spree/backend/all.js', "//= require spree/backend/spree_waiting_list\n"
10
+ end
11
+
12
+ def add_stylesheets
13
+ # inject_into_file 'vendor/assets/stylesheets/spree/frontend/all.css', " *= require spree/frontend/spree_waiting_list\n", :before => /\*\//, :verbose => true
14
+ # inject_into_file 'vendor/assets/stylesheets/spree/backend/all.css', " *= require spree/backend/spree_waiting_list\n", :before => /\*\//, :verbose => true
15
+ end
16
+
17
+ def add_migrations
18
+ run 'bundle exec rake railties:install:migrations FROM=spree_waiting_list'
19
+ end
20
+
21
+ def run_migrations
22
+ run_migrations = options[:auto_run_migrations] || ['', 'y', 'Y'].include?(ask 'Would you like to run the migrations now? [Y/n]')
23
+ if run_migrations
24
+ run 'bundle exec rake db:migrate'
25
+ else
26
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -1,21 +1,21 @@
1
- module SpreeWaitingList
2
- class Engine < Rails::Engine
3
- require 'spree/core'
4
- isolate_namespace Spree
5
- engine_name 'spree_waiting_list'
6
-
7
- # use rspec for tests
8
- config.generators do |g|
9
- g.test_framework :rspec
10
- end
11
-
12
- def self.activate
13
- Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
14
- Rails.configuration.cache_classes ? require(c) : load(c)
15
- end
16
- end
17
-
18
- config.to_prepare &method(:activate).to_proc
19
-
20
- end
21
- end
1
+ module SpreeWaitingList
2
+ class Engine < Rails::Engine
3
+ require 'spree/core'
4
+ isolate_namespace Spree
5
+ engine_name 'spree_waiting_list'
6
+
7
+ # use rspec for tests
8
+ config.generators do |g|
9
+ g.test_framework :rspec
10
+ end
11
+
12
+ def self.activate
13
+ Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
14
+ Rails.configuration.cache_classes ? require(c) : load(c)
15
+ end
16
+ end
17
+
18
+ config.to_prepare &method(:activate).to_proc
19
+
20
+ end
21
+ end
@@ -1,9 +1,8 @@
1
- FactoryGirl.define do
2
-
3
- factory :stock_request, class: Spree::StockRequest do
4
- product
5
- variant {product.master}
6
- email 'test@home.org'
7
- end
8
-
1
+ FactoryGirl.define do
2
+
3
+ factory :stock_request, class: Spree::StockRequest do
4
+ variant
5
+ email 'test@home.org'
6
+ end
7
+
9
8
  end
@@ -1,3 +1,3 @@
1
- require 'spree_core'
2
- require 'spree_waiting_list/engine'
1
+ require 'spree_core'
2
+ require 'spree_waiting_list/engine'
3
3
  require 'haml'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_waiting_list
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Nussbaum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-17 00:00:00.000000000 Z
11
+ date: 2015-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: spree_core
@@ -191,7 +191,6 @@ files:
191
191
  - app/controllers/spree/stock_requests_controller.rb
192
192
  - app/mailers/spree/user_mailer_decorator.rb
193
193
  - app/models/spree/permitted_attributes_decorator.rb
194
- - app/models/spree/product_decorator.rb
195
194
  - app/models/spree/stock_item_decorator.rb
196
195
  - app/models/spree/stock_request.rb
197
196
  - app/models/spree/variant_decorator.rb
@@ -225,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
224
  requirements:
226
225
  - none
227
226
  rubyforge_project:
228
- rubygems_version: 2.4.3
227
+ rubygems_version: 2.2.2
229
228
  signing_key:
230
229
  specification_version: 4
231
230
  summary: Add a waiting list to your spree store
@@ -1,7 +0,0 @@
1
- Spree::Product.class_eval do
2
- has_many :stock_requests
3
-
4
- def notify_waiting_list
5
- stock_requests.without_variant.notified(false).each &:notify!
6
- end
7
- end