devise_subscribable 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +20 -0
- data/app/controllers/devise/subscribes_controller.rb +12 -0
- data/app/views/devise/subscribes/update.html.erb +1 -0
- data/config/locales/en.yml +4 -0
- data/lib/devise_subscribable.rb +15 -0
- data/lib/devise_subscribable/mapping.rb +13 -0
- data/lib/devise_subscribable/model.rb +7 -0
- data/lib/devise_subscribable/rails.rb +9 -0
- data/lib/devise_subscribable/routes.rb +12 -0
- data/lib/devise_subscribable/version.rb +3 -0
- metadata +68 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8298755393660124358a4331d2fc33cdc3db44d0
|
4
|
+
data.tar.gz: 3c52ca51d24761571941abf0587f022cf83dd871
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e23f975462ad65986d74474a84ef44763d253b97019ea25147ea9c4997744e8c24542e4115f11313bbd304d63869e828a5f504b4129b661075d166aafbc13a52
|
7
|
+
data.tar.gz: 311a9b7f5125e6d0d429c00f2e304aa8c265770f931364ad32183ab7e0e8f37f3b6365360c30508cf33ecad8484a3cdd1cb9aad8845252ad71c1169c1456a05f
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 Masahiro Saito
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class Devise::SubscribesController < DeviseController
|
2
|
+
|
3
|
+
# GET /resource/subscribe/unsubscribe?unsubscribe_token=abcdef
|
4
|
+
def update
|
5
|
+
unless params[:unsubscribe_token] && self.resource = resource_class.find_by_unsubscribe_token(params[:unsubscribe_token])
|
6
|
+
set_flash_message(:alert, :unsubscribe_token_invalid)
|
7
|
+
return redirect_to after_sign_out_path_for(resource_name)
|
8
|
+
end
|
9
|
+
resource.update_column :subscribe, false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
<p><%= t "devise.subscribes.unsubscribe" %></p>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module DeviseSubscribable
|
2
|
+
autoload :Mapping, 'devise_subscribable/mapping'
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'devise'
|
6
|
+
require 'devise_subscribable/routes'
|
7
|
+
require 'devise_subscribable/rails'
|
8
|
+
|
9
|
+
module Devise
|
10
|
+
# TODO: Add instance accessors
|
11
|
+
end
|
12
|
+
|
13
|
+
Devise.add_module :subscribable, :controller => :subscribes,
|
14
|
+
:model => 'devise_subscribable/model',
|
15
|
+
:route => {:subscribe => []}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module DeviseSubscribable
|
2
|
+
module Mapping
|
3
|
+
def self.included(base)
|
4
|
+
base.alias_method_chain :default_controllers, :subscribable
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
def default_controllers_with_subscribable(options)
|
9
|
+
options[:controllers] ||= {}
|
10
|
+
default_controllers_without_subscribable(options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module ActionDispatch::Routing
|
2
|
+
class Mapper
|
3
|
+
|
4
|
+
protected
|
5
|
+
def devise_subscribe(mapping, controllers)
|
6
|
+
resource :subscribe, :only => [:unsubscribe] do
|
7
|
+
get :update, :controller => controllers[:subscribes],
|
8
|
+
:path => mapping.path_names[:unsubscribe], :as => :unsubscribe
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: devise_subscribable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- camelmasa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: devise
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 3.2.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 3.2.0
|
27
|
+
description: ''
|
28
|
+
email:
|
29
|
+
- camelmasa@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- LICENSE
|
35
|
+
- app/controllers/devise/subscribes_controller.rb
|
36
|
+
- app/views/devise/subscribes/update.html.erb
|
37
|
+
- config/locales/en.yml
|
38
|
+
- lib/devise_subscribable.rb
|
39
|
+
- lib/devise_subscribable/mapping.rb
|
40
|
+
- lib/devise_subscribable/model.rb
|
41
|
+
- lib/devise_subscribable/rails.rb
|
42
|
+
- lib/devise_subscribable/routes.rb
|
43
|
+
- lib/devise_subscribable/version.rb
|
44
|
+
homepage: https://github.com/camelmasa/devise_subscribable
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
metadata: {}
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.8.6
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.3.6
|
62
|
+
requirements: []
|
63
|
+
rubyforge_project:
|
64
|
+
rubygems_version: 2.2.2
|
65
|
+
signing_key:
|
66
|
+
specification_version: 4
|
67
|
+
summary: ''
|
68
|
+
test_files: []
|