spree_waiting_list 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +22 -22
- data/README.md +3 -2
- data/app/controllers/spree/stock_requests_controller.rb +3 -2
- data/app/mailers/spree/user_mailer_decorator.rb +10 -10
- data/app/models/spree/variant_decorator.rb +5 -4
- data/app/views/spree/admin/reports/stock_requests.html.haml +26 -26
- data/app/views/spree/admin/shared/_stock_report_criteria.html.haml +9 -9
- data/app/views/spree/stock_requests/create.js.erb +1 -1
- data/app/views/spree/user_mailer/back_in_stock.text.erb +1 -1
- data/lib/generators/spree_waiting_list/install/install_generator.rb +31 -31
- data/lib/spree_waiting_list/engine.rb +21 -21
- data/lib/spree_waiting_list/factories.rb +1 -1
- data/lib/spree_waiting_list.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bcdbd84392afec13a97c161b05d47be675a7b2f
|
4
|
+
data.tar.gz: 9831bea09887d8aef48fa3060275e0f861590a68
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43b5cce15046ee7cebc9813303e2acf390375017ba3e2b642d0a06f7585f02f636f98290a74780e7bfa2606846ea710e184d520fc7c96dc98604879ab2cb6f8b
|
7
|
+
data.tar.gz: 889d873ba751c12893b601f0cadf992d4ec7e47b9c072585ed5cac325d16efd060e1787882d2eabb7d7914005c8a829761915f3a0a8f1aa7c3c68d79637d563b
|
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,6 +1,6 @@
|
|
1
1
|
Spree Waiting List
|
2
2
|
================
|
3
|
-
[![Code Climate](https://codeclimate.com/github/DynamoMTL/spree_waiting_list/badges/gpa.svg)](https://codeclimate.com/github/DynamoMTL/spree_waiting_list) [![
|
3
|
+
[![Build Status](https://travis-ci.org/DynamoMTL/spree_waiting_list.svg?branch=master)](https://travis-ci.org/DynamoMTL/spree_waiting_list) [![Code Climate](https://codeclimate.com/github/DynamoMTL/spree_waiting_list/badges/gpa.svg)](https://codeclimate.com/github/DynamoMTL/spree_waiting_list) [![Test Coverage](https://codeclimate.com/github/DynamoMTL/spree_waiting_list/badges/coverage.svg)](https://codeclimate.com/github/DynamoMTL/spree_waiting_list) [![Gem Version](https://badge.fury.io/rb/spree_waiting_list.svg)](http://badge.fury.io/rb/spree_waiting_list)
|
4
4
|
|
5
5
|
A waiting list extension for Spree.
|
6
6
|
|
@@ -26,10 +26,11 @@ bundle exec rails g spree_waiting_list:install
|
|
26
26
|
Testing
|
27
27
|
-------
|
28
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
|
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 should be regenerated by using `rake test_app`.
|
30
30
|
|
31
31
|
```shell
|
32
32
|
bundle
|
33
|
+
bundle exec rake test_app
|
33
34
|
bundle exec rspec spec
|
34
35
|
```
|
35
36
|
|
@@ -12,10 +12,11 @@ module Spree
|
|
12
12
|
|
13
13
|
respond_to do |format|
|
14
14
|
if @stock_request.save
|
15
|
-
format.html { redirect_to root_path, :
|
15
|
+
format.html { redirect_to root_path, notice: Spree.t(:successful_stock_request) }
|
16
16
|
format.js
|
17
|
+
format.json { render json: { status: 201, message: Spree.t(:successful_stock_request) } }
|
17
18
|
else
|
18
|
-
format.html { render :
|
19
|
+
format.html { render action: 'new'}
|
19
20
|
format.json { render json: @stock_request.errors, status: :unprocessable_entity }
|
20
21
|
end
|
21
22
|
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,12 +1,13 @@
|
|
1
1
|
module Spree
|
2
|
-
|
3
2
|
Variant.class_eval do
|
4
3
|
has_many :stock_requests
|
5
4
|
|
5
|
+
def waiting_list
|
6
|
+
stock_requests.notified(false)
|
7
|
+
end
|
8
|
+
|
6
9
|
def notify_waiting_list
|
7
|
-
|
8
|
-
product.notify_waiting_list
|
10
|
+
waiting_list.each &:notify!
|
9
11
|
end
|
10
12
|
end
|
11
|
-
|
12
13
|
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 +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
|
data/lib/spree_waiting_list.rb
CHANGED
@@ -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: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Nussbaum
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
requirements:
|
225
225
|
- none
|
226
226
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.
|
227
|
+
rubygems_version: 2.4.3
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: Add a waiting list to your spree store
|