activity_notification 1.4.4 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (271) hide show
  1. checksums.yaml +5 -5
  2. data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
  4. data/.github/pull_request_template.md +13 -0
  5. data/.github/workflows/build.yml +116 -0
  6. data/.gitignore +15 -3
  7. data/CHANGELOG.md +200 -1
  8. data/Gemfile +17 -2
  9. data/Procfile +2 -0
  10. data/README.md +168 -1033
  11. data/Rakefile +19 -10
  12. data/activity_notification.gemspec +14 -9
  13. data/app/channels/activity_notification/notification_api_channel.rb +12 -0
  14. data/app/channels/activity_notification/notification_api_with_devise_channel.rb +46 -0
  15. data/app/channels/activity_notification/notification_channel.rb +37 -0
  16. data/app/channels/activity_notification/notification_with_devise_channel.rb +51 -0
  17. data/app/controllers/activity_notification/apidocs_controller.rb +75 -0
  18. data/app/controllers/activity_notification/notifications_api_controller.rb +143 -0
  19. data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +7 -0
  20. data/app/controllers/activity_notification/notifications_controller.rb +60 -54
  21. data/app/controllers/activity_notification/subscriptions_api_controller.rb +197 -0
  22. data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +7 -0
  23. data/app/controllers/activity_notification/subscriptions_controller.rb +83 -73
  24. data/app/jobs/activity_notification/notify_all_job.rb +25 -0
  25. data/app/jobs/activity_notification/notify_job.rb +26 -0
  26. data/app/jobs/activity_notification/notify_to_job.rb +25 -0
  27. data/app/views/activity_notification/notifications/default/_default.html.erb +23 -23
  28. data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +19 -19
  29. data/app/views/activity_notification/notifications/default/_index.html.erb +3 -3
  30. data/app/views/activity_notification/notifications/default/index.html.erb +60 -7
  31. data/app/views/activity_notification/notifications/default/open.js.erb +2 -2
  32. data/app/views/activity_notification/notifications/default/open_all.js.erb +2 -2
  33. data/app/views/activity_notification/notifications/default/show.html.erb +2 -2
  34. data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb +176 -0
  35. data/app/views/activity_notification/optional_targets/default/base/_default.text.erb +1 -1
  36. data/app/views/activity_notification/optional_targets/default/slack/_default.text.erb +1 -1
  37. data/app/views/activity_notification/subscriptions/default/_form.html.erb +2 -2
  38. data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +5 -33
  39. data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +8 -8
  40. data/app/views/activity_notification/subscriptions/default/index.html.erb +13 -9
  41. data/app/views/activity_notification/subscriptions/default/show.html.erb +3 -3
  42. data/app/views/activity_notification/subscriptions/default/subscribe.js.erb +1 -1
  43. data/app/views/activity_notification/subscriptions/default/subscribe_to_email.js.erb +1 -1
  44. data/app/views/activity_notification/subscriptions/default/subscribe_to_optional_target.js.erb +1 -1
  45. data/app/views/activity_notification/subscriptions/default/unsubscribe.js.erb +1 -1
  46. data/app/views/activity_notification/subscriptions/default/unsubscribe_to_email.js.erb +1 -1
  47. data/app/views/activity_notification/subscriptions/default/unsubscribe_to_optional_target.js.erb +1 -1
  48. data/bin/_dynamodblocal +4 -0
  49. data/bin/bundle_update.sh +7 -0
  50. data/bin/deploy_on_heroku.sh +16 -0
  51. data/bin/install_dynamodblocal.sh +5 -0
  52. data/bin/start_dynamodblocal.sh +47 -0
  53. data/bin/stop_dynamodblocal.sh +34 -0
  54. data/docs/CODE_OF_CONDUCT.md +76 -0
  55. data/docs/CONTRIBUTING.md +36 -0
  56. data/docs/Functions.md +1146 -0
  57. data/docs/Setup.md +817 -0
  58. data/docs/Testing.md +148 -0
  59. data/gemfiles/Gemfile.rails-5.0 +8 -1
  60. data/gemfiles/Gemfile.rails-5.1 +7 -1
  61. data/gemfiles/Gemfile.rails-5.2 +24 -0
  62. data/gemfiles/Gemfile.rails-6.0 +23 -0
  63. data/gemfiles/Gemfile.rails-6.1 +22 -0
  64. data/gemfiles/Gemfile.rails-7.0 +25 -0
  65. data/lib/activity_notification/apis/notification_api.rb +356 -159
  66. data/lib/activity_notification/apis/subscription_api.rb +98 -59
  67. data/lib/activity_notification/apis/swagger.rb +6 -0
  68. data/lib/activity_notification/common.rb +18 -7
  69. data/lib/activity_notification/config.rb +176 -30
  70. data/lib/activity_notification/controllers/common_api_controller.rb +30 -0
  71. data/lib/activity_notification/controllers/common_controller.rb +47 -27
  72. data/lib/activity_notification/controllers/concerns/swagger/error_responses.rb +55 -0
  73. data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +273 -0
  74. data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +92 -0
  75. data/lib/activity_notification/controllers/concerns/swagger/subscriptions_api.rb +405 -0
  76. data/lib/activity_notification/controllers/concerns/swagger/subscriptions_parameters.rb +50 -0
  77. data/lib/activity_notification/controllers/devise_authentication_controller.rb +22 -5
  78. data/lib/activity_notification/gem_version.rb +14 -0
  79. data/lib/activity_notification/helpers/errors.rb +6 -0
  80. data/lib/activity_notification/helpers/view_helpers.rb +118 -28
  81. data/lib/activity_notification/mailers/helpers.rb +19 -12
  82. data/lib/activity_notification/models/concerns/notifiable.rb +142 -55
  83. data/lib/activity_notification/models/concerns/subscriber.rb +28 -13
  84. data/lib/activity_notification/models/concerns/swagger/error_schema.rb +36 -0
  85. data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +209 -0
  86. data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +162 -0
  87. data/lib/activity_notification/models/concerns/target.rb +131 -32
  88. data/lib/activity_notification/models/notification.rb +1 -0
  89. data/lib/activity_notification/models/subscription.rb +1 -0
  90. data/lib/activity_notification/models.rb +23 -1
  91. data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +69 -0
  92. data/lib/activity_notification/optional_targets/action_cable_channel.rb +68 -0
  93. data/lib/activity_notification/optional_targets/base.rb +9 -15
  94. data/lib/activity_notification/orm/active_record/notification.rb +23 -34
  95. data/lib/activity_notification/orm/active_record/subscription.rb +1 -1
  96. data/lib/activity_notification/orm/active_record.rb +1 -1
  97. data/lib/activity_notification/orm/dynamoid/extension.rb +262 -0
  98. data/lib/activity_notification/orm/dynamoid/notification.rb +224 -0
  99. data/lib/activity_notification/orm/dynamoid/subscription.rb +82 -0
  100. data/lib/activity_notification/orm/dynamoid.rb +530 -0
  101. data/lib/activity_notification/orm/mongoid/notification.rb +29 -28
  102. data/lib/activity_notification/orm/mongoid/subscription.rb +3 -3
  103. data/lib/activity_notification/orm/mongoid.rb +33 -1
  104. data/lib/activity_notification/rails/routes.rb +273 -60
  105. data/lib/activity_notification/renderable.rb +22 -7
  106. data/lib/activity_notification/roles/acts_as_notifiable.rb +64 -1
  107. data/lib/activity_notification/roles/acts_as_target.rb +99 -9
  108. data/lib/activity_notification/version.rb +1 -1
  109. data/lib/activity_notification.rb +14 -0
  110. data/lib/generators/activity_notification/controllers_generator.rb +2 -1
  111. data/lib/generators/templates/activity_notification.rb +61 -7
  112. data/lib/generators/templates/controllers/README +2 -2
  113. data/lib/generators/templates/controllers/notifications_api_controller.rb +31 -0
  114. data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +31 -0
  115. data/lib/generators/templates/controllers/notifications_controller.rb +1 -37
  116. data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +1 -45
  117. data/lib/generators/templates/controllers/subscriptions_api_controller.rb +61 -0
  118. data/lib/generators/templates/controllers/subscriptions_api_with_devise_controller.rb +61 -0
  119. data/lib/generators/templates/controllers/subscriptions_controller.rb +14 -37
  120. data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +14 -45
  121. data/lib/generators/templates/migrations/migration.rb +5 -5
  122. data/lib/generators/templates/models/README +8 -4
  123. data/lib/generators/templates/models/notification.rb +1 -1
  124. data/lib/generators/templates/models/subscription.rb +1 -1
  125. data/lib/tasks/activity_notification_tasks.rake +14 -4
  126. data/package.json +8 -0
  127. data/spec/channels/notification_api_channel_shared_examples.rb +59 -0
  128. data/spec/channels/notification_api_channel_spec.rb +49 -0
  129. data/spec/channels/notification_api_with_devise_channel_spec.rb +76 -0
  130. data/spec/channels/notification_channel_shared_examples.rb +59 -0
  131. data/spec/channels/notification_channel_spec.rb +48 -0
  132. data/spec/channels/notification_with_devise_channel_spec.rb +97 -0
  133. data/spec/concerns/apis/notification_api_spec.rb +177 -12
  134. data/spec/concerns/apis/subscription_api_spec.rb +146 -4
  135. data/spec/concerns/common_spec.rb +25 -3
  136. data/spec/concerns/models/notifiable_spec.rb +161 -11
  137. data/spec/concerns/models/subscriber_spec.rb +253 -79
  138. data/spec/concerns/models/target_spec.rb +180 -47
  139. data/spec/concerns/renderable_spec.rb +35 -16
  140. data/spec/config_spec.rb +52 -1
  141. data/spec/controllers/controller_spec_utility.rb +100 -0
  142. data/spec/controllers/notifications_api_controller_shared_examples.rb +506 -0
  143. data/spec/controllers/notifications_api_controller_spec.rb +19 -0
  144. data/spec/controllers/notifications_api_with_devise_controller_spec.rb +60 -0
  145. data/spec/controllers/notifications_controller_shared_examples.rb +55 -76
  146. data/spec/controllers/notifications_controller_spec.rb +1 -2
  147. data/spec/controllers/notifications_with_devise_controller_spec.rb +14 -8
  148. data/spec/controllers/subscriptions_api_controller_shared_examples.rb +750 -0
  149. data/spec/controllers/subscriptions_api_controller_spec.rb +19 -0
  150. data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +60 -0
  151. data/spec/controllers/subscriptions_controller_shared_examples.rb +99 -121
  152. data/spec/controllers/subscriptions_controller_spec.rb +1 -2
  153. data/spec/controllers/subscriptions_with_devise_controller_spec.rb +14 -8
  154. data/spec/factories/notifications.rb +1 -1
  155. data/spec/factories/subscriptions.rb +3 -3
  156. data/spec/factories/users.rb +3 -3
  157. data/spec/generators/migration/migration_generator_spec.rb +29 -4
  158. data/spec/helpers/view_helpers_spec.rb +31 -21
  159. data/spec/jobs/notify_all_job_spec.rb +23 -0
  160. data/spec/jobs/notify_job_spec.rb +23 -0
  161. data/spec/jobs/notify_to_job_spec.rb +23 -0
  162. data/spec/mailers/mailer_spec.rb +42 -1
  163. data/spec/models/dummy/dummy_group_spec.rb +4 -0
  164. data/spec/models/dummy/dummy_notifiable_spec.rb +4 -0
  165. data/spec/models/dummy/dummy_notifier_spec.rb +4 -0
  166. data/spec/models/dummy/dummy_subscriber_spec.rb +3 -0
  167. data/spec/models/dummy/dummy_target_spec.rb +4 -0
  168. data/spec/models/notification_spec.rb +181 -45
  169. data/spec/models/subscription_spec.rb +77 -27
  170. data/spec/optional_targets/action_cable_api_channel_spec.rb +34 -0
  171. data/spec/optional_targets/action_cable_channel_spec.rb +41 -0
  172. data/spec/optional_targets/amazon_sns_spec.rb +0 -2
  173. data/spec/optional_targets/slack_spec.rb +0 -2
  174. data/spec/orm/dynamoid_spec.rb +115 -0
  175. data/spec/rails_app/Rakefile +9 -0
  176. data/spec/rails_app/app/assets/config/manifest.js +3 -0
  177. data/spec/rails_app/app/assets/javascripts/application.js +2 -1
  178. data/spec/rails_app/app/assets/javascripts/cable.js +12 -0
  179. data/spec/rails_app/app/controllers/admins_controller.rb +21 -0
  180. data/spec/rails_app/app/controllers/application_controller.rb +1 -1
  181. data/spec/rails_app/app/controllers/articles_controller.rb +6 -1
  182. data/spec/rails_app/app/controllers/comments_controller.rb +3 -1
  183. data/spec/rails_app/app/controllers/spa_controller.rb +7 -0
  184. data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -65
  185. data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -73
  186. data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -77
  187. data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -85
  188. data/spec/rails_app/app/controllers/users_controller.rb +26 -0
  189. data/spec/rails_app/app/javascript/App.vue +40 -0
  190. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +82 -0
  191. data/spec/rails_app/app/javascript/components/Top.vue +98 -0
  192. data/spec/rails_app/app/javascript/components/notifications/Index.vue +200 -0
  193. data/spec/rails_app/app/javascript/components/notifications/Notification.vue +133 -0
  194. data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +122 -0
  195. data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +279 -0
  196. data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +112 -0
  197. data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +141 -0
  198. data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +226 -0
  199. data/spec/rails_app/app/javascript/config/development.js +5 -0
  200. data/spec/rails_app/app/javascript/config/environment.js +7 -0
  201. data/spec/rails_app/app/javascript/config/production.js +5 -0
  202. data/spec/rails_app/app/javascript/config/test.js +5 -0
  203. data/spec/rails_app/app/javascript/packs/application.js +18 -0
  204. data/spec/rails_app/app/javascript/packs/spa.js +14 -0
  205. data/spec/rails_app/app/javascript/router/index.js +73 -0
  206. data/spec/rails_app/app/javascript/store/index.js +37 -0
  207. data/spec/rails_app/app/models/admin.rb +15 -10
  208. data/spec/rails_app/app/models/article.rb +25 -20
  209. data/spec/rails_app/app/models/comment.rb +27 -62
  210. data/spec/rails_app/app/models/dummy/dummy_base.rb +1 -0
  211. data/spec/rails_app/app/models/dummy/dummy_group.rb +9 -0
  212. data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +1 -0
  213. data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +27 -0
  214. data/spec/rails_app/app/models/dummy/dummy_notifier.rb +1 -0
  215. data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +1 -0
  216. data/spec/rails_app/app/models/dummy/dummy_target.rb +1 -0
  217. data/spec/rails_app/app/models/user.rb +44 -18
  218. data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +146 -0
  219. data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +1 -0
  220. data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +1 -1
  221. data/spec/rails_app/app/views/articles/index.html.erb +68 -20
  222. data/spec/rails_app/app/views/articles/show.html.erb +1 -1
  223. data/spec/rails_app/app/views/layouts/_header.html.erb +9 -3
  224. data/spec/rails_app/app/views/spa/index.html.erb +2 -0
  225. data/spec/rails_app/babel.config.js +72 -0
  226. data/spec/rails_app/bin/webpack +18 -0
  227. data/spec/rails_app/bin/webpack-dev-server +18 -0
  228. data/spec/rails_app/config/application.rb +26 -6
  229. data/spec/rails_app/config/cable.yml +8 -0
  230. data/spec/rails_app/config/database.yml +1 -1
  231. data/spec/rails_app/config/dynamoid.rb +13 -0
  232. data/spec/rails_app/config/environment.rb +5 -1
  233. data/spec/rails_app/config/environments/development.rb +5 -0
  234. data/spec/rails_app/config/environments/production.rb +7 -1
  235. data/spec/rails_app/config/environments/test.rb +7 -11
  236. data/spec/rails_app/config/initializers/activity_notification.rb +63 -9
  237. data/spec/rails_app/config/initializers/copy_it.aws.rb.template +6 -0
  238. data/spec/rails_app/config/initializers/devise_token_auth.rb +55 -0
  239. data/spec/rails_app/config/initializers/mysql.rb +9 -0
  240. data/spec/rails_app/config/locales/activity_notification.en.yml +10 -4
  241. data/spec/rails_app/config/routes.rb +42 -1
  242. data/spec/rails_app/config/webpack/development.js +5 -0
  243. data/spec/rails_app/config/webpack/environment.js +7 -0
  244. data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
  245. data/spec/rails_app/config/webpack/production.js +5 -0
  246. data/spec/rails_app/config/webpack/test.js +5 -0
  247. data/spec/rails_app/config/webpacker.yml +97 -0
  248. data/spec/rails_app/db/migrate/{20160715050433_create_test_tables.rb → 20160716000000_create_test_tables.rb} +1 -1
  249. data/spec/rails_app/db/migrate/{20160715050420_create_activity_notification_tables.rb → 20181209000000_create_activity_notification_tables.rb} +3 -3
  250. data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +10 -0
  251. data/spec/rails_app/db/schema.rb +46 -43
  252. data/spec/rails_app/db/seeds.rb +28 -4
  253. data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +14 -0
  254. data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +14 -4
  255. data/spec/rails_app/package.json +23 -0
  256. data/spec/rails_app/postcss.config.js +12 -0
  257. data/spec/roles/acts_as_group_spec.rb +0 -2
  258. data/spec/roles/acts_as_notifiable_spec.rb +80 -20
  259. data/spec/roles/acts_as_notifier_spec.rb +0 -2
  260. data/spec/roles/acts_as_target_spec.rb +1 -5
  261. data/spec/spec_helper.rb +13 -11
  262. data/spec/version_spec.rb +31 -0
  263. metadata +306 -53
  264. data/.travis.yml +0 -85
  265. data/Gemfile.lock +0 -234
  266. data/gemfiles/Gemfile.rails-4.2 +0 -17
  267. data/gemfiles/Gemfile.rails-4.2.lock +0 -225
  268. data/gemfiles/Gemfile.rails-5.0.lock +0 -234
  269. data/gemfiles/Gemfile.rails-5.1.lock +0 -234
  270. data/spec/rails_app/app/views/activity_notification/notifications/users/overriden/custom/_test.html.erb +0 -1
  271. /data/spec/rails_app/app/{models → assets/images}/.keep +0 -0
@@ -7,20 +7,20 @@
7
7
  <strong><%= notification.notifier.present? ? notification.notifier.printable_notifier_name : 'Someone' %></strong>
8
8
  <% if notification.group_member_notifier_exists? %>
9
9
  <%= " and #{notification.group_member_notifier_count} other" %>
10
- <%= notification.notifier.present? ? notification.notifier.printable_type.pluralize.downcase : 'people' %>
10
+ <%= notification.notifier.present? ? notification.notifier.printable_type.downcase.pluralize(notification.group_member_notifier_count) : 'people' %>
11
11
  <% end %>
12
12
  notified you of
13
13
  <% if notification.notifiable.present? %>
14
14
  <% if notification.group_member_exists? %>
15
- <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.pluralize.downcase} including" %>
15
+ <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.downcase.pluralize(notification.group_notification_count)} including" %>
16
16
  <% end %>
17
17
  <%= notification.notifiable.printable_notifiable_name(notification.target) %>
18
18
  <%= "in #{notification.group.printable_group_name}" if notification.group.present? %>
19
19
  <% else %>
20
20
  <% if notification.group_member_exists? %>
21
- <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.pluralize.downcase}" %>
21
+ <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.downcase.pluralize(notification.group_notification_count)}" %>
22
22
  <% else %>
23
- <%= " a #{notification.notifiable_type.humanize.singularize.downcase}" %>
23
+ <%= " a #{notification.notifiable_type.humanize.downcase.singularize}" %>
24
24
  <% end %>
25
25
  <%= "in #{notification.group.printable_group_name}" if notification.group.present? %>
26
26
  but the notifiable is not found. It may have been deleted.
@@ -34,42 +34,42 @@
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 %>
38
- <div class="unopned_circle"></div>
39
- <div class="unopned_description_wrapper">
40
- <p class="unopned_description">Open</p>
37
+ <%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :put, remote: true, class: "unopened_wrapper" do %>
38
+ <div class="unopened_circle"></div>
39
+ <div class="unopened_description_wrapper">
40
+ <p class="unopened_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: :put 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 (PUT)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :put %>
57
+ <%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options))), method: :put %>
58
+ <%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :put, 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
 
65
65
  <style>
66
- /* unopned_circle */
66
+ /* unopened_circle */
67
67
  .unopened_wrapper{
68
68
  position: absolute;
69
69
  margin-top: 20px;
70
70
  margin-left: 56px;
71
71
  }
72
- .unopened_wrapper .unopned_circle {
72
+ .unopened_wrapper .unopened_circle {
73
73
  display: block;
74
74
  width: 10px;
75
75
  height: 10px;
@@ -78,16 +78,16 @@
78
78
  background-color: #27a5eb;
79
79
  z-index: 2;
80
80
  }
81
- .unopened_wrapper:hover > .unopned_description_wrapper{
81
+ .unopened_wrapper:hover > .unopened_description_wrapper{
82
82
  display: block;
83
83
  }
84
- .unopened_wrapper .unopned_description_wrapper {
84
+ .unopened_wrapper .unopened_description_wrapper {
85
85
  display: none;
86
86
  position: absolute;
87
87
  margin-top: 26px;
88
88
  margin-left: -24px;
89
89
  }
90
- .unopened_wrapper .unopned_description_wrapper .unopned_description {
90
+ .unopened_wrapper .unopened_description_wrapper .unopened_description {
91
91
  position: absolute;
92
92
  color: #fff;
93
93
  font-size: 12px;
@@ -98,7 +98,7 @@
98
98
  padding: 4px 12px;
99
99
  z-index: 999;
100
100
  }
101
- .unopened_wrapper .unopned_description_wrapper .unopned_description:before {
101
+ .unopened_wrapper .unopened_description_wrapper .unopened_description:before {
102
102
  border: solid transparent;
103
103
  border-top-width: 0;
104
104
  content: "";
@@ -23,42 +23,42 @@
23
23
 
24
24
  <div class='<%= "notification_#{notification.id}" %>'>
25
25
  <% if notification.unopened? %>
26
- <%= link_to open_notification_path_for(notification, reload: false, without_grouping: parameters[:with_group_members]), method: :post, remote: true, class: "unopened_wrapper" do %>
27
- <div class="unopned_circle"></div>
28
- <div class="unopned_description_wrapper">
29
- <p class="unopned_description">Open</p>
26
+ <%= link_to open_notification_path_for(notification, parameters.slice(:with_group_members, :routing_scope, :devise_default_routes).merge(reload: false)), method: :put, remote: true, class: "unopened_wrapper" do %>
27
+ <div class="unopened_circle"></div>
28
+ <div class="unopened_description_wrapper">
29
+ <p class="unopened_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: :put 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, reload: false, with_group_members: parameters[:with_group_members]), method: :post, remote: true %>
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 (PUT)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :put %>
46
+ <%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :put %>
47
+ <%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(with_group_members:, :routing_scope, :devise_default_routes).merge(reload: false)), method: :put, 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, reload: false, with_group_members: parameters[:with_group_members]), method: :delete, remote: true %>
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
 
54
54
  <style>
55
- /* unopned_circle */
55
+ /* unopened_circle */
56
56
  .unopened_wrapper{
57
57
  position: absolute;
58
58
  margin-top: 20px;
59
59
  margin-left: 56px;
60
60
  }
61
- .unopened_wrapper .unopned_circle {
61
+ .unopened_wrapper .unopened_circle {
62
62
  display: block;
63
63
  width: 10px;
64
64
  height: 10px;
@@ -67,16 +67,16 @@
67
67
  background-color: #27a5eb;
68
68
  z-index: 2;
69
69
  }
70
- .unopened_wrapper:hover > .unopned_description_wrapper{
70
+ .unopened_wrapper:hover > .unopened_description_wrapper{
71
71
  display: block;
72
72
  }
73
- .unopened_wrapper .unopned_description_wrapper {
73
+ .unopened_wrapper .unopened_description_wrapper {
74
74
  display: none;
75
75
  position: absolute;
76
76
  margin-top: 26px;
77
77
  margin-left: -24px;
78
78
  }
79
- .unopened_wrapper .unopned_description_wrapper .unopned_description {
79
+ .unopened_wrapper .unopened_description_wrapper .unopened_description {
80
80
  position: absolute;
81
81
  color: #fff;
82
82
  font-size: 12px;
@@ -87,7 +87,7 @@
87
87
  padding: 4px 12px;
88
88
  z-index: 999;
89
89
  }
90
- .unopened_wrapper .unopned_description_wrapper .unopned_description:before {
90
+ .unopened_wrapper .unopened_description_wrapper .unopened_description:before {
91
91
  border: solid transparent;
92
92
  border-top-width: 0;
93
93
  content: "";
@@ -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,30 @@
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>
4
+ Notifications to <%= @target.printable_target_name %>
5
+ <%= link_to open_all_notifications_path_for(@target, @index_options.slice(:routing_scope, :devise_default_routes)), method: :post, remote: true do %>
6
+ <span class="notification_count"><span class="<%= 'unopened' if @target.has_unopened_notifications?(@index_options) %>">
7
+ <%= @target.unopened_notification_count(@index_options) %>
8
+ </span></span>
9
+ <% end %>
10
+ </h1>
11
+ <h3>
12
+ <span class="action_cable_status">Disabled</span>
13
+ </h3>
4
14
  </div>
5
15
  <div class="notifications">
6
16
  <% if @index_options[:with_group_members] %>
7
- <%= render_notification @notifications, fallback: :default_without_grouping, with_group_members: true %>
17
+ <%= render_notification @notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default_without_grouping, with_group_members: true) %>
8
18
  <% else %>
9
- <%= render_notification @notifications, fallback: :default %>
10
- <%#= render_notification @notifications, fallback: :text %>
19
+ <%= render_notification @notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default) %>
20
+ <%#= render_notification @notifications, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :text) %>
11
21
  <% end %>
12
22
  </div>
13
23
  </div>
14
24
 
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 %>
25
+ <%#= render_notifications_of @target, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default, index_content: :with_attributes) %>
26
+ <%#= render_notifications_of @target, @index_options.slice(:routing_scope, :devise_default_routes).merge(fallback: :default, index_content: :unopened_with_attributes, reverse: true) %>
27
+ <%#= 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
28
 
19
29
  <style>
20
30
  .notification_wrapper .notification_header h1 span span{
@@ -28,3 +38,46 @@
28
38
  background-color: #f87880;
29
39
  }
30
40
  </style>
41
+
42
+ <% if @target.notification_action_cable_allowed? %>
43
+ <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/push.js/1.0.9/push.min.js"></script>
44
+ <script>
45
+ App.activity_notification = App.cable.subscriptions.create(
46
+ {
47
+ channel: "<%= @target.notification_action_cable_channel_class_name %>",
48
+ target_type: "<%= @target.to_class_name %>", target_id: "<%= @target.id %>"
49
+ },
50
+ {
51
+ connected: function() {
52
+ $(".action_cable_status").html("Online<%= " (authorized)" if @target.notification_action_cable_with_devise? %>");
53
+ },
54
+ disconnected: function() {
55
+ $(".action_cable_status").html("Offline");
56
+ },
57
+ rejected: function() {
58
+ $(".action_cable_status").html("Offline (unauthorized)");
59
+ },
60
+ received: function(notification) {
61
+ // Display notification
62
+ if (notification.group_owner_id == null) {
63
+ $(".notifications").prepend(notification.view);
64
+ $(".notification_count").html("<span class=unopened>" + notification.unopened_notification_count + "</span>");
65
+ } else {
66
+ $(".notification_" + notification.group_owner_id).remove();
67
+ $(".notifications").prepend(notification.group_owner_view);
68
+ $(".notification_count").html("<span class=unopened>" + notification.unopened_notification_count + "</span>");
69
+ }
70
+ // Push notificaion using Web Notification API by Push.js
71
+ Push.create('ActivityNotification', {
72
+ body: notification.text,
73
+ timeout: 5000,
74
+ onClick: function () {
75
+ location.href = notification.notifiable_path;
76
+ this.close();
77
+ }
78
+ });
79
+ }
80
+ }
81
+ );
82
+ </script>
83
+ <% 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
- $('<%= ".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(@notification, fallback: :default) %>
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>
@@ -0,0 +1,176 @@
1
+ <% content_for :notification_content, flush: true do %>
2
+ <div class='notification_list <%= notification.opened? ? "opened" : "unopened" %>'>
3
+ <div class="notification_list_cover"></div>
4
+ <div class="list_image"></div>
5
+ <div class="list_text_wrapper">
6
+ <p class="list_text">
7
+ <strong><%= notification.notifier.present? ? notification.notifier.printable_notifier_name : 'Someone' %></strong>
8
+ <% if notification.group_member_notifier_exists? %>
9
+ <%= " and #{notification.group_member_notifier_count} other" %>
10
+ <%= notification.notifier.present? ? notification.notifier.printable_type.pluralize.downcase : 'people' %>
11
+ <% end %>
12
+ notified you of
13
+ <% if notification.notifiable.present? %>
14
+ <% if notification.group_member_exists? %>
15
+ <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.pluralize.downcase} including" %>
16
+ <% end %>
17
+ <%= notification.notifiable.printable_notifiable_name(notification.target) %>
18
+ <%= "in #{notification.group.printable_group_name}" if notification.group.present? %>
19
+ <% else %>
20
+ <% if notification.group_member_exists? %>
21
+ <%= " #{notification.group_notification_count} #{notification.notifiable_type.humanize.pluralize.downcase}" %>
22
+ <% else %>
23
+ <%= " a #{notification.notifiable_type.humanize.singularize.downcase}" %>
24
+ <% end %>
25
+ <%= "in #{notification.group.printable_group_name}" if notification.group.present? %>
26
+ but the notifiable is not found. It may have been deleted.
27
+ <% end %>
28
+ <br>
29
+ <span><%= notification.created_at.strftime("%b %d %H:%M") %></span>
30
+ </p>
31
+ </div>
32
+ </div>
33
+ <% end %>
34
+
35
+ <div class='<%= "notification_#{notification.id}" %>'>
36
+ <% if notification.unopened? %>
37
+ <%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :put, remote: true, class: "unopened_wrapper" do %>
38
+ <div class="unopened_circle"></div>
39
+ <div class="unopened_description_wrapper">
40
+ <p class="unopened_description">Open</p>
41
+ </div>
42
+ <% end %>
43
+ <%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :put do %>
44
+ <%= yield :notification_content %>
45
+ <% end %>
46
+ <div class="unopened_wrapper"></div>
47
+ <% else %>
48
+ <%= link_to move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) do %>
49
+ <%= yield :notification_content %>
50
+ <% end %>
51
+ <% end %>
52
+
53
+ <%#= link_to "Move", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) %>
54
+ <%# if notification.unopened? %>
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 (PUT)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :put %>
57
+ <%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options))), method: :put %>
58
+ <%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :put, remote: true %>
59
+ <%# end %>
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
+
63
+ </div>
64
+
65
+ <style>
66
+ /* unopened_circle */
67
+ .unopened_wrapper{
68
+ position: absolute;
69
+ margin-top: 20px;
70
+ margin-left: 56px;
71
+ }
72
+ .unopened_wrapper .unopened_circle {
73
+ display: block;
74
+ width: 10px;
75
+ height: 10px;
76
+ position: absolute;
77
+ border-radius: 50%;
78
+ background-color: #27a5eb;
79
+ z-index: 2;
80
+ }
81
+ .unopened_wrapper:hover > .unopened_description_wrapper{
82
+ display: block;
83
+ }
84
+ .unopened_wrapper .unopened_description_wrapper {
85
+ display: none;
86
+ position: absolute;
87
+ margin-top: 26px;
88
+ margin-left: -24px;
89
+ }
90
+ .unopened_wrapper .unopened_description_wrapper .unopened_description {
91
+ position: absolute;
92
+ color: #fff;
93
+ font-size: 12px;
94
+ text-align: center;
95
+
96
+ border-radius: 4px;
97
+ background: rgba(0, 0, 0, 0.8);
98
+ padding: 4px 12px;
99
+ z-index: 999;
100
+ }
101
+ .unopened_wrapper .unopened_description_wrapper .unopened_description:before {
102
+ border: solid transparent;
103
+ border-top-width: 0;
104
+ content: "";
105
+ display: block;
106
+ position: absolute;
107
+ width: 0;
108
+ left: 50%;
109
+ top: -5px;
110
+ margin-left: -5px;
111
+ height: 0;
112
+ border-width: 0 5px 5px 5px;
113
+ border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
114
+ z-index: 0;
115
+ }
116
+
117
+ /* list */
118
+ .notification_list {
119
+ padding: 15px 10px;
120
+ position: relative;
121
+ border-bottom: 1px solid #e5e5e5;
122
+ }
123
+ .notification_list.unopened {
124
+ background-color: #eeeff4;
125
+ }
126
+ .notification_list:hover {
127
+ background-color: #f8f9fb;
128
+ }
129
+ .notification_list:last-child {
130
+ border-bottom: none;
131
+ }
132
+ .notification_list:after{
133
+ content: "";
134
+ clear: both;
135
+ display: block;
136
+ }
137
+ .notification_list .notification_list_cover{
138
+ position: absolute;
139
+ opacity: 0;
140
+ top: 0;
141
+ left: 0;
142
+ width: 100%;
143
+ height: 100%;
144
+ z-index: 1;
145
+
146
+ }
147
+ .notification_list .list_image {
148
+ float: left;
149
+ width: 40px;
150
+ height: 40px;
151
+ background-position: center;
152
+ background-repeat: no-repeat;
153
+ background-size: cover;
154
+ background-color: #979797;
155
+ }
156
+ .notification_list .list_text_wrapper {
157
+ float: left;
158
+ width: calc(100% - 60px);
159
+ margin-left: 20px;
160
+ }
161
+ .notification_list .list_text_wrapper .list_text {
162
+ color: #4f4f4f;
163
+ font-size: 14px;
164
+ line-height: 1.4;
165
+ margin-top: 0;
166
+ height: auto;
167
+ font-weight: normal;
168
+ }
169
+ .notification_list .list_text_wrapper .list_text strong{
170
+ font-weight: bold;
171
+ }
172
+ .notification_list .list_text_wrapper .list_text span {
173
+ color: #979797;
174
+ font-size: 13px;
175
+ }
176
+ </style>
@@ -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)) %>
@@ -1,6 +1,6 @@
1
1
  <div class="fields_area">
2
2
  <div class="fields_wrapper">
3
- <%= form_for(ActivityNotification::Subscription.new, as: :subscription, url: subscriptions_url_for(target, option_params), data: { remote: true }) do |f| %>
3
+ <%= form_for(ActivityNotification::Subscription.new, as: :subscription, url: subscriptions_url_for(target, option_params), data: { remote: true }, namespace: :new) do |f| %>
4
4
  <div class="field_wrapper">
5
5
  <div class="field_label">
6
6
  <%= f.label :key, "Notification key" %>
@@ -37,7 +37,7 @@
37
37
  <div class="field">
38
38
  <div class="ui checkbox">
39
39
  <label>
40
- <%= f.check_box :subscribing_to_email, { checked: ActivityNotification.config.subscribe_as_default }, 'true', 'false' %>
40
+ <%= f.check_box :subscribing_to_email, { checked: ActivityNotification.config.subscribe_to_email_as_default }, 'true', 'false' %>
41
41
  <div class="slider"></div>
42
42
  </label>
43
43
  </div>
@@ -2,14 +2,14 @@
2
2
  <div class="fields_area">
3
3
  <% notification_keys.each do |key| %>
4
4
  <div class="fields_wrapper">
5
- <%= form_for(ActivityNotification::Subscription.new, as: :subscription, url: subscriptions_url_for(target, option_params), data: { remote: true }) do |f| %>
5
+ <%= form_for(ActivityNotification::Subscription.new, as: :subscription, url: subscriptions_url_for(target, option_params), data: { remote: true }, namespace: key) do |f| %>
6
6
  <%= f.hidden_field :key, value: key %>
7
7
  <div class="fields_title_wrapper">
8
8
  <h3 class="fields_title">
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">
@@ -38,7 +38,7 @@
38
38
  <div class="field">
39
39
  <div class="ui checkbox">
40
40
  <label>
41
- <%= f.check_box :subscribing_to_email, { checked: ActivityNotification.config.subscribe_as_default }, 'true', 'false' %>
41
+ <%= f.check_box :subscribing_to_email, { checked: ActivityNotification.config.subscribe_to_email_as_default }, 'true', 'false' %>
42
42
  <div class="slider"></div>
43
43
  </label>
44
44
  </div>
@@ -55,8 +55,8 @@
55
55
  <div class="field">
56
56
  <div class="ui checkbox">
57
57
  <label>
58
- <%= hidden_field_tag "subscription[optional_targets][#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}]", 'false' %>
59
- <%= check_box_tag "subscription[optional_targets][#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}]", 'true', ActivityNotification.config.subscribe_as_default %>
58
+ <%= hidden_field_tag "subscription[optional_targets][#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}]", 'false', id: "#{key}_subscription_optional_targets_subscribing_to_#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}_hidden" %>
59
+ <%= check_box_tag "subscription[optional_targets][#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}]", 'true', ActivityNotification.config.subscribe_to_optional_targets_as_default, id: "#{key}_subscription_optional_targets_subscribing_to_#{ActivityNotification::Subscription.to_optional_target_key(optional_target_name)}_check_box" %>
60
60
  <div class="slider"></div>
61
61
  </label>
62
62
  </div>
@@ -78,31 +78,3 @@
78
78
  </div>
79
79
  </div>
80
80
  <% end %>
81
-
82
- <!--
83
- <%# if notification_keys.present? %>
84
- <%# notification_keys.each do |key| %>
85
- Key: <%#= key %>
86
- <%#= form_for(ActivityNotification::Subscription.new, as: :subscription, url: subscriptions_url_for(target, option_params), data: {remote: true}) do |f| %>
87
- <%#= f.hidden_field :key, value: key %>
88
- <div class="field">
89
- <%#= f.label :subscribing, "Subscribe to this notification?" %>
90
- <%#= f.check_box :subscribing, {checked: true}, 'true', 'false' %>
91
- </div>
92
- <div class="field">
93
- <%#= f.label :subscribing_to_email, "Subscribe to this notification email?" %>
94
- <%#= f.check_box :subscribing_to_email, {checked: true}, 'true', 'false' %>
95
- </div>
96
- <div class="actions">
97
- <%#= f.submit "Save" %>
98
- </div>
99
- <%# end %>
100
- <%#= link_to "See notifications", notifications_path_for(target, filtered_by_key: key) %>
101
- <br/><br/>
102
- <%# end %>
103
- <%# else %>
104
- No notification keys are available.
105
- <%# end %>
106
- <br/><br/>
107
- -->
108
-