activity_notification 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/.github/pull_request_template.md +13 -0
- data/.gitignore +10 -3
- data/.travis.yml +6 -5
- data/CHANGELOG.md +22 -0
- data/Gemfile +8 -2
- data/Procfile +1 -1
- data/README.md +153 -1510
- data/activity_notification.gemspec +4 -1
- data/app/channels/activity_notification/notification_api_channel.rb +12 -0
- data/app/channels/activity_notification/notification_api_with_devise_channel.rb +46 -0
- data/app/channels/activity_notification/notification_channel.rb +1 -1
- data/app/channels/activity_notification/notification_with_devise_channel.rb +1 -1
- data/app/controllers/activity_notification/apidocs_controller.rb +75 -0
- data/app/controllers/activity_notification/notifications_api_controller.rb +143 -0
- data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/notifications_controller.rb +79 -53
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +197 -0
- data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/subscriptions_controller.rb +78 -69
- data/app/views/activity_notification/notifications/default/_default.html.erb +18 -18
- data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +14 -14
- data/app/views/activity_notification/notifications/default/index.html.erb +6 -6
- data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb +176 -0
- data/app/views/activity_notification/subscriptions/default/_form.html.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +3 -31
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +7 -7
- data/app/views/activity_notification/subscriptions/default/index.html.erb +11 -7
- data/bin/deploy_on_heroku.sh +3 -1
- data/docs/CODE_OF_CONDUCT.md +76 -0
- data/docs/CONTRIBUTING.md +36 -0
- data/docs/Functions.md +1130 -0
- data/docs/Setup.md +674 -0
- data/docs/Testing.md +148 -0
- data/gemfiles/Gemfile.rails-4.2 +3 -0
- data/gemfiles/Gemfile.rails-5.0 +3 -0
- data/gemfiles/Gemfile.rails-5.1 +3 -0
- data/gemfiles/Gemfile.rails-5.2 +3 -0
- data/gemfiles/{Gemfile.rails-6.0.rc → Gemfile.rails-6.0} +5 -3
- data/lib/activity_notification.rb +13 -1
- data/lib/activity_notification/apis/notification_api.rb +29 -92
- data/lib/activity_notification/apis/subscription_api.rb +20 -8
- data/lib/activity_notification/apis/swagger.rb +6 -0
- data/lib/activity_notification/config.rb +41 -21
- data/lib/activity_notification/controllers/common_api_controller.rb +30 -0
- data/lib/activity_notification/controllers/common_controller.rb +44 -20
- data/lib/activity_notification/controllers/concerns/swagger/error_responses.rb +55 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +273 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +92 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_api.rb +405 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_parameters.rb +50 -0
- data/lib/activity_notification/controllers/devise_authentication_controller.rb +7 -6
- data/lib/activity_notification/gem_version.rb +14 -0
- data/lib/activity_notification/helpers/errors.rb +2 -0
- data/lib/activity_notification/helpers/view_helpers.rb +4 -0
- data/lib/activity_notification/mailers/helpers.rb +17 -10
- data/lib/activity_notification/models/concerns/notifiable.rb +26 -10
- data/lib/activity_notification/models/concerns/subscriber.rb +12 -1
- data/lib/activity_notification/models/concerns/swagger/error_schema.rb +36 -0
- data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +209 -0
- data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +162 -0
- data/lib/activity_notification/models/concerns/target.rb +36 -10
- data/lib/activity_notification/models/notification.rb +1 -0
- data/lib/activity_notification/models/subscription.rb +1 -0
- data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +69 -0
- data/lib/activity_notification/optional_targets/action_cable_channel.rb +68 -0
- data/lib/activity_notification/optional_targets/base.rb +7 -13
- data/lib/activity_notification/orm/active_record/notification.rb +17 -1
- data/lib/activity_notification/orm/active_record/subscription.rb +1 -1
- data/lib/activity_notification/orm/dynamoid.rb +28 -0
- data/lib/activity_notification/orm/dynamoid/extension.rb +79 -1
- data/lib/activity_notification/orm/dynamoid/notification.rb +1 -1
- data/lib/activity_notification/orm/dynamoid/subscription.rb +1 -1
- data/lib/activity_notification/orm/mongoid.rb +22 -0
- data/lib/activity_notification/orm/mongoid/notification.rb +17 -1
- data/lib/activity_notification/orm/mongoid/subscription.rb +1 -1
- data/lib/activity_notification/rails/routes.rb +132 -48
- data/lib/activity_notification/renderable.rb +13 -2
- data/lib/activity_notification/roles/acts_as_notifiable.rb +38 -20
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/activity_notification/controllers_generator.rb +2 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- data/lib/generators/templates/controllers/notifications_api_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_controller.rb +1 -37
- data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +1 -45
- data/lib/generators/templates/controllers/subscriptions_api_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_api_with_devise_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_controller.rb +14 -37
- data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +14 -45
- data/lib/generators/templates/models/README +8 -4
- data/lib/generators/templates/models/notification.rb +1 -1
- data/lib/generators/templates/models/subscription.rb +1 -1
- data/package.json +8 -0
- data/spec/channels/notification_api_channel_shared_examples.rb +59 -0
- data/spec/channels/notification_api_channel_spec.rb +51 -0
- data/spec/channels/notification_api_with_devise_channel_spec.rb +78 -0
- data/spec/concerns/apis/notification_api_spec.rb +37 -2
- data/spec/concerns/models/notifiable_spec.rb +64 -0
- data/spec/concerns/models/subscriber_spec.rb +13 -16
- data/spec/concerns/models/target_spec.rb +32 -0
- data/spec/concerns/renderable_spec.rb +2 -2
- data/spec/controllers/controller_spec_utility.rb +136 -0
- data/spec/controllers/notifications_api_controller_shared_examples.rb +506 -0
- data/spec/controllers/notifications_api_controller_spec.rb +19 -0
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/notifications_controller_shared_examples.rb +54 -79
- data/spec/controllers/notifications_controller_spec.rb +1 -2
- data/spec/controllers/notifications_with_devise_controller_spec.rb +3 -12
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +750 -0
- data/spec/controllers/subscriptions_api_controller_spec.rb +19 -0
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/subscriptions_controller_shared_examples.rb +94 -121
- data/spec/controllers/subscriptions_controller_spec.rb +1 -2
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +3 -12
- data/spec/helpers/view_helpers_spec.rb +4 -11
- data/spec/mailers/mailer_spec.rb +41 -0
- data/spec/models/notification_spec.rb +17 -0
- data/spec/models/subscription_spec.rb +0 -13
- data/spec/optional_targets/action_cable_api_channel_spec.rb +37 -0
- data/spec/optional_targets/action_cable_channel_spec.rb +44 -0
- data/spec/optional_targets/amazon_sns_spec.rb +0 -2
- data/spec/optional_targets/slack_spec.rb +0 -2
- data/spec/rails_app/Rakefile +9 -0
- data/spec/rails_app/app/assets/config/manifest.js +3 -0
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/controllers/admins_controller.rb +21 -0
- data/spec/rails_app/app/controllers/application_controller.rb +1 -1
- data/spec/rails_app/app/controllers/articles_controller.rb +6 -3
- data/spec/rails_app/app/controllers/spa_controller.rb +7 -0
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -65
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -73
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -77
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -85
- data/spec/rails_app/app/controllers/users_controller.rb +21 -0
- data/spec/rails_app/app/javascript/App.vue +104 -0
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +83 -0
- data/spec/rails_app/app/javascript/components/Top.vue +99 -0
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +200 -0
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +133 -0
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +122 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +279 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +112 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +141 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +226 -0
- data/spec/rails_app/app/javascript/config/development.js +5 -0
- data/spec/rails_app/app/javascript/config/environment.js +7 -0
- data/spec/rails_app/app/javascript/config/production.js +5 -0
- data/spec/rails_app/app/javascript/config/test.js +5 -0
- data/spec/rails_app/app/javascript/packs/application.js +18 -0
- data/spec/rails_app/app/javascript/packs/spa.js +11 -0
- data/spec/rails_app/app/javascript/store/auth.js +37 -0
- data/spec/rails_app/app/models/admin.rb +16 -15
- data/spec/rails_app/app/models/article.rb +26 -21
- data/spec/rails_app/app/models/comment.rb +24 -71
- data/spec/rails_app/app/models/user.rb +43 -20
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +146 -0
- data/spec/rails_app/app/views/articles/index.html.erb +51 -7
- data/spec/rails_app/app/views/articles/show.html.erb +1 -1
- data/spec/rails_app/app/views/layouts/_header.html.erb +8 -10
- data/spec/rails_app/app/views/spa/index.html.erb +2 -0
- data/spec/rails_app/babel.config.js +72 -0
- data/spec/rails_app/bin/webpack +18 -0
- data/spec/rails_app/bin/webpack-dev-server +18 -0
- data/spec/rails_app/config/application.rb +15 -2
- data/spec/rails_app/config/environment.rb +2 -1
- data/spec/rails_app/config/environments/development.rb +5 -0
- data/spec/rails_app/config/environments/production.rb +3 -0
- data/spec/rails_app/config/environments/test.rb +5 -0
- data/spec/rails_app/config/initializers/activity_notification.rb +8 -0
- data/spec/rails_app/config/initializers/devise_token_auth.rb +55 -0
- data/spec/rails_app/config/initializers/mysql.rb +9 -0
- data/spec/rails_app/config/locales/activity_notification.en.yml +2 -2
- data/spec/rails_app/config/routes.rb +33 -1
- data/spec/rails_app/config/webpack/development.js +5 -0
- data/spec/rails_app/config/webpack/environment.js +7 -0
- data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
- data/spec/rails_app/config/webpack/production.js +5 -0
- data/spec/rails_app/config/webpack/test.js +5 -0
- data/spec/rails_app/config/webpacker.yml +97 -0
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +10 -0
- data/spec/rails_app/db/schema.rb +4 -1
- data/spec/rails_app/db/seeds.rb +1 -0
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +14 -0
- data/spec/rails_app/package.json +23 -0
- data/spec/rails_app/postcss.config.js +12 -0
- data/spec/roles/acts_as_group_spec.rb +0 -2
- data/spec/roles/acts_as_notifiable_spec.rb +1 -3
- data/spec/roles/acts_as_notifier_spec.rb +0 -2
- data/spec/roles/acts_as_target_spec.rb +0 -4
- data/spec/spec_helper.rb +7 -15
- data/spec/version_spec.rb +31 -0
- metadata +187 -13
@@ -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.
|
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.
|
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.
|
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
|
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,13 +34,13 @@
|
|
34
34
|
|
35
35
|
<div class='<%= "notification_#{notification.id}" %>'>
|
36
36
|
<% if notification.unopened? %>
|
37
|
-
<%= link_to open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :
|
38
|
-
<div class="
|
39
|
-
<div class="
|
40
|
-
<p class="
|
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, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :
|
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>
|
@@ -53,9 +53,9 @@
|
|
53
53
|
<%#= link_to "Move", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) %>
|
54
54
|
<%# if notification.unopened? %>
|
55
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 (
|
57
|
-
<%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options))), method: :
|
58
|
-
<%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :
|
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
60
|
<%#= link_to "Destroy", notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :delete %>
|
61
61
|
<%#= link_to "Destroy (Ajax)", notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(reload: false)), method: :delete, remote: true %>
|
@@ -63,13 +63,13 @@
|
|
63
63
|
</div>
|
64
64
|
|
65
65
|
<style>
|
66
|
-
/*
|
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 .
|
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 > .
|
81
|
+
.unopened_wrapper:hover > .unopened_description_wrapper{
|
82
82
|
display: block;
|
83
83
|
}
|
84
|
-
.unopened_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 .
|
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 .
|
101
|
+
.unopened_wrapper .unopened_description_wrapper .unopened_description:before {
|
102
102
|
border: solid transparent;
|
103
103
|
border-top-width: 0;
|
104
104
|
content: "";
|
data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb
CHANGED
@@ -23,13 +23,13 @@
|
|
23
23
|
|
24
24
|
<div class='<%= "notification_#{notification.id}" %>'>
|
25
25
|
<% if notification.unopened? %>
|
26
|
-
<%= link_to open_notification_path_for(notification, parameters.slice(:with_group_members, :routing_scope, :devise_default_routes).merge(reload: false)), method: :
|
27
|
-
<div class="
|
28
|
-
<div class="
|
29
|
-
<p class="
|
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, parameters.slice(:routing_scope, :devise_default_routes).merge(move: true)), method: :
|
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>
|
@@ -42,9 +42,9 @@
|
|
42
42
|
<%#= link_to "Move", move_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes)) %>
|
43
43
|
<%# if notification.unopened? %>
|
44
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 (
|
46
|
-
<%#= link_to "Open", open_notification_path_for(notification, parameters.slice(:routing_scope, :devise_default_routes).merge(index_options: @index_options)), method: :
|
47
|
-
<%#= link_to "Open (Ajax)", open_notification_path_for(notification, parameters.slice(with_group_members:, :routing_scope, :devise_default_routes).merge(reload: false)), method: :
|
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
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
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 %>
|
@@ -52,13 +52,13 @@
|
|
52
52
|
</div>
|
53
53
|
|
54
54
|
<style>
|
55
|
-
/*
|
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 .
|
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 > .
|
70
|
+
.unopened_wrapper:hover > .unopened_description_wrapper{
|
71
71
|
display: block;
|
72
72
|
}
|
73
|
-
.unopened_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 .
|
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 .
|
90
|
+
.unopened_wrapper .unopened_description_wrapper .unopened_description:before {
|
91
91
|
border: solid transparent;
|
92
92
|
border-top-width: 0;
|
93
93
|
content: "";
|
@@ -69,12 +69,12 @@
|
|
69
69
|
}
|
70
70
|
// Push notificaion using Web Notification API by Push.js
|
71
71
|
Push.create('ActivityNotification', {
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
72
|
+
body: notification.text,
|
73
|
+
timeout: 5000,
|
74
|
+
onClick: function () {
|
75
|
+
location.href = notification.notifiable_path;
|
76
|
+
this.close();
|
77
|
+
}
|
78
78
|
});
|
79
79
|
}
|
80
80
|
}
|
data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb
ADDED
@@ -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>
|
@@ -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" %>
|
@@ -2,7 +2,7 @@
|
|
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">
|
@@ -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_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, option_params.merge(filtered_by_key: key)) %>
|
101
|
-
<br/><br/>
|
102
|
-
<%# end %>
|
103
|
-
<%# else %>
|
104
|
-
No notification keys are available.
|
105
|
-
<%# end %>
|
106
|
-
<br/><br/>
|
107
|
-
-->
|
108
|
-
|
@@ -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: :
|
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: :
|
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: :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: :
|
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: :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_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", false)', method: :
|
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_path_for(subscription, option_params), onclick: '$(this).find("input").prop("checked", true)', method: :
|
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_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", false)', method: :
|
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_path_for(subscription, option_params.merge(optional_target_name: optional_target_name)), onclick: '$(this).find("input").prop("checked", true)', method: :
|
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>
|