activity_notification 1.5.1 → 1.6.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +51 -3
- data/app/controllers/activity_notification/notifications_controller.rb +1 -1
- data/app/controllers/activity_notification/subscriptions_controller.rb +2 -1
- data/app/views/activity_notification/notifications/default/_default.html.erb +10 -10
- data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +10 -10
- data/app/views/activity_notification/notifications/default/_index.html.erb +3 -3
- data/app/views/activity_notification/notifications/default/index.html.erb +7 -7
- data/app/views/activity_notification/notifications/default/open.js.erb +2 -2
- data/app/views/activity_notification/notifications/default/open_all.js.erb +2 -2
- data/app/views/activity_notification/notifications/default/show.html.erb +2 -2
- data/app/views/activity_notification/optional_targets/default/base/_default.text.erb +1 -1
- data/app/views/activity_notification/optional_targets/default/slack/_default.text.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +2 -2
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +5 -5
- data/app/views/activity_notification/subscriptions/default/show.html.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb +1 -1
- data/lib/activity_notification/apis/subscription_api.rb +2 -2
- data/lib/activity_notification/controllers/devise_authentication_controller.rb +16 -0
- data/lib/activity_notification/helpers/view_helpers.rb +113 -27
- data/lib/activity_notification/models/concerns/subscriber.rb +2 -1
- data/lib/activity_notification/models/concerns/target.rb +11 -0
- data/lib/activity_notification/rails/routes.rb +169 -40
- data/lib/activity_notification/roles/acts_as_target.rb +45 -8
- data/lib/activity_notification/version.rb +1 -1
- data/spec/controllers/notifications_with_devise_controller_spec.rb +15 -0
- data/spec/controllers/subscriptions_controller_shared_examples.rb +4 -3
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +15 -0
- data/spec/helpers/view_helpers_spec.rb +1 -1
- data/spec/rails_app/app/controllers/articles_controller.rb +2 -0
- data/spec/rails_app/app/models/admin.rb +2 -0
- data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +1 -1
- data/spec/rails_app/app/views/articles/index.html.erb +36 -32
- data/spec/rails_app/app/views/layouts/_header.html.erb +9 -1
- data/spec/rails_app/config/routes.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24f6a30a0e5feec1ffcb217bf78fa3283f4e369b
|
4
|
+
data.tar.gz: efc4c998546752ccc9bca15a2d6d35e93d9e13eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c30d75ab0300d5895d341fe7ca2f89b039a0cc5db82c9708b335409557aa49da457e81a74a29ad4c01b0d28f93a4abf5d7652effbaad4e0e58a337187361d743
|
7
|
+
data.tar.gz: 81698f2ec06b1cc880555a1103e24348f00ab2209621e47c3b2336dc0fb747ee96f765decca07b5e6ac230455927616d393c748efa90f31f294fa3dc8d0f618a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
## 1.6.0 / 2018-11-11
|
2
|
+
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.5.1...v1.6.0)
|
3
|
+
|
4
|
+
Enhancements:
|
5
|
+
|
6
|
+
* Add simple default routes with devise integration - [#64](https://github.com/simukappu/activity_notification/issues/64)
|
7
|
+
|
8
|
+
Bug Fixes:
|
9
|
+
|
10
|
+
* Update *Subscription.optional_targets* into HashWithIndifferentAccess to fix subscriptions with mongoid
|
11
|
+
|
1
12
|
## 1.5.1 / 2018-08-26
|
2
13
|
[Full Changelog](http://github.com/simukappu/activity_notification/compare/v1.5.0...v1.5.1)
|
3
14
|
|
data/README.md
CHANGED
@@ -57,6 +57,7 @@
|
|
57
57
|
- [Advanced notifiable path](#advanced-notifiable-path)
|
58
58
|
- [Configuring views](#configuring-views)
|
59
59
|
- [Configuring routes](#configuring-routes)
|
60
|
+
- [Routes with scope](#routes-with-scope)
|
60
61
|
- [Creating notifications](#creating-notifications)
|
61
62
|
- [Notification API](#notification-api)
|
62
63
|
- [Automatic tracked notifications](#automatic-tracked-notifications)
|
@@ -83,6 +84,9 @@
|
|
83
84
|
- [Managing subscriptions](#managing-subscriptions)
|
84
85
|
- [Customizing subscriptions](#customizing-subscriptions)
|
85
86
|
- [Integration with Devise](#integration-with-devise)
|
87
|
+
- [Configuring integration with Devise](#configuring-integration-with-devise)
|
88
|
+
- [Using different model as target](#using-different-model-as-target)
|
89
|
+
- [Configuring simple default routes](#configuring-simple-default-routes)
|
86
90
|
- [Optional notification targets](#optional-notification-targets)
|
87
91
|
- [Configuring optional targets](#configuring-optional-targets)
|
88
92
|
- [Customizing message format](#customizing-message-format)
|
@@ -318,7 +322,22 @@ Rails.application.routes.draw do
|
|
318
322
|
end
|
319
323
|
```
|
320
324
|
|
321
|
-
Then, you can access several pages like
|
325
|
+
Then, you can access several pages like */users/1/notifications* and manage open/unopen of notifications using **notifications_controller**.
|
326
|
+
If you use Devise integration and you want to configure simple default routes for authenticated users, see [Configuring simple default routes](#configuring-simple-default-routes).
|
327
|
+
|
328
|
+
#### Routes with scope
|
329
|
+
|
330
|
+
You can also configure *activity_notification* routes with scope like this:
|
331
|
+
|
332
|
+
```ruby
|
333
|
+
Rails.application.routes.draw do
|
334
|
+
scope :myscope, as: :myscope do
|
335
|
+
notify_to :users, routing_scope: :myscope
|
336
|
+
end
|
337
|
+
end
|
338
|
+
```
|
339
|
+
|
340
|
+
Then, pages are shown as */myscope/users/1/notifications*.
|
322
341
|
|
323
342
|
### Creating notifications
|
324
343
|
|
@@ -914,7 +933,9 @@ If you would like to customize subscription controllers or views, you can use ge
|
|
914
933
|
|
915
934
|
*activity_notification* supports to integrate with devise authentication.
|
916
935
|
|
917
|
-
|
936
|
+
#### Configuring integration with Devise
|
937
|
+
|
938
|
+
Add **:with_devise** option in notification routing to *config/routes.rb* for the target:
|
918
939
|
|
919
940
|
```ruby
|
920
941
|
Rails.application.routes.draw do
|
@@ -928,6 +949,8 @@ Then *activity_notification* will use **notifications_with_devise_controller** a
|
|
928
949
|
|
929
950
|
*Hint*: HTTP 403 Forbidden will be returned for unauthorized notifications.
|
930
951
|
|
952
|
+
#### Using different model as target
|
953
|
+
|
931
954
|
You can also use different model from Devise resource as a target. When you will add this to *config/routes.rb*:
|
932
955
|
|
933
956
|
```ruby
|
@@ -948,7 +971,32 @@ end
|
|
948
971
|
```
|
949
972
|
|
950
973
|
*activity_notification* will authenticate *:admins* notifications with devise authentication for *:users*.
|
951
|
-
In this example *activity_notification* will confirm
|
974
|
+
In this example, *activity_notification* will confirm *admin* belonging to authenticated *user* by Devise.
|
975
|
+
|
976
|
+
#### Configuring simple default routes
|
977
|
+
|
978
|
+
You can configure simple default routes for authenticated users, like */notifications* instead of */users/1/notifications*. Use *:devise_default_routes* option like this:
|
979
|
+
|
980
|
+
```ruby
|
981
|
+
Rails.application.routes.draw do
|
982
|
+
devise_for :users
|
983
|
+
notify_to :users, with_devise: :users, devise_default_routes: true
|
984
|
+
end
|
985
|
+
```
|
986
|
+
|
987
|
+
If you use multiple notification targets with Devise, you can also use this option with scope like this:
|
988
|
+
|
989
|
+
```ruby
|
990
|
+
Rails.application.routes.draw do
|
991
|
+
devise_for :users
|
992
|
+
# Integrated with devise for different model, and use with scope
|
993
|
+
scope :admins, as: :admins do
|
994
|
+
notify_to :admins, with_devise: :users, devise_default_routes: true, routing_scope: :admins
|
995
|
+
end
|
996
|
+
end
|
997
|
+
```
|
998
|
+
|
999
|
+
Then, you can access */admins/notifications* instead of */admins/1/notifications*.
|
952
1000
|
|
953
1001
|
|
954
1002
|
### Optional notification targets
|
@@ -135,7 +135,7 @@ module ActivityNotification
|
|
135
135
|
params[:reverse].to_s.to_boolean(false) : nil
|
136
136
|
with_group_members = params[:with_group_members].present? || params[:without_grouping].present? ?
|
137
137
|
params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false) : nil
|
138
|
-
@index_options = params.permit(:filter, :filtered_by_type, :filtered_by_group_type, :filtered_by_group_id, :filtered_by_key)
|
138
|
+
@index_options = params.permit(:filter, :filtered_by_type, :filtered_by_group_type, :filtered_by_group_id, :filtered_by_key, :routing_scope, :devise_default_routes)
|
139
139
|
.to_h.symbolize_keys
|
140
140
|
.merge(limit: limit, reverse: reverse, with_group_members: with_group_members)
|
141
141
|
end
|
@@ -52,6 +52,7 @@ module ActivityNotification
|
|
52
52
|
# @param [Hash] params Request parameters
|
53
53
|
# @return [Responce] HTML view as default
|
54
54
|
def show
|
55
|
+
set_index_options
|
55
56
|
end
|
56
57
|
|
57
58
|
# Deletes a subscription.
|
@@ -190,7 +191,7 @@ module ActivityNotification
|
|
190
191
|
limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil
|
191
192
|
reverse = params[:reverse].present? ?
|
192
193
|
params[:reverse].to_s.to_boolean(false) : nil
|
193
|
-
@index_options = params.permit(:filter, :filtered_by_key)
|
194
|
+
@index_options = params.permit(:filter, :filtered_by_key, :routing_scope, :devise_default_routes)
|
194
195
|
.to_h.symbolize_keys.merge(limit: limit, reverse: reverse)
|
195
196
|
end
|
196
197
|
|
@@ -34,31 +34,31 @@
|
|
34
34
|
|
35
35
|
<div class='<%= "notification_#{notification.id}" %>'>
|
36
36
|
<% if notification.unopened? %>
|
37
|
-
<%= link_to open_notification_path_for(notification, reload: false), method: :post, remote: true, class: "unopened_wrapper" do %>
|
37
|
+
<%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :post, remote: true, class: "unopened_wrapper" do %>
|
38
38
|
<div class="unopned_circle"></div>
|
39
39
|
<div class="unopned_description_wrapper">
|
40
40
|
<p class="unopned_description">Open</p>
|
41
41
|
</div>
|
42
42
|
<% end %>
|
43
|
-
<%= link_to open_notification_path_for(notification, move: true), method: :post do %>
|
43
|
+
<%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :post do %>
|
44
44
|
<%= yield :notification_content %>
|
45
45
|
<% end %>
|
46
46
|
<div class="unopened_wrapper"></div>
|
47
47
|
<% else %>
|
48
|
-
<%= link_to move_notification_path_for(notification) do %>
|
48
|
+
<%= link_to move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) do %>
|
49
49
|
<%= yield :notification_content %>
|
50
50
|
<% end %>
|
51
51
|
<% end %>
|
52
52
|
|
53
|
-
<%#= link_to "Move", move_notification_path_for(notification) %>
|
53
|
+
<%#= link_to "Move", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) %>
|
54
54
|
<%# if notification.unopened? %>
|
55
|
-
<%#= link_to "Open and move (GET)", move_notification_path_for(notification, open: true) %>
|
56
|
-
<%#= link_to "Open and move (POST)", open_notification_path_for(notification, move: true), method: :post %>
|
57
|
-
<%#= link_to "Open", open_notification_path_for(notification, index_options: @index_options), method: :post %>
|
58
|
-
<%#= link_to "Open (Ajax)", open_notification_path_for(notification, reload: false), method: :post, remote: true %>
|
55
|
+
<%#= link_to "Open and move (GET)", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(open: true)) %>
|
56
|
+
<%#= link_to "Open and move (POST)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :post %>
|
57
|
+
<%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options))), method: :post %>
|
58
|
+
<%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :post, remote: true %>
|
59
59
|
<%# end %>
|
60
|
-
<%#= link_to "Destroy", notification_path_for(notification, index_options: @index_options), method: :delete %>
|
61
|
-
<%#= link_to "Destroy (Ajax)", notification_path_for(notification, reload: false), method: :delete, remote: true %>
|
60
|
+
<%#= link_to "Destroy", notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :delete %>
|
61
|
+
<%#= link_to "Destroy (Ajax)", notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :delete, remote: true %>
|
62
62
|
|
63
63
|
</div>
|
64
64
|
|
data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb
CHANGED
@@ -23,31 +23,31 @@
|
|
23
23
|
|
24
24
|
<div class='<%= "notification_#{notification.id}" %>'>
|
25
25
|
<% if notification.unopened? %>
|
26
|
-
<%= link_to open_notification_path_for(notification,
|
26
|
+
<%= link_to open_notification_path_for(notification, parameters.slice(:with_group_members, :routing_scope, :devise_default_routes).merge(reload: false), method: :post, remote: true, class: "unopened_wrapper" do %>
|
27
27
|
<div class="unopned_circle"></div>
|
28
28
|
<div class="unopned_description_wrapper">
|
29
29
|
<p class="unopned_description">Open</p>
|
30
30
|
</div>
|
31
31
|
<% end %>
|
32
|
-
<%= link_to open_notification_path_for(notification, move: true), method: :post do %>
|
32
|
+
<%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :post do %>
|
33
33
|
<%= yield :notification_content %>
|
34
34
|
<% end %>
|
35
35
|
<div class="unopened_wrapper"></div>
|
36
36
|
<% else %>
|
37
|
-
<%= link_to move_notification_path_for(notification) do %>
|
37
|
+
<%= link_to move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) do %>
|
38
38
|
<%= yield :notification_content %>
|
39
39
|
<% end %>
|
40
40
|
<% end %>
|
41
41
|
|
42
|
-
<%#= link_to "Move", move_notification_path_for(notification) %>
|
42
|
+
<%#= link_to "Move", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) %>
|
43
43
|
<%# if notification.unopened? %>
|
44
|
-
<%#= link_to "Open and move (GET)", move_notification_path_for(notification, open: true) %>
|
45
|
-
<%#= link_to "Open and move (POST)", open_notification_path_for(notification, move: true), method: :post %>
|
46
|
-
<%#= link_to "Open", open_notification_path_for(notification, index_options: @index_options), method: :post %>
|
47
|
-
<%#= link_to "Open (Ajax)", open_notification_path_for(notification,
|
44
|
+
<%#= link_to "Open and move (GET)", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(open: true)) %>
|
45
|
+
<%#= link_to "Open and move (POST)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :post %>
|
46
|
+
<%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :post %>
|
47
|
+
<%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(with_group_members:, :routing_scope, :devise_default_routes).merge(reload: false)), method: :post, remote: true %>
|
48
48
|
<%# end %>
|
49
|
-
<%#= link_to "Destroy", notification_path_for(notification, index_options: @index_options), method: :delete %>
|
50
|
-
<%#= link_to "Destroy (Ajax)", notification_path_for(notification,
|
49
|
+
<%#= link_to "Destroy", notification_path_for(notification, index_options: parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :delete %>
|
50
|
+
<%#= link_to "Destroy (Ajax)", notification_path_for(notification, parameters.slice(with_group_members:, :routing_scope, :devise_default_routes).merge(reload: false)), method: :delete, remote: true %>
|
51
51
|
|
52
52
|
</div>
|
53
53
|
|
@@ -12,16 +12,16 @@
|
|
12
12
|
Notifications
|
13
13
|
</p>
|
14
14
|
<p class="notification_header_menu">
|
15
|
-
<%= link_to "Open all", open_all_notifications_path_for(@target, parameters), method: :post, remote: true %>
|
15
|
+
<%= link_to "Open all", open_all_notifications_path_for(@target, parameters.slice(:routing_scope, :devise_default_routes)), method: :post, remote: true %>
|
16
16
|
<% if @target.class.subscription_enabled? %>
|
17
|
-
<%= link_to "Subscriptions", subscriptions_path_for(@target) %>
|
17
|
+
<%= link_to "Subscriptions", subscriptions_path_for(@target, parameters.slice(:routing_scope, :devise_default_routes)) %>
|
18
18
|
<% end %>
|
19
19
|
</p>
|
20
20
|
</div>
|
21
21
|
<div class="notifications">
|
22
22
|
<%= yield :notification_index %>
|
23
23
|
</div>
|
24
|
-
<%= link_to notifications_path_for(@target) do %>
|
24
|
+
<%= link_to notifications_path_for(@target, parameters.slice(:routing_scope, :devise_default_routes)) do %>
|
25
25
|
<div class="notification_link_wrapper">
|
26
26
|
<p class="notification_link">
|
27
27
|
See notifications
|
@@ -1,20 +1,20 @@
|
|
1
1
|
<div class="notification_wrapper">
|
2
2
|
<div class="notification_header">
|
3
|
-
<h1>Notifications to <%= @target.printable_target_name %> <%= link_to open_all_notifications_path_for(@target, @index_options), method: :post, remote: true do %><span class="notification_count"><span class="<%= 'unopened' if @target.has_unopened_notifications?(@index_options) %>"><%= @target.unopened_notification_count(@index_options) %></span></span><% end %></h1>
|
3
|
+
<h1>Notifications to <%= @target.printable_target_name %> <%= link_to open_all_notifications_path_for(@target, @index_options.slice(:routing_scope, :devise_default_routes)), method: :post, remote: true do %><span class="notification_count"><span class="<%= 'unopened' if @target.has_unopened_notifications?(@index_options) %>"><%= @target.unopened_notification_count(@index_options) %></span></span><% end %></h1>
|
4
4
|
</div>
|
5
5
|
<div class="notifications">
|
6
6
|
<% if @index_options[:with_group_members] %>
|
7
|
-
<%= render_notification @notifications, fallback: :default_without_grouping, with_group_members: true %>
|
7
|
+
<%= render_notification @notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default_without_grouping, with_group_members: true) %>
|
8
8
|
<% else %>
|
9
|
-
<%= render_notification @notifications, fallback: :default %>
|
10
|
-
<%#= render_notification @notifications, fallback: :text %>
|
9
|
+
<%= render_notification @notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default) %>
|
10
|
+
<%#= render_notification @notifications, @index_options.merge(fallback: :text) %>
|
11
11
|
<% end %>
|
12
12
|
</div>
|
13
13
|
</div>
|
14
14
|
|
15
|
-
<%#= render_notifications_of @target, fallback: :default, index_content: :with_attributes %>
|
16
|
-
<%#= render_notifications_of @target, fallback: :default, index_content: :unopened_with_attributes, reverse: true %>
|
17
|
-
<%#= render_notifications_of @target, fallback: :default_without_grouping, index_content: :with_attributes, with_group_members: true %>
|
15
|
+
<%#= render_notifications_of @target, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default, index_content: :with_attributes) %>
|
16
|
+
<%#= render_notifications_of @target, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default, index_content: :unopened_with_attributes, reverse: true) %>
|
17
|
+
<%#= render_notifications_of @target, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default_without_grouping, index_content: :with_attributes, with_group_members: true) %>
|
18
18
|
|
19
19
|
<style>
|
20
20
|
.notification_wrapper .notification_header h1 span span{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
$(".notification_count").html("<span class=\"<%= 'unopened' if @target.has_unopened_notifications?(@index_options) %>\"><%= @target.unopened_notification_count(@index_options) %></span>");
|
2
2
|
<% if @index_options[:with_group_members] %>
|
3
|
-
$('<%= ".notification_#{@notification.id}" %>').html("<%= escape_javascript( render_notification(@notification, fallback: :default_without_grouping, with_group_members: true) ) %>");
|
3
|
+
$('<%= ".notification_#{@notification.id}" %>').html("<%= escape_javascript( render_notification(@notification, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default_without_grouping, with_group_members: true)) ) %>");
|
4
4
|
<% else %>
|
5
|
-
$('<%= ".notification_#{@notification.id}" %>').html("<%= escape_javascript( render_notification(@notification, fallback: :default) ) %>");
|
5
|
+
$('<%= ".notification_#{@notification.id}" %>').html("<%= escape_javascript( render_notification(@notification, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default)) ) %>");
|
6
6
|
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
$(".notification_count").html("<span class=\"<%= 'unopened' if @target.has_unopened_notifications?(@index_options) %>\"><%= @target.unopened_notification_count(@index_options) %></span>");
|
2
2
|
<% if @index_options[:with_group_members] %>
|
3
|
-
$(".notifications").html("<%= escape_javascript( render_notification(@notifications, fallback: :default_without_grouping, with_group_members: true) ) %>");
|
3
|
+
$(".notifications").html("<%= escape_javascript( render_notification(@notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default_without_grouping, with_group_members: true)) ) %>");
|
4
4
|
<% else %>
|
5
|
-
$(".notifications").html("<%= escape_javascript( render_notification(@notifications, fallback: :default) ) %>");
|
5
|
+
$(".notifications").html("<%= escape_javascript( render_notification(@notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default)) ) %>");
|
6
6
|
<% end %>
|
@@ -4,8 +4,8 @@
|
|
4
4
|
</div>
|
5
5
|
<ul>
|
6
6
|
<div class="notifications">
|
7
|
-
<%= render_notification
|
8
|
-
<%#= render_notification @notification, fallback: :text %>
|
7
|
+
<%= render_notification @notification, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default) %>
|
8
|
+
<%#= render_notification @notification, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :text) %>
|
9
9
|
</div>
|
10
10
|
</ul>
|
11
11
|
</div>
|
@@ -3,7 +3,7 @@ Dear <%= @target.printable_target_name %>
|
|
3
3
|
<%= @notification.notifier.present? ? @notification.notifier.printable_notifier_name : 'Someone' %> notified you of <%= @notification.notifiable.printable_notifiable_name(@notification.target) %><%= " in #{@notification.group.printable_group_name}" if @notification.group.present? %>.
|
4
4
|
|
5
5
|
<%= "Move to notified #{@notification.notifiable.printable_type.downcase}:" %>
|
6
|
-
<%= move_notification_url_for(@notification, open: true) %>
|
6
|
+
<%= move_notification_url_for(@notification, parameters.slice(:routing_scope, :devise_default_routes).merge(open: true)) %>
|
7
7
|
|
8
8
|
Thank you!
|
9
9
|
|
@@ -3,4 +3,4 @@
|
|
3
3
|
<%= @notification.notifier.present? ? @notification.notifier.printable_notifier_name : 'Someone' %> notified you of <%= @notification.notifiable.printable_notifiable_name(@notification.target) %><%= " in #{@notification.group.printable_group_name}" if @notification.group.present? %>.
|
4
4
|
|
5
5
|
<%= "Move to notified #{@notification.notifiable.printable_type.downcase}:" %>
|
6
|
-
<%= move_notification_url_for(@notification, open: true) %>
|
6
|
+
<%= move_notification_url_for(@notification, parameters.slice(:routing_scope, :devise_default_routes).merge(open: true)) %>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<%= key %>
|
10
10
|
</h3>
|
11
11
|
<p>
|
12
|
-
<%= link_to "Notifications", notifications_path_for(target, filtered_by_key: key) %>
|
12
|
+
<%= link_to "Notifications", notifications_path_for(target, option_params.merge(filtered_by_key: key)) %>
|
13
13
|
</p>
|
14
14
|
</div>
|
15
15
|
<div class="field_wrapper subscribing">
|
@@ -97,7 +97,7 @@
|
|
97
97
|
<%#= f.submit "Save" %>
|
98
98
|
</div>
|
99
99
|
<%# end %>
|
100
|
-
<%#= link_to "See notifications", notifications_path_for(target, filtered_by_key: key) %>
|
100
|
+
<%#= link_to "See notifications", notifications_path_for(target, option_params.merge(filtered_by_key: key)) %>
|
101
101
|
<br/><br/>
|
102
102
|
<%# end %>
|
103
103
|
<%# else %>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
</h3>
|
6
6
|
|
7
7
|
<p>
|
8
|
-
<%= link_to "Notifications", notifications_path_for(subscription.target, filtered_by_key: subscription.key) %>
|
8
|
+
<%= link_to "Notifications", notifications_path_for(subscription.target, option_params.merge(filtered_by_key: subscription.key)) %>
|
9
9
|
</p>
|
10
10
|
</div>
|
11
11
|
|
@@ -48,14 +48,14 @@
|
|
48
48
|
<div class="field">
|
49
49
|
<div class="ui checkbox">
|
50
50
|
<% if subscription.subscribing_to_email? %>
|
51
|
-
<%= link_to
|
51
|
+
<%= link_to unsubscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :post, remote: true do %>
|
52
52
|
<label>
|
53
53
|
<%= check_box :subscribing_to_email, "", { checked: true }, 'true', 'false' %>
|
54
54
|
<div class="slider"></div>
|
55
55
|
</label>
|
56
56
|
<% end %>
|
57
57
|
<% else %>
|
58
|
-
<%= link_to
|
58
|
+
<%= link_to subscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :post, remote: true do %>
|
59
59
|
<label>
|
60
60
|
<%= check_box :subscribing_to_email, "", { checked: false }, 'true', 'false' %>
|
61
61
|
<div class="slider"></div>
|
@@ -76,14 +76,14 @@
|
|
76
76
|
<div class="field">
|
77
77
|
<div class="ui checkbox">
|
78
78
|
<% if subscription.subscribing_to_optional_target?(optional_target_name) %>
|
79
|
-
<%= link_to
|
79
|
+
<%= link_to unsubscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", false)', method: :post, remote: true do %>
|
80
80
|
<label>
|
81
81
|
<%= check_box optional_target_name, "", { checked: true }, 'true', 'false' %>
|
82
82
|
<div class="slider"></div>
|
83
83
|
</label>
|
84
84
|
<% end %>
|
85
85
|
<% else %>
|
86
|
-
<%= link_to
|
86
|
+
<%= link_to subscribe_to_optional_target_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", true)', method: :post, remote: true do %>
|
87
87
|
<label>
|
88
88
|
<%= check_box optional_target_name, "", { checked: false }, 'true', 'false' %>
|
89
89
|
<div class="slider"></div>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
</div>
|
5
5
|
<div class="fields_area">
|
6
6
|
<div class="subscription" id="subscription">
|
7
|
-
<%= render 'subscription', subscription: @subscription, option_params:
|
7
|
+
<%= render 'subscription', subscription: @subscription, option_params: @index_options %>
|
8
8
|
</div>
|
9
9
|
</div>
|
10
10
|
</div>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
setTimeout(function () {
|
2
2
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
3
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
3
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
4
4
|
}, 400);
|
5
5
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
6
6
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
5
5
|
|
data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
5
5
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
setTimeout(function () {
|
2
2
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
3
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
3
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
4
4
|
}, 400);
|
5
5
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
6
6
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
@@ -1,5 +1,5 @@
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
5
5
|
|
data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
$("#subscriptions").html("<%= escape_javascript( render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options ) %>");
|
2
|
-
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params:
|
2
|
+
$("#subscription").html("<%= escape_javascript( render 'subscription', subscription: @subscription, option_params: @index_options ) %>");
|
3
3
|
$("#notification_keys").html("<%= escape_javascript( render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options ) %>");
|
4
4
|
$("#subscription_form").html("<%= escape_javascript( render 'form', target: @target, option_params: @index_options ) %>");
|
5
5
|
|