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
@@ -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
 
@@ -18,18 +18,18 @@
18
18
  <div class="field">
19
19
  <div class="ui checkbox">
20
20
  <% if subscription.subscribing? %>
21
- <%= link_to unsubscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false);$(this).parent().parent().parent().next().slideUp();;$(this).parent().parent().parent().next().next().slideUp();', method: :post, remote: true do %>
21
+ <%= link_to unsubscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false);$(this).parent().parent().parent().next().slideUp();;$(this).parent().parent().parent().next().next().slideUp();', method: :put, remote: true do %>
22
22
  <%= check_box :subscribing, "", { checked: true }, 'true', 'false' %>
23
23
  <div class="slider"></div>
24
24
  <% end %>
25
25
  <% else %>
26
26
  <% if ActivityNotification.config.subscribe_as_default %>
27
- <%= link_to subscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().find("input").prop("checked", true);$(this).parent().parent().parent().next().next().slideDown();$(this).parent().parent().parent().next().next().find("input").prop("checked", true);', method: :post, remote: true do %>
27
+ <%= link_to subscribe_path_for(subscription, option_params), onclick: "$(this).find(\"input\").prop(\"checked\", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().find(\"input\").prop(\"checked\", #{ActivityNotification.config.subscribe_to_email_as_default.to_s});$(this).parent().parent().parent().next().next().slideDown();$(this).parent().parent().parent().next().next().find(\"input\").prop(\"checked\", #{ActivityNotification.config.subscribe_to_optional_targets_as_default});", method: :put, remote: true do %>
28
28
  <%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
29
29
  <div class="slider"></div>
30
30
  <% end %>
31
31
  <% else %>
32
- <%= link_to subscribe_path_for(subscription, option_params.merge(with_email_subscription: false)), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().next().slideDown();', method: :post, remote: true do %>
32
+ <%= link_to subscribe_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true);$(this).parent().parent().parent().next().slideDown();$(this).parent().parent().parent().next().next().slideDown();', method: :put, remote: true do %>
33
33
  <%= check_box :subscribing, "", { checked: false }, 'true', 'false' %>
34
34
  <div class="slider"></div>
35
35
  <% end %>
@@ -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 unsubscribe_to_email_url_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :post, remote: true do %>
51
+ <%= link_to unsubscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :put, 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 subscribe_to_email_url_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :post, remote: true do %>
58
+ <%= link_to subscribe_to_email_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :put, 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 unsubscribe_to_optional_target_url_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", false)', method: :post, remote: true do %>
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: :put, 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 subscribe_to_optional_target_url_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", true)', method: :post, remote: true do %>
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: :put, remote: true do %>
87
87
  <label>
88
88
  <%= check_box optional_target_name, "", { checked: false }, 'true', 'false' %>
89
89
  <div class="slider"></div>
@@ -1,7 +1,11 @@
1
1
  <div class="subscription_wrapper">
2
+ <div class="subscription_header">
3
+ <h1>Subscriptions for <%= @target.printable_target_name %></h1>
4
+ </div>
5
+
2
6
  <% unless @subscriptions.nil? %>
3
7
  <div class="subscription_header">
4
- <h1>Configured subscriptions</h1>
8
+ <h2>Configured subscriptions</h2>
5
9
  </div>
6
10
  <div class="subscriptions" id="subscriptions">
7
11
  <%= render 'subscriptions', subscriptions: @subscriptions, option_params: @index_options %>
@@ -10,7 +14,7 @@
10
14
 
11
15
  <% unless @notification_keys.nil? %>
12
16
  <div class="subscription_header">
13
- <h1>Unconfigured notification keys</h1>
17
+ <h2>Unconfigured notification keys</h2>
14
18
  </div>
15
19
  <div class="notification_keys" id="notification_keys">
16
20
  <%= render 'notification_keys', target: @target, notification_keys: @notification_keys, option_params: @index_options %>
@@ -18,7 +22,7 @@
18
22
  <% end %>
19
23
 
20
24
  <div class="subscription_header">
21
- <h1>Create a new subscription</h1>
25
+ <h2>Create a new subscription</h2>
22
26
  </div>
23
27
  <div class="subscription_form" id="subscription_form">
24
28
  <%= render 'form', target: @target, option_params: @index_options %>
@@ -26,6 +30,10 @@
26
30
  </div>
27
31
 
28
32
  <style>
33
+ .subscription_header h1 {
34
+ margin-bottom: 30px;
35
+ }
36
+
29
37
  .fields_area {
30
38
  border: 1px solid #e5e5e5;
31
39
  width: 600px;
@@ -44,10 +52,6 @@
44
52
  background-color: #f8f9fb;
45
53
  }
46
54
 
47
- .fields_area .fields_wrapper:last-child {
48
- border-bottom: none;
49
- }
50
-
51
55
  .fields_area .fields_wrapper .fields_title_wrapper {
52
56
  margin-bottom: 16px;
53
57
  border-bottom: none;
@@ -185,9 +189,9 @@
185
189
  $thisFieldWrapper = $(this).parent().parent().parent().parent();
186
190
  if ($(this).prop('checked')) {
187
191
  $thisFieldWrapper.next().slideDown();
188
- $thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_as_default %>);
192
+ $thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_email_as_default %>);
189
193
  $thisFieldWrapper.next().next().slideDown();
190
- $thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_as_default %>);
194
+ $thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_optional_targets_as_default %>);
191
195
  } else {
192
196
  $thisFieldWrapper.next().slideUp();
193
197
  $thisFieldWrapper.next().next().slideUp();
@@ -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>
@@ -165,9 +165,9 @@
165
165
  $thisFieldWrapper = $(this).parent().parent().parent().parent();
166
166
  if ($(this).prop('checked')) {
167
167
  $thisFieldWrapper.next().slideDown();
168
- $thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_as_default %>);
168
+ $thisFieldWrapper.next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_email_as_default %>);
169
169
  $thisFieldWrapper.next().next().slideDown();
170
- $thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_as_default %>);
170
+ $thisFieldWrapper.next().next().find("input[type='checkbox']").prop("checked", <%= ActivityNotification.config.subscribe_to_optional_targets_as_default %>);
171
171
  } else {
172
172
  $thisFieldWrapper.next().slideUp();
173
173
  $thisFieldWrapper.next().next().slideUp();
@@ -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
 
@@ -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
 
@@ -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
 
@@ -0,0 +1,4 @@
1
+ DIST_DIR=spec/DynamoDBLocal-latest
2
+ PIDFILE=dynamodb.pid
3
+ LISTEN_PORT=8000
4
+ LOG_DIR="logs"
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ bundle update
4
+ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-5.0 bundle update
5
+ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-5.1 bundle update
6
+ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-5.2 bundle update
7
+ BUNDLE_GEMFILE=gemfiles/Gemfile.rails-6.0.rc bundle update
@@ -0,0 +1,16 @@
1
+ #!/bin/bash
2
+
3
+ HEROKU_DEPLOYMENT_BRANCH=heroku-deployment
4
+
5
+ CURRENT_BRANCH=`git symbolic-ref --short HEAD`
6
+ git checkout -b $HEROKU_DEPLOYMENT_BRANCH
7
+ bundle install
8
+ sed -i "" -e "s/^\/Gemfile.lock/# \/Gemfile.lock/g" .gitignore
9
+ cp spec/rails_app/bin/webpack* bin/
10
+ git add .gitignore
11
+ git add Gemfile.lock
12
+ git add bin/webpack*
13
+ git commit -m "Add Gemfile.lock and webpack"
14
+ git push heroku ${HEROKU_DEPLOYMENT_BRANCH}:master --force
15
+ git checkout $CURRENT_BRANCH
16
+ git branch -D $HEROKU_DEPLOYMENT_BRANCH
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ wget https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip --quiet -O spec/dynamodb_temp.zip
4
+ unzip -qq spec/dynamodb_temp.zip -d spec/DynamoDBLocal-latest
5
+ rm spec/dynamodb_temp.zip
@@ -0,0 +1,47 @@
1
+ #!/bin/sh
2
+
3
+ # Source variables
4
+ . $(dirname $0)/_dynamodblocal
5
+
6
+ if [ -z $JAVA_HOME ]; then
7
+ echo >&2 'ERROR: DynamoDBLocal requires JAVA_HOME to be set.'
8
+ exit 1
9
+ fi
10
+
11
+ if [ ! -x $JAVA_HOME/bin/java ]; then
12
+ echo >&2 'ERROR: JAVA_HOME is set, but I do not see the java executable there.'
13
+ exit 1
14
+ fi
15
+
16
+ cd $DIST_DIR
17
+
18
+ if [ ! -f DynamoDBLocal.jar ] || [ ! -d DynamoDBLocal_lib ]; then
19
+ echo >&2 "ERROR: Could not find DynamoDBLocal files in $DIST_DIR."
20
+ exit 1
21
+ fi
22
+
23
+ mkdir -p $LOG_DIR
24
+ echo "DynamoDB Local output will save to ${DIST_DIR}/${LOG_DIR}/"
25
+ hash lsof 2>/dev/null && lsof -i :$LISTEN_PORT && { echo >&2 "Something is already listening on port $LISTEN_PORT; I will not attempt to start DynamoDBLocal."; exit 1; }
26
+
27
+ NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
28
+ nohup $JAVA_HOME/bin/java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -delayTransientStatuses -port $LISTEN_PORT -inMemory 1>"${LOG_DIR}/${NOW}.out.log" 2>"${LOG_DIR}/${NOW}.err.log" &
29
+ PID=$!
30
+
31
+ echo 'Verifying that DynamoDBLocal actually started...'
32
+
33
+ # Allow some seconds for the JDK to start and die.
34
+ counter=0
35
+ while [ $counter -le 5 ]; do
36
+ kill -0 $PID
37
+ if [ $? -ne 0 ]; then
38
+ echo >&2 'ERROR: DynamoDBLocal died after we tried to start it!'
39
+ exit 1
40
+ else
41
+ counter=$(($counter + 1))
42
+ sleep 1
43
+ fi
44
+ done
45
+
46
+ echo "DynamoDB Local started with pid $PID listening on port $LISTEN_PORT."
47
+ echo $PID > $PIDFILE
@@ -0,0 +1,34 @@
1
+ #!/bin/sh
2
+
3
+ # Source variables
4
+ . $(dirname $0)/_dynamodblocal
5
+
6
+ cd $DIST_DIR
7
+
8
+ if [ ! -f $PIDFILE ]; then
9
+ echo 'ERROR: There is no pidfile, so if DynamoDBLocal is running you will need to kill it yourself.'
10
+ exit 1
11
+ fi
12
+
13
+ pid=$(<$PIDFILE)
14
+
15
+ echo "Killing DynamoDBLocal at pid $pid..."
16
+ kill $pid
17
+
18
+ counter=0
19
+ while [ $counter -le 5 ]; do
20
+ kill -0 $pid 2>/dev/null
21
+ if [ $? -ne 0 ]; then
22
+ echo 'Successfully shut down DynamoDBLocal.'
23
+ rm -f $PIDFILE
24
+ exit 0
25
+ else
26
+ echo 'Still waiting for DynamoDBLocal to shut down...'
27
+ counter=$(($counter + 1))
28
+ sleep 1
29
+ fi
30
+ done
31
+
32
+ echo 'Unable to shut down DynamoDBLocal; you may need to kill it yourself.'
33
+ rm -f $PIDFILE
34
+ exit 1
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at shota.yamazaki.8@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -0,0 +1,36 @@
1
+ ## How to contribute to *activity_notification*
2
+
3
+ #### **Did you find a bug?**
4
+
5
+ * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/simukappu/activity_notification/issues).
6
+
7
+ * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/simukappu/activity_notification/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible.
8
+
9
+ #### **Did you write code set for a new feature or a patch that fixes a bug?**
10
+
11
+ * Open a new GitHub pull request with your code set.
12
+
13
+ * Ensure the pull request description clearly describes the problem and solution. Include the relevant issue number if applicable.
14
+
15
+ * Before submitting, please check the followings:
16
+ * Write tests with RSpec to cover your changes
17
+ * Write code documents as YARD format to cover your changes
18
+ * Write [README](/README.md) and [Functions](/docs/Functions.md) documents if applicable
19
+
20
+ #### **Did you fix whitespace, format code, or make a purely cosmetic patch?**
21
+
22
+ * Feel free to create a new GitHub pull request.
23
+
24
+ * If changes that are cosmetic in nature and do not add anything substantial to the stability, functionality, or testability of the gem may not be accepted.
25
+
26
+ #### **Do you intend to add a new feature or change an existing one?**
27
+
28
+ * Open an issue on GitHub to suggest your change and collect feedback about the change.
29
+
30
+ #### **Do you have questions about the source code?**
31
+
32
+ * If you're unable to find any answers from public information and your own investigation, you can ask any questions about how to use *activity_notification* by creating GitHub issue.
33
+
34
+ *activity_notification* is a volunteer effort. We appreciate any of your contribution!
35
+
36
+ Thank you!