spree_waiting_list 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- metadata +3 -22
- data/LICENSE +0 -23
- data/README.md +0 -45
- data/app/controllers/spree/admin/reports_controller_decorator.rb +0 -8
- data/app/controllers/spree/stock_requests_controller.rb +0 -31
- data/app/mailers/spree/user_mailer_decorator.rb +0 -11
- data/app/models/spree/permitted_attributes_decorator.rb +0 -13
- data/app/models/spree/stock_item_decorator.rb +0 -16
- data/app/models/spree/stock_request.rb +0 -28
- data/app/models/spree/variant_decorator.rb +0 -13
- data/app/views/spree/admin/reports/stock_requests.csv.erb +0 -9
- data/app/views/spree/admin/reports/stock_requests.html.haml +0 -27
- data/app/views/spree/admin/shared/_stock_report_criteria.html.haml +0 -10
- data/app/views/spree/stock_requests/create.js.erb +0 -1
- data/app/views/spree/stock_requests/new.html.haml +0 -11
- data/app/views/spree/user_mailer/back_in_stock.text.erb +0 -1
- data/lib/generators/spree_waiting_list/install/install_generator.rb +0 -31
- data/lib/spree_waiting_list/engine.rb +0 -21
- data/lib/spree_waiting_list/factories.rb +0 -8
- data/lib/spree_waiting_list.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6428996ed78ef117f6e7b97f3199967bfe716a4
|
4
|
+
data.tar.gz: 68d879b9d928998cb64337b474c6fe9befbe0d23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5cff40a9ffbc90d2aa505b1ec3eb7378deb53abe165408223396406e2590ef555959ac3b35fb8103517abd6d72e1d61a131a60e589b83e44a305024acb14225
|
7
|
+
data.tar.gz: 12b89d1444d8a21df61e1179d64dbc754c9b1383b18b55f13e0523c63a5d537a7ff02171fcc37fba1dcc26d554d20749df3e33d76e5f5df8a9585ea816d63618
|
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.2
|
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-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: spree_core
|
@@ -184,26 +184,7 @@ email: joshnuss@gmail.com
|
|
184
184
|
executables: []
|
185
185
|
extensions: []
|
186
186
|
extra_rdoc_files: []
|
187
|
-
files:
|
188
|
-
- LICENSE
|
189
|
-
- README.md
|
190
|
-
- app/controllers/spree/admin/reports_controller_decorator.rb
|
191
|
-
- app/controllers/spree/stock_requests_controller.rb
|
192
|
-
- app/mailers/spree/user_mailer_decorator.rb
|
193
|
-
- app/models/spree/permitted_attributes_decorator.rb
|
194
|
-
- app/models/spree/stock_item_decorator.rb
|
195
|
-
- app/models/spree/stock_request.rb
|
196
|
-
- app/models/spree/variant_decorator.rb
|
197
|
-
- app/views/spree/admin/reports/stock_requests.csv.erb
|
198
|
-
- app/views/spree/admin/reports/stock_requests.html.haml
|
199
|
-
- app/views/spree/admin/shared/_stock_report_criteria.html.haml
|
200
|
-
- app/views/spree/stock_requests/create.js.erb
|
201
|
-
- app/views/spree/stock_requests/new.html.haml
|
202
|
-
- app/views/spree/user_mailer/back_in_stock.text.erb
|
203
|
-
- lib/generators/spree_waiting_list/install/install_generator.rb
|
204
|
-
- lib/spree_waiting_list.rb
|
205
|
-
- lib/spree_waiting_list/engine.rb
|
206
|
-
- lib/spree_waiting_list/factories.rb
|
187
|
+
files: []
|
207
188
|
homepage: http://www.godynamo.com
|
208
189
|
licenses: []
|
209
190
|
metadata: {}
|
data/LICENSE
DELETED
@@ -1,23 +0,0 @@
|
|
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
|
-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
Spree Waiting List
|
2
|
-
================
|
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
|
-
|
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 should be regenerated by using `rake test_app`.
|
30
|
-
|
31
|
-
```shell
|
32
|
-
bundle
|
33
|
-
bundle exec rake test_app
|
34
|
-
bundle exec rspec spec
|
35
|
-
```
|
36
|
-
|
37
|
-
When testing your applications integration with this extension you may use it's factories.
|
38
|
-
Simply add this require statement to your spec_helper:
|
39
|
-
|
40
|
-
```ruby
|
41
|
-
require 'spree_waiting_list/factories'
|
42
|
-
```
|
43
|
-
|
44
|
-
|
45
|
-
Copyright (c) 2015 Joshua Nussbaum, released under the New BSD License
|
@@ -1,31 +0,0 @@
|
|
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
|
-
format.json { render json: { status: 201, message: Spree.t(:successful_stock_request) } }
|
18
|
-
else
|
19
|
-
format.html { render action: 'new'}
|
20
|
-
format.json { render json: @stock_request.errors, status: :unprocessable_entity }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
private
|
26
|
-
|
27
|
-
def stock_request_params
|
28
|
-
params.require(:stock_request).permit(permitted_attributes.stock_request_attributes)
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
@@ -1,11 +0,0 @@
|
|
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
|
-
end
|
@@ -1,13 +0,0 @@
|
|
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,16 +0,0 @@
|
|
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,28 +0,0 @@
|
|
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,9 +0,0 @@
|
|
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
|
-
<% end %>
|
@@ -1,27 +0,0 @@
|
|
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
|
-
= Spree.t(:ago)
|
@@ -1,10 +0,0 @@
|
|
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
|
-
= button Spree.t(:search), 'icon-search'
|
@@ -1 +0,0 @@
|
|
1
|
-
alert('You have been added to the waiting list!');
|
@@ -1,11 +0,0 @@
|
|
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
|
11
|
-
= f.submit Spree.t(:submit_stock_request)
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= link_to @product.name, @product %> is back in stock
|
@@ -1,31 +0,0 @@
|
|
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 +0,0 @@
|
|
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
DELETED