activity_notification 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/app/jobs/activity_notification/cascading_notification_job.rb +123 -0
  4. data/docs/Functions.md +197 -1
  5. data/lib/activity_notification/apis/cascading_notification_api.rb +208 -0
  6. data/lib/activity_notification/apis/notification_api.rb +3 -0
  7. data/lib/activity_notification/config.rb +10 -0
  8. data/lib/activity_notification/mailers/helpers.rb +27 -1
  9. data/lib/activity_notification/version.rb +1 -1
  10. data/lib/generators/templates/activity_notification.rb +8 -0
  11. metadata +5 -441
  12. data/.codeclimate.yml +0 -33
  13. data/.coveralls.yml +0 -1
  14. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
  15. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -17
  16. data/.github/pull_request_template.md +0 -13
  17. data/.github/workflows/build.yml +0 -100
  18. data/.gitignore +0 -74
  19. data/.rspec +0 -3
  20. data/.rubocop.yml +0 -1157
  21. data/.yardopts +0 -6
  22. data/CHANGELOG.md +0 -452
  23. data/Gemfile +0 -31
  24. data/Procfile +0 -2
  25. data/Rakefile +0 -28
  26. data/activity_notification.gemspec +0 -44
  27. data/ai-curated-specs/issues/172/design.md +0 -220
  28. data/ai-curated-specs/issues/172/tasks.md +0 -326
  29. data/ai-curated-specs/issues/188/design.md +0 -227
  30. data/ai-curated-specs/issues/188/requirements.md +0 -78
  31. data/ai-curated-specs/issues/188/tasks.md +0 -203
  32. data/ai-curated-specs/issues/188/upstream-contributions.md +0 -592
  33. data/ai-curated-specs/issues/50/design.md +0 -235
  34. data/ai-curated-specs/issues/50/requirements.md +0 -49
  35. data/ai-curated-specs/issues/50/tasks.md +0 -232
  36. data/bin/_dynamodblocal +0 -4
  37. data/bin/bundle_update.sh +0 -7
  38. data/bin/deploy_on_heroku.sh +0 -16
  39. data/bin/install_dynamodblocal.sh +0 -5
  40. data/bin/start_dynamodblocal.sh +0 -47
  41. data/bin/stop_dynamodblocal.sh +0 -34
  42. data/gemfiles/Gemfile.rails-5.0 +0 -25
  43. data/gemfiles/Gemfile.rails-5.1 +0 -25
  44. data/gemfiles/Gemfile.rails-5.2 +0 -24
  45. data/gemfiles/Gemfile.rails-6.0 +0 -23
  46. data/gemfiles/Gemfile.rails-6.1 +0 -22
  47. data/gemfiles/Gemfile.rails-7.0 +0 -25
  48. data/gemfiles/Gemfile.rails-7.1 +0 -23
  49. data/gemfiles/Gemfile.rails-7.2 +0 -23
  50. data/gemfiles/Gemfile.rails-8.0 +0 -24
  51. data/package.json +0 -8
  52. data/spec/channels/notification_api_channel_shared_examples.rb +0 -59
  53. data/spec/channels/notification_api_channel_spec.rb +0 -49
  54. data/spec/channels/notification_api_with_devise_channel_spec.rb +0 -76
  55. data/spec/channels/notification_channel_shared_examples.rb +0 -59
  56. data/spec/channels/notification_channel_spec.rb +0 -48
  57. data/spec/channels/notification_with_devise_channel_spec.rb +0 -97
  58. data/spec/concerns/apis/notification_api_spec.rb +0 -1627
  59. data/spec/concerns/apis/subscription_api_spec.rb +0 -474
  60. data/spec/concerns/common_spec.rb +0 -213
  61. data/spec/concerns/models/group_spec.rb +0 -61
  62. data/spec/concerns/models/notifiable_spec.rb +0 -782
  63. data/spec/concerns/models/notifier_spec.rb +0 -71
  64. data/spec/concerns/models/subscriber_spec.rb +0 -800
  65. data/spec/concerns/models/target_spec.rb +0 -1285
  66. data/spec/concerns/renderable_spec.rb +0 -129
  67. data/spec/config_spec.rb +0 -85
  68. data/spec/controllers/common_controller_spec.rb +0 -25
  69. data/spec/controllers/controller_spec_utility.rb +0 -100
  70. data/spec/controllers/dummy_common_controller.rb +0 -5
  71. data/spec/controllers/notifications_api_controller_shared_examples.rb +0 -619
  72. data/spec/controllers/notifications_api_controller_spec.rb +0 -19
  73. data/spec/controllers/notifications_api_with_devise_controller_spec.rb +0 -60
  74. data/spec/controllers/notifications_controller_shared_examples.rb +0 -743
  75. data/spec/controllers/notifications_controller_spec.rb +0 -11
  76. data/spec/controllers/notifications_with_devise_controller_spec.rb +0 -97
  77. data/spec/controllers/subscriptions_api_controller_shared_examples.rb +0 -750
  78. data/spec/controllers/subscriptions_api_controller_spec.rb +0 -19
  79. data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +0 -60
  80. data/spec/controllers/subscriptions_controller_shared_examples.rb +0 -946
  81. data/spec/controllers/subscriptions_controller_spec.rb +0 -11
  82. data/spec/controllers/subscriptions_with_devise_controller_spec.rb +0 -97
  83. data/spec/factories/admins.rb +0 -5
  84. data/spec/factories/articles.rb +0 -5
  85. data/spec/factories/comments.rb +0 -6
  86. data/spec/factories/dummy/dummy_group.rb +0 -4
  87. data/spec/factories/dummy/dummy_notifiable.rb +0 -4
  88. data/spec/factories/dummy/dummy_notifier.rb +0 -4
  89. data/spec/factories/dummy/dummy_subscriber.rb +0 -4
  90. data/spec/factories/dummy/dummy_target.rb +0 -4
  91. data/spec/factories/notifications.rb +0 -7
  92. data/spec/factories/subscriptions.rb +0 -8
  93. data/spec/factories/users.rb +0 -11
  94. data/spec/generators/controllers_generator_spec.rb +0 -85
  95. data/spec/generators/install_generator_spec.rb +0 -43
  96. data/spec/generators/migration/migration_generator_spec.rb +0 -80
  97. data/spec/generators/models_generator_spec.rb +0 -96
  98. data/spec/generators/views_generator_spec.rb +0 -195
  99. data/spec/helpers/polymorphic_helpers_spec.rb +0 -89
  100. data/spec/helpers/view_helpers_spec.rb +0 -547
  101. data/spec/jobs/notification_resilience_job_spec.rb +0 -167
  102. data/spec/jobs/notify_all_job_spec.rb +0 -23
  103. data/spec/jobs/notify_job_spec.rb +0 -23
  104. data/spec/jobs/notify_to_job_spec.rb +0 -23
  105. data/spec/mailers/mailer_spec.rb +0 -214
  106. data/spec/mailers/notification_resilience_spec.rb +0 -263
  107. data/spec/models/dummy/dummy_group_spec.rb +0 -10
  108. data/spec/models/dummy/dummy_notifiable_spec.rb +0 -10
  109. data/spec/models/dummy/dummy_notifier_spec.rb +0 -10
  110. data/spec/models/dummy/dummy_subscriber_spec.rb +0 -8
  111. data/spec/models/dummy/dummy_target_spec.rb +0 -10
  112. data/spec/models/notification_spec.rb +0 -472
  113. data/spec/models/subscription_spec.rb +0 -215
  114. data/spec/optional_targets/action_cable_api_channel_spec.rb +0 -34
  115. data/spec/optional_targets/action_cable_channel_spec.rb +0 -41
  116. data/spec/optional_targets/amazon_sns_spec.rb +0 -47
  117. data/spec/optional_targets/base_spec.rb +0 -45
  118. data/spec/optional_targets/slack_spec.rb +0 -44
  119. data/spec/orm/dynamoid_spec.rb +0 -115
  120. data/spec/rails_app/Rakefile +0 -15
  121. data/spec/rails_app/app/assets/config/manifest.js +0 -3
  122. data/spec/rails_app/app/assets/images/.keep +0 -0
  123. data/spec/rails_app/app/assets/javascripts/application.js +0 -3
  124. data/spec/rails_app/app/assets/javascripts/cable.js +0 -12
  125. data/spec/rails_app/app/assets/stylesheets/application.css +0 -15
  126. data/spec/rails_app/app/assets/stylesheets/reset.css +0 -85
  127. data/spec/rails_app/app/assets/stylesheets/style.css +0 -244
  128. data/spec/rails_app/app/controllers/admins_controller.rb +0 -21
  129. data/spec/rails_app/app/controllers/application_controller.rb +0 -5
  130. data/spec/rails_app/app/controllers/articles_controller.rb +0 -67
  131. data/spec/rails_app/app/controllers/comments_controller.rb +0 -36
  132. data/spec/rails_app/app/controllers/concerns/.keep +0 -0
  133. data/spec/rails_app/app/controllers/spa_controller.rb +0 -7
  134. data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -2
  135. data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -2
  136. data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -2
  137. data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -2
  138. data/spec/rails_app/app/controllers/users_controller.rb +0 -26
  139. data/spec/rails_app/app/helpers/application_helper.rb +0 -2
  140. data/spec/rails_app/app/helpers/devise_helper.rb +0 -2
  141. data/spec/rails_app/app/javascript/App.vue +0 -40
  142. data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +0 -82
  143. data/spec/rails_app/app/javascript/components/Top.vue +0 -98
  144. data/spec/rails_app/app/javascript/components/notifications/Index.vue +0 -200
  145. data/spec/rails_app/app/javascript/components/notifications/Notification.vue +0 -133
  146. data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +0 -122
  147. data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +0 -279
  148. data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +0 -112
  149. data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +0 -141
  150. data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +0 -226
  151. data/spec/rails_app/app/javascript/config/development.js +0 -5
  152. data/spec/rails_app/app/javascript/config/environment.js +0 -7
  153. data/spec/rails_app/app/javascript/config/production.js +0 -5
  154. data/spec/rails_app/app/javascript/config/test.js +0 -5
  155. data/spec/rails_app/app/javascript/packs/application.js +0 -18
  156. data/spec/rails_app/app/javascript/packs/spa.js +0 -14
  157. data/spec/rails_app/app/javascript/router/index.js +0 -73
  158. data/spec/rails_app/app/javascript/store/index.js +0 -37
  159. data/spec/rails_app/app/mailers/.keep +0 -0
  160. data/spec/rails_app/app/mailers/custom_notification_mailer.rb +0 -5
  161. data/spec/rails_app/app/models/admin.rb +0 -35
  162. data/spec/rails_app/app/models/article.rb +0 -54
  163. data/spec/rails_app/app/models/comment.rb +0 -81
  164. data/spec/rails_app/app/models/dummy/dummy_base.rb +0 -11
  165. data/spec/rails_app/app/models/dummy/dummy_group.rb +0 -23
  166. data/spec/rails_app/app/models/dummy/dummy_notifiable.rb +0 -15
  167. data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +0 -27
  168. data/spec/rails_app/app/models/dummy/dummy_notifier.rb +0 -15
  169. data/spec/rails_app/app/models/dummy/dummy_subscriber.rb +0 -14
  170. data/spec/rails_app/app/models/dummy/dummy_target.rb +0 -16
  171. data/spec/rails_app/app/models/user.rb +0 -73
  172. data/spec/rails_app/app/views/activity_notification/mailer/dummy_subscribers/test_key.text.erb +0 -1
  173. data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +0 -146
  174. data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_path_test.html.erb +0 -1
  175. data/spec/rails_app/app/views/activity_notification/notifications/default/custom/_test.html.erb +0 -1
  176. data/spec/rails_app/app/views/activity_notification/notifications/users/_custom_index.html.erb +0 -1
  177. data/spec/rails_app/app/views/activity_notification/notifications/users/custom/_test.html.erb +0 -1
  178. data/spec/rails_app/app/views/activity_notification/notifications/users/overridden/custom/_test.html.erb +0 -1
  179. data/spec/rails_app/app/views/activity_notification/optional_targets/admins/amazon_sns/comment/_default.text.erb +0 -10
  180. data/spec/rails_app/app/views/articles/_form.html.erb +0 -24
  181. data/spec/rails_app/app/views/articles/edit.html.erb +0 -8
  182. data/spec/rails_app/app/views/articles/index.html.erb +0 -113
  183. data/spec/rails_app/app/views/articles/new.html.erb +0 -7
  184. data/spec/rails_app/app/views/articles/show.html.erb +0 -49
  185. data/spec/rails_app/app/views/layouts/_header.html.erb +0 -46
  186. data/spec/rails_app/app/views/layouts/application.html.erb +0 -15
  187. data/spec/rails_app/app/views/spa/index.html.erb +0 -2
  188. data/spec/rails_app/babel.config.js +0 -72
  189. data/spec/rails_app/bin/bundle +0 -3
  190. data/spec/rails_app/bin/rails +0 -4
  191. data/spec/rails_app/bin/rake +0 -4
  192. data/spec/rails_app/bin/setup +0 -29
  193. data/spec/rails_app/bin/webpack +0 -18
  194. data/spec/rails_app/bin/webpack-dev-server +0 -18
  195. data/spec/rails_app/config/application.rb +0 -54
  196. data/spec/rails_app/config/boot.rb +0 -5
  197. data/spec/rails_app/config/cable.yml +0 -8
  198. data/spec/rails_app/config/database.yml +0 -36
  199. data/spec/rails_app/config/dynamoid.rb +0 -13
  200. data/spec/rails_app/config/environment.rb +0 -26
  201. data/spec/rails_app/config/environments/development.rb +0 -60
  202. data/spec/rails_app/config/environments/production.rb +0 -85
  203. data/spec/rails_app/config/environments/test.rb +0 -53
  204. data/spec/rails_app/config/initializers/activity_notification.rb +0 -104
  205. data/spec/rails_app/config/initializers/assets.rb +0 -11
  206. data/spec/rails_app/config/initializers/backtrace_silencers.rb +0 -7
  207. data/spec/rails_app/config/initializers/cookies_serializer.rb +0 -3
  208. data/spec/rails_app/config/initializers/copy_it.aws.rb.template +0 -6
  209. data/spec/rails_app/config/initializers/devise.rb +0 -278
  210. data/spec/rails_app/config/initializers/devise_token_auth.rb +0 -55
  211. data/spec/rails_app/config/initializers/filter_parameter_logging.rb +0 -4
  212. data/spec/rails_app/config/initializers/inflections.rb +0 -16
  213. data/spec/rails_app/config/initializers/mime_types.rb +0 -4
  214. data/spec/rails_app/config/initializers/mysql.rb +0 -9
  215. data/spec/rails_app/config/initializers/session_store.rb +0 -3
  216. data/spec/rails_app/config/initializers/wrap_parameters.rb +0 -14
  217. data/spec/rails_app/config/initializers/zeitwerk.rb +0 -10
  218. data/spec/rails_app/config/locales/activity_notification.en.yml +0 -26
  219. data/spec/rails_app/config/locales/devise.en.yml +0 -62
  220. data/spec/rails_app/config/mongoid.yml +0 -13
  221. data/spec/rails_app/config/routes.rb +0 -50
  222. data/spec/rails_app/config/secrets.yml +0 -22
  223. data/spec/rails_app/config/webpack/development.js +0 -5
  224. data/spec/rails_app/config/webpack/environment.js +0 -7
  225. data/spec/rails_app/config/webpack/loaders/vue.js +0 -6
  226. data/spec/rails_app/config/webpack/production.js +0 -5
  227. data/spec/rails_app/config/webpack/test.js +0 -5
  228. data/spec/rails_app/config/webpacker.yml +0 -97
  229. data/spec/rails_app/config.ru +0 -4
  230. data/spec/rails_app/db/migrate/20160716000000_create_test_tables.rb +0 -42
  231. data/spec/rails_app/db/migrate/20181209000000_create_activity_notification_tables.rb +0 -33
  232. data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +0 -10
  233. data/spec/rails_app/db/schema.rb +0 -98
  234. data/spec/rails_app/db/seeds.rb +0 -95
  235. data/spec/rails_app/lib/custom_optional_targets/console_output.rb +0 -16
  236. data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +0 -14
  237. data/spec/rails_app/lib/custom_optional_targets/wrong_target.rb +0 -13
  238. data/spec/rails_app/lib/mailer_previews/mailer_preview.rb +0 -29
  239. data/spec/rails_app/package.json +0 -23
  240. data/spec/rails_app/postcss.config.js +0 -12
  241. data/spec/rails_app/public/404.html +0 -67
  242. data/spec/rails_app/public/422.html +0 -67
  243. data/spec/rails_app/public/500.html +0 -66
  244. data/spec/rails_app/public/favicon.ico +0 -0
  245. data/spec/roles/acts_as_group_spec.rb +0 -30
  246. data/spec/roles/acts_as_notifiable_spec.rb +0 -432
  247. data/spec/roles/acts_as_notifier_spec.rb +0 -30
  248. data/spec/roles/acts_as_target_spec.rb +0 -36
  249. data/spec/spec_helper.rb +0 -56
  250. data/spec/version_spec.rb +0 -31
@@ -1,200 +0,0 @@
1
- <template>
2
- <div class="notification_wrapper">
3
- <div class="notification_header">
4
- <h1>
5
- Notifications to {{ currentTarget.printable_target_name }}
6
- <a href="#" v-on:click="openAll()" data-remote="true">
7
- <span class="notification_count"><span v-bind:class="[unopenedNotificationCount > 0 ? 'unopened' : '']">
8
- {{ unopenedNotificationCount }}
9
- </span></span>
10
- </a>
11
- </h1>
12
- <h3>
13
- <span class="action_cable_status">{{ actionCableStatus }}</span>
14
- </h3>
15
- </div>
16
- <div class="notifications">
17
- <div v-for="notification in notifications" :key="`${notification.id}_${notification.opened_at}_${notification.group_notification_count}`">
18
- <notification :targetNotification="notification" :targetApiPath="targetApiPath" @getUnopenedNotificationCount="getUnopenedNotificationCount" />
19
- </div>
20
- </div>
21
- </div>
22
- </template>
23
-
24
- <script>
25
- import axios from 'axios'
26
- import Push from 'push.js'
27
- import Notification from './Notification.vue'
28
-
29
- export default {
30
- name: 'NotificationsIndex',
31
- components: {
32
- Notification
33
- },
34
- props: {
35
- target_type: {
36
- type: String,
37
- required: true
38
- },
39
- target_id: {
40
- type: [String, Number]
41
- },
42
- targetApiPath: {
43
- type: String,
44
- default: function () {
45
- if (this.target_type && this.target_id) {
46
- return '/' + this.target_type + '/' + this.target_id;
47
- } else {
48
- return '';
49
- }
50
- }
51
- },
52
- target: {
53
- type: Object
54
- }
55
- },
56
- data () {
57
- return {
58
- currentTarget: { printable_target_name: '' },
59
- unopenedNotificationCount: 0,
60
- notifications: [],
61
- actionCableStatus: "Disabled"
62
- }
63
- },
64
- mounted () {
65
- if (this.target) {
66
- this.currentTarget = this.target;
67
- this.subscribeActionCable();
68
- } else {
69
- this.getCurrentTarget();
70
- }
71
- this.getNotifications();
72
- this.getUnopenedNotificationCount();
73
- },
74
- channels: {
75
- 'ActivityNotification::NotificationApiChannel': {
76
- connected() {
77
- this.actionCableStatus = "Online";
78
- },
79
- disconnected() {
80
- this.actionCableStatus = "Offline";
81
- },
82
- rejected() {
83
- this.actionCableStatus = "Offline (unauthorized)";
84
- },
85
- received(data) {
86
- this.notify(data);
87
- }
88
- },
89
- 'ActivityNotification::NotificationApiWithDeviseChannel': {
90
- connected() {
91
- this.actionCableStatus = "Online (authorized)";
92
- },
93
- disconnected() {
94
- this.actionCableStatus = "Offline";
95
- },
96
- rejected() {
97
- this.actionCableStatus = "Offline (unauthorized)";
98
- },
99
- received(data) {
100
- this.notify(data);
101
- }
102
- }
103
- },
104
- methods: {
105
- getCurrentTarget () {
106
- axios
107
- .get(this.targetApiPath)
108
- .then(response => {
109
- this.currentTarget = response.data;
110
- this.subscribeActionCable();
111
- })
112
- },
113
- getNotifications () {
114
- axios
115
- .get(this.targetApiPath + '/notifications', { params: this.$route.query })
116
- .then(response => (this.notifications = response.data.notifications))
117
- .catch (error => {
118
- if (error.response.status == 401) {
119
- this.$router.push('/logout');
120
- }
121
- })
122
- },
123
- getUnopenedNotificationCount () {
124
- if (this.$route.query.filter == 'opened') {
125
- this.unopenedNotificationCount = 0;
126
- } else {
127
- axios
128
- .get(this.targetApiPath + '/notifications', { params: Object.assign({ filter: 'unopened' }, this.$route.query) })
129
- .then(response => (this.unopenedNotificationCount = response.data.count))
130
- .catch (error => {
131
- if (error.response.status == 401) {
132
- this.$router.push('/logout');
133
- }
134
- })
135
- }
136
- },
137
- openAll () {
138
- axios
139
- .post(this.targetApiPath + '/notifications/open_all')
140
- .then(response => {
141
- if (response.status == 200) {
142
- this.getNotifications();
143
- this.getUnopenedNotificationCount();
144
- }
145
- })
146
- },
147
- subscribeActionCable () {
148
- if (this.currentTarget['notification_action_cable_allowed?']) {
149
- if (!this.currentTarget['notification_action_cable_with_devise?']) {
150
- this.$cable.subscribe({
151
- channel: 'ActivityNotification::NotificationApiChannel',
152
- target_type: this.target_type, target_id: this.currentTarget.id
153
- });
154
- } else {
155
- this.$cable.subscribe({
156
- channel: 'ActivityNotification::NotificationApiWithDeviseChannel',
157
- target_type: this.target_type, target_id: this.currentTarget.id,
158
- 'access-token': axios.defaults.headers.common['access-token'],
159
- 'client': axios.defaults.headers.common['client'],
160
- 'uid': axios.defaults.headers.common['uid']
161
- });
162
- }
163
- }
164
- },
165
- notify (data) {
166
- // Display notification
167
- if (data.group_owner == null) {
168
- this.notifications.unshift(data.notification);
169
- this.getUnopenedNotificationCount();
170
- } else {
171
- this.notifications.splice(this.notifications.findIndex(n => n.id === data.group_owner.id), 1);
172
- this.notifications.unshift(data.group_owner);
173
- this.getUnopenedNotificationCount();
174
- }
175
- // Push notificaion using Web Notification API by Push.js
176
- Push.create('ActivityNotification', {
177
- body: data.notification.text,
178
- timeout: 5000,
179
- onClick: function () {
180
- location.href = data.notification.notifiable_path;
181
- this.close();
182
- }
183
- });
184
- }
185
- }
186
- }
187
- </script>
188
-
189
- <style scoped>
190
- .notification_wrapper .notification_header h1 span span{
191
- color: #fff;
192
- background-color: #e5e5e5;
193
- border-radius: 4px;
194
- font-size: 12px;
195
- padding: 4px 8px;
196
- }
197
- .notification_wrapper .notification_header h1 span span.unopened{
198
- background-color: #f87880;
199
- }
200
- </style>
@@ -1,133 +0,0 @@
1
- <template>
2
- <div v-bind:class="`notification_${notification.id}`">
3
- <div v-if="!notification.opened_at">
4
- <a href="#" v-on:click="open(notification)" data-remote="true" class="unopened_wrapper">
5
- <div class="unopened_circle"></div>
6
- <div class="unopened_description_wrapper">
7
- <p class="unopened_description">Open</p>
8
- </div>
9
- </a>
10
- <a href="#" v-on:click="move(notification, '?open=true')" data-remote="true">
11
- <notification-content :notification="notification" />
12
- </a>
13
- <div class="unopened_wrapper"></div>
14
- </div>
15
- <div v-else>
16
- <a href="#" v-on:click="move(notification, '')" data-remote="true">
17
- <notification-content :notification="notification" />
18
- </a>
19
- </div>
20
- </div>
21
- </template>
22
-
23
- <script>
24
- import axios from 'axios'
25
- import NotificationContent from './NotificationContent.vue'
26
-
27
- export default {
28
- name: 'Notification',
29
- components: {
30
- NotificationContent
31
- },
32
- props: {
33
- targetNotification: {
34
- type: Object,
35
- required: true
36
- },
37
- targetApiPath: {
38
- type: String,
39
- required: true
40
- }
41
- },
42
- data () {
43
- return {
44
- notification: this.targetNotification,
45
- baseURL: axios.defaults.baseURL + this.targetApiPath
46
- }
47
- },
48
- methods: {
49
- open (notification) {
50
- axios
51
- .put(this.targetApiPath + '/notifications/' + notification.id + '/open')
52
- .then(response => {
53
- if (response.status == 200) {
54
- this.$emit('getUnopenedNotificationCount')
55
- this.notification = response.data.notification
56
- }
57
- })
58
- .catch (error => {
59
- if (error.response.status == 401) {
60
- this.$router.push('/logout');
61
- }
62
- })
63
- },
64
- move (notification, paramsString) {
65
- axios
66
- .get(this.targetApiPath + '/notifications/' + notification.id + '/move' + paramsString)
67
- .then(response => {
68
- if (response.status == 200) {
69
- window.location.href = response.request.responseURL;
70
- }
71
- })
72
- .catch (error => {
73
- if (error.response.status == 401) {
74
- this.$router.push('/logout');
75
- }
76
- })
77
- }
78
- }
79
- }
80
- </script>
81
-
82
- <style scoped>
83
- /* unopened_circle */
84
- .unopened_wrapper{
85
- position: absolute;
86
- margin-top: 20px;
87
- margin-left: 56px;
88
- }
89
- .unopened_wrapper .unopened_circle {
90
- display: block;
91
- width: 10px;
92
- height: 10px;
93
- position: absolute;
94
- border-radius: 50%;
95
- background-color: #27a5eb;
96
- z-index: 2;
97
- }
98
- .unopened_wrapper:hover > .unopened_description_wrapper{
99
- display: block;
100
- }
101
- .unopened_wrapper .unopened_description_wrapper {
102
- display: none;
103
- position: absolute;
104
- margin-top: 26px;
105
- margin-left: -24px;
106
- }
107
- .unopened_wrapper .unopened_description_wrapper .unopened_description {
108
- position: absolute;
109
- color: #fff;
110
- font-size: 12px;
111
- text-align: center;
112
-
113
- border-radius: 4px;
114
- background: rgba(0, 0, 0, 0.8);
115
- padding: 4px 12px;
116
- z-index: 999;
117
- }
118
- .unopened_wrapper .unopened_description_wrapper .unopened_description:before {
119
- border: solid transparent;
120
- border-top-width: 0;
121
- content: "";
122
- display: block;
123
- position: absolute;
124
- width: 0;
125
- left: 50%;
126
- top: -5px;
127
- margin-left: -5px;
128
- height: 0;
129
- border-width: 0 5px 5px 5px;
130
- border-color: transparent transparent rgba(0, 0, 0, 0.8) transparent;
131
- z-index: 0;
132
- }
133
- </style>
@@ -1,122 +0,0 @@
1
- <template>
2
- <div v-bind:class="[notification.opened_at ? 'opened' : 'unopened', 'notification_list']">
3
- <div class="notification_list_cover"></div>
4
- <div class="list_image"></div>
5
- <div class="list_text_wrapper">
6
- <!-- Custom view -->
7
- <p v-if="notification.key == 'article.update'" class="list_text">
8
- <strong>{{ notification.notifier.name }}</strong> updated his or her article "{{ notification.notifiable.title }}".
9
- <br>
10
- <span class="created_at">{{ new Date(notification.created_at) | moment('timezone', 'UTC', "MMM DD HH:mm") }}</span>
11
- </p>
12
- <!-- Default view -->
13
- <p v-else class="list_text">
14
- <strong v-if="notification.notifier">{{ notification.notifier.printable_notifier_name }}</strong>
15
- <strong v-else>Someone</strong>
16
- <span v-if="notification.group_member_notifier_count > 0">
17
- and {{ notification.group_member_notifier_count }} other
18
- <span v-if="notification.notifier">{{ notification.notifier.printable_type.toLowerCase() | pluralize(notification.group_member_notifier_count) }}</span>
19
- <span v-else>people</span>
20
- </span>
21
- notified you of
22
- <span v-if="notification.notifiable" key="notification-group">
23
- <span v-if="notification.group_members.length">
24
- {{ notification.group_notification_count }} {{notification.notifiable_type.toLowerCase() | pluralize(notification.group_notification_count) }} including
25
- </span>
26
- {{ notification.printable_notifiable_name }}
27
- <span v-if="notification.group"> in {{ notification.group.printable_group_name }}</span>
28
- </span>
29
- <span v-else key="notification-group">
30
- <span v-if="notification.group_members.length" key="group-members">
31
- {{ notification.group_notification_count }} {{notification.notifiable_type.toLowerCase() | pluralize(notification.group_notification_count) }}
32
- </span>
33
- <span v-else key="group-members">
34
- a {{ notification.notifiable_typetoLowerCase() | pluralize(0) }}
35
- </span>
36
- <span v-if="notification.group"> in {{ notification.group.printable_group_name }}</span>
37
- but the notifiable is not found. It may have been deleted.
38
- </span>
39
- <br>
40
- <span class="created_at">{{ new Date(notification.created_at) | moment('timezone', 'UTC', "MMM DD hh:mm") }}</span>
41
- </p>
42
- </div>
43
- </div>
44
- </template>
45
-
46
- <script>
47
- export default {
48
- name: 'NotificationContent',
49
- props: {
50
- notification: {
51
- type: Object,
52
- required: true
53
- }
54
- }
55
- }
56
- </script>
57
-
58
- <style scoped>
59
- /* list */
60
- .notification_list {
61
- padding: 15px 10px;
62
- position: relative;
63
- border-bottom: 1px solid #e5e5e5;
64
- }
65
- .notification_list.unopened {
66
- background-color: #eeeff4;
67
- }
68
- .notification_list:hover {
69
- background-color: #f8f9fb;
70
- }
71
- .notification_list:last-child {
72
- border-bottom: none;
73
- }
74
- .notification_list:after{
75
- content: "";
76
- clear: both;
77
- display: block;
78
- }
79
- .notification_list .notification_list_cover{
80
- position: absolute;
81
- opacity: 0;
82
- top: 0;
83
- left: 0;
84
- width: 100%;
85
- height: 100%;
86
- z-index: 1;
87
-
88
- }
89
- .notification_list .list_image {
90
- float: left;
91
- width: 40px;
92
- height: 40px;
93
- background-position: center;
94
- background-repeat: no-repeat;
95
- background-size: cover;
96
- background-color: #979797;
97
- }
98
- .notification_list .list_text_wrapper {
99
- float: left;
100
- width: calc(100% - 60px);
101
- margin-left: 20px;
102
- }
103
- .notification_list .list_text_wrapper .list_text {
104
- color: #4f4f4f;
105
- font-size: 14px;
106
- line-height: 1.4;
107
- margin-top: 0;
108
- height: auto;
109
- font-weight: normal;
110
- }
111
- .notification_list .list_text_wrapper .list_text span {
112
- color: #4f4f4f;
113
- font-size: 14px;
114
- }
115
- .notification_list .list_text_wrapper .list_text strong{
116
- font-weight: bold;
117
- }
118
- .notification_list .list_text_wrapper .list_text span.created_at {
119
- color: #979797;
120
- font-size: 13px;
121
- }
122
- </style>