rails_notice 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +165 -0
- data/README.md +76 -0
- data/Rakefile +37 -0
- data/app/assets/config/rails_notice_manifest.js +3 -0
- data/app/assets/javascripts/controllers/notifications/index.js +0 -0
- data/app/assets/javascripts/controllers/rails_notice_admin/notification_settings/index.js +17 -0
- data/app/assets/javascripts/controllers/rails_notice_admin/notifications/index.js +15 -0
- data/app/assets/javascripts/controllers/rails_notice_admin/notify_settings/edit.js +3 -0
- data/app/assets/javascripts/controllers/rails_notice_admin/notify_settings/index.js +17 -0
- data/app/assets/javascripts/controllers/rails_notice_admin/notify_settings/new.js +18 -0
- data/app/assets/javascripts/rails_notice/cable.js +19 -0
- data/app/assets/javascripts/rails_notice/channels/notices.js +39 -0
- data/app/assets/javascripts/rails_notice/messenger-theme-future.js +33 -0
- data/app/assets/javascripts/rails_notice/messenger.min.js +2 -0
- data/app/assets/stylesheets/the_notify/cable.css +9 -0
- data/app/assets/stylesheets/the_notify/messenger-theme-air.css +357 -0
- data/app/assets/stylesheets/the_notify/messenger.css +105 -0
- data/app/channels/notices_channel.rb +7 -0
- data/app/channels/the_notify_connection.rb +30 -0
- data/app/controllers/concerns/rails_notice_controller.rb +18 -0
- data/app/controllers/rails_notice_admin/base_controller.rb +6 -0
- data/app/controllers/rails_notice_admin/notification_settings_controller.rb +55 -0
- data/app/controllers/rails_notice_admin/notifications_controller.rb +71 -0
- data/app/controllers/rails_notice_my/base_controller.rb +5 -0
- data/app/controllers/rails_notice_my/notification_settings_controller.rb +28 -0
- data/app/controllers/rails_notice_my/notifications_controller.rb +78 -0
- data/app/controllers/receivers_controller.rb +12 -0
- data/app/jobs/notification_job.rb +17 -0
- data/app/mailers/rails_notice_mailer.rb +21 -0
- data/app/models/annunciation.rb +4 -0
- data/app/models/concerns/i18n_helper.rb +14 -0
- data/app/models/concerns/the_notifiable.rb +33 -0
- data/app/models/concerns/the_publishable.rb +9 -0
- data/app/models/concerns/the_receivable.rb +17 -0
- data/app/models/notification.rb +156 -0
- data/app/models/notification_setting.rb +8 -0
- data/app/views/rails_notice/_link.html.erb +6 -0
- data/app/views/rails_notice_admin/base/_nav.html.erb +16 -0
- data/app/views/rails_notice_admin/notification_settings/_form.html.erb +7 -0
- data/app/views/rails_notice_admin/notification_settings/_search_form.html.erb +11 -0
- data/app/views/rails_notice_admin/notification_settings/edit.html.erb +14 -0
- data/app/views/rails_notice_admin/notification_settings/index.html.erb +52 -0
- data/app/views/rails_notice_admin/notification_settings/new.html.erb +13 -0
- data/app/views/rails_notice_admin/notification_settings/show.html.erb +0 -0
- data/app/views/rails_notice_admin/notifications/_form.html.erb +6 -0
- data/app/views/rails_notice_admin/notifications/_menu.html.erb +6 -0
- data/app/views/rails_notice_admin/notifications/_search_form.html.erb +11 -0
- data/app/views/rails_notice_admin/notifications/edit.html.erb +14 -0
- data/app/views/rails_notice_admin/notifications/index.html.erb +44 -0
- data/app/views/rails_notice_admin/notifications/new.html.erb +15 -0
- data/app/views/rails_notice_mailer/notify.html.erb +35 -0
- data/app/views/rails_notice_my/base/_nav_my.html.erb +4 -0
- data/app/views/rails_notice_my/notification_settings/_form.html.erb +5 -0
- data/app/views/rails_notice_my/notification_settings/show.html.erb +5 -0
- data/app/views/rails_notice_my/notifications/_navbar.html.erb +13 -0
- data/app/views/rails_notice_my/notifications/_notifications.html.erb +17 -0
- data/app/views/rails_notice_my/notifications/edit.html.erb +2 -0
- data/app/views/rails_notice_my/notifications/index.html.erb +28 -0
- data/app/views/rails_notice_my/notifications/index.js.erb +13 -0
- data/app/views/rails_notice_my/notifications/new.html.erb +1 -0
- data/app/views/rails_notice_my/notifications/read.js.erb +2 -0
- data/app/views/rails_notice_my/notifications/read_all.js.erb +2 -0
- data/app/views/rails_notice_my/notifications/show.html.erb +7 -0
- data/config/locales/en.yml +7 -0
- data/config/locales/zh.yml +7 -0
- data/config/routes.rb +29 -0
- data/db/migrate/20170110025557_create_notification.rb +21 -0
- data/db/migrate/20170209025946_create_notification_settings.rb +23 -0
- data/lib/rails_notice.rb +13 -0
- data/lib/rails_notice/active_record.rb +18 -0
- data/lib/rails_notice/config.rb +13 -0
- data/lib/rails_notice/engine.rb +9 -0
- data/lib/rails_notice/version.rb +3 -0
- data/lib/tasks/the_notify_tasks.rake +4 -0
- metadata +132 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6035f65eff452bf429c0155519166cfc5cb1b2c112ca3879a469bad8fca32419
|
4
|
+
data.tar.gz: cf0d0719aa33c2ec36b2cbeae67787d3b6f0b25ea4fd65e7b5695b04a8434e02
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5285845671c1fbacc6c78b7a581dc35bdba0bd6eaf36ac2e54c3cd04d0935f0fb44484b72053d6c2e86f8648fd7e51468cc2283a37247e94188059bc22c3f52b
|
7
|
+
data.tar.gz: 1fde483a10c0530bc44c38251b0650be3c7e3e1824db0e60d938b42802268e85cdeddb1b67887e9b031a469732b1d1b2c4fa3f3beb3fac203c48ac74e610fe6a
|
data/LICENSE
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
GNU LESSER GENERAL PUBLIC LICENSE
|
2
|
+
Version 3, 29 June 2007
|
3
|
+
|
4
|
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5
|
+
Everyone is permitted to copy and distribute verbatim copies
|
6
|
+
of this license document, but changing it is not allowed.
|
7
|
+
|
8
|
+
|
9
|
+
This version of the GNU Lesser General Public License incorporates
|
10
|
+
the terms and conditions of version 3 of the GNU General Public
|
11
|
+
License, supplemented by the additional permissions listed below.
|
12
|
+
|
13
|
+
0. Additional Definitions.
|
14
|
+
|
15
|
+
As used herein, "this License" refers to version 3 of the GNU Lesser
|
16
|
+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
17
|
+
General Public License.
|
18
|
+
|
19
|
+
"The Library" refers to a covered work governed by this License,
|
20
|
+
other than an Application or a Combined Work as defined below.
|
21
|
+
|
22
|
+
An "Application" is any work that makes use of an interface provided
|
23
|
+
by the Library, but which is not otherwise based on the Library.
|
24
|
+
Defining a subclass of a class defined by the Library is deemed a mode
|
25
|
+
of using an interface provided by the Library.
|
26
|
+
|
27
|
+
A "Combined Work" is a work produced by combining or linking an
|
28
|
+
Application with the Library. The particular version of the Library
|
29
|
+
with which the Combined Work was made is also called the "Linked
|
30
|
+
Version".
|
31
|
+
|
32
|
+
The "Minimal Corresponding Source" for a Combined Work means the
|
33
|
+
Corresponding Source for the Combined Work, excluding any source code
|
34
|
+
for portions of the Combined Work that, considered in isolation, are
|
35
|
+
based on the Application, and not on the Linked Version.
|
36
|
+
|
37
|
+
The "Corresponding Application Code" for a Combined Work means the
|
38
|
+
object code and/or source code for the Application, including any data
|
39
|
+
and utility programs needed for reproducing the Combined Work from the
|
40
|
+
Application, but excluding the System Libraries of the Combined Work.
|
41
|
+
|
42
|
+
1. Exception to Section 3 of the GNU GPL.
|
43
|
+
|
44
|
+
You may convey a covered work under sections 3 and 4 of this License
|
45
|
+
without being bound by section 3 of the GNU GPL.
|
46
|
+
|
47
|
+
2. Conveying Modified Versions.
|
48
|
+
|
49
|
+
If you modify a copy of the Library, and, in your modifications, a
|
50
|
+
facility refers to a function or data to be supplied by an Application
|
51
|
+
that uses the facility (other than as an argument passed when the
|
52
|
+
facility is invoked), then you may convey a copy of the modified
|
53
|
+
version:
|
54
|
+
|
55
|
+
a) under this License, provided that you make a good faith effort to
|
56
|
+
ensure that, in the event an Application does not supply the
|
57
|
+
function or data, the facility still operates, and performs
|
58
|
+
whatever part of its purpose remains meaningful, or
|
59
|
+
|
60
|
+
b) under the GNU GPL, with none of the additional permissions of
|
61
|
+
this License applicable to that copy.
|
62
|
+
|
63
|
+
3. Object Code Incorporating Material from Library Header Files.
|
64
|
+
|
65
|
+
The object code form of an Application may incorporate material from
|
66
|
+
a header file that is part of the Library. You may convey such object
|
67
|
+
code under terms of your choice, provided that, if the incorporated
|
68
|
+
material is not limited to numerical parameters, data structure
|
69
|
+
layouts and accessors, or small macros, inline functions and templates
|
70
|
+
(ten or fewer lines in length), you do both of the following:
|
71
|
+
|
72
|
+
a) Give prominent notice with each copy of the object code that the
|
73
|
+
Library is used in it and that the Library and its use are
|
74
|
+
covered by this License.
|
75
|
+
|
76
|
+
b) Accompany the object code with a copy of the GNU GPL and this license
|
77
|
+
document.
|
78
|
+
|
79
|
+
4. Combined Works.
|
80
|
+
|
81
|
+
You may convey a Combined Work under terms of your choice that,
|
82
|
+
taken together, effectively do not restrict modification of the
|
83
|
+
portions of the Library contained in the Combined Work and reverse
|
84
|
+
engineering for debugging such modifications, if you also do each of
|
85
|
+
the following:
|
86
|
+
|
87
|
+
a) Give prominent notice with each copy of the Combined Work that
|
88
|
+
the Library is used in it and that the Library and its use are
|
89
|
+
covered by this License.
|
90
|
+
|
91
|
+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
92
|
+
document.
|
93
|
+
|
94
|
+
c) For a Combined Work that displays copyright notices during
|
95
|
+
execution, include the copyright notice for the Library among
|
96
|
+
these notices, as well as a reference directing the user to the
|
97
|
+
copies of the GNU GPL and this license document.
|
98
|
+
|
99
|
+
d) Do one of the following:
|
100
|
+
|
101
|
+
0) Convey the Minimal Corresponding Source under the terms of this
|
102
|
+
License, and the Corresponding Application Code in a form
|
103
|
+
suitable for, and under terms that permit, the user to
|
104
|
+
recombine or relink the Application with a modified version of
|
105
|
+
the Linked Version to produce a modified Combined Work, in the
|
106
|
+
manner specified by section 6 of the GNU GPL for conveying
|
107
|
+
Corresponding Source.
|
108
|
+
|
109
|
+
1) Use a suitable shared library mechanism for linking with the
|
110
|
+
Library. A suitable mechanism is one that (a) uses at run time
|
111
|
+
a copy of the Library already present on the user's computer
|
112
|
+
system, and (b) will operate properly with a modified version
|
113
|
+
of the Library that is interface-compatible with the Linked
|
114
|
+
Version.
|
115
|
+
|
116
|
+
e) Provide Installation Information, but only if you would otherwise
|
117
|
+
be required to provide such information under section 6 of the
|
118
|
+
GNU GPL, and only to the extent that such information is
|
119
|
+
necessary to install and execute a modified version of the
|
120
|
+
Combined Work produced by recombining or relinking the
|
121
|
+
Application with a modified version of the Linked Version. (If
|
122
|
+
you use option 4d0, the Installation Information must accompany
|
123
|
+
the Minimal Corresponding Source and Corresponding Application
|
124
|
+
Code. If you use option 4d1, you must provide the Installation
|
125
|
+
Information in the manner specified by section 6 of the GNU GPL
|
126
|
+
for conveying Corresponding Source.)
|
127
|
+
|
128
|
+
5. Combined Libraries.
|
129
|
+
|
130
|
+
You may place library facilities that are a work based on the
|
131
|
+
Library side by side in a single library together with other library
|
132
|
+
facilities that are not Applications and are not covered by this
|
133
|
+
License, and convey such a combined library under terms of your
|
134
|
+
choice, if you do both of the following:
|
135
|
+
|
136
|
+
a) Accompany the combined library with a copy of the same work based
|
137
|
+
on the Library, uncombined with any other library facilities,
|
138
|
+
conveyed under the terms of this License.
|
139
|
+
|
140
|
+
b) Give prominent notice with the combined library that part of it
|
141
|
+
is a work based on the Library, and explaining where to find the
|
142
|
+
accompanying uncombined form of the same work.
|
143
|
+
|
144
|
+
6. Revised Versions of the GNU Lesser General Public License.
|
145
|
+
|
146
|
+
The Free Software Foundation may publish revised and/or new versions
|
147
|
+
of the GNU Lesser General Public License from time to time. Such new
|
148
|
+
versions will be similar in spirit to the present version, but may
|
149
|
+
differ in detail to address new problems or concerns.
|
150
|
+
|
151
|
+
Each version is given a distinguishing version number. If the
|
152
|
+
Library as you received it specifies that a certain numbered version
|
153
|
+
of the GNU Lesser General Public License "or any later version"
|
154
|
+
applies to it, you have the option of following the terms and
|
155
|
+
conditions either of that published version or of any later version
|
156
|
+
published by the Free Software Foundation. If the Library as you
|
157
|
+
received it does not specify a version number of the GNU Lesser
|
158
|
+
General Public License, you may choose any version of the GNU Lesser
|
159
|
+
General Public License ever published by the Free Software Foundation.
|
160
|
+
|
161
|
+
If the Library as you received it specifies that a proxy can decide
|
162
|
+
whether future versions of the GNU Lesser General Public License shall
|
163
|
+
apply, that proxy's public statement of acceptance of any version is
|
164
|
+
permanent authorization for you to choose that version for the
|
165
|
+
Library.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# RailsNotice
|
2
|
+
Short description and motivation.
|
3
|
+
|
4
|
+
## Usage
|
5
|
+
### Set the cable.yml
|
6
|
+
Should set adapter as redis in development
|
7
|
+
```yaml
|
8
|
+
development:
|
9
|
+
adapter: redis
|
10
|
+
url: redis://localhost:6379/1
|
11
|
+
```
|
12
|
+
|
13
|
+
### Import the js and css in the page which you want show notifications
|
14
|
+
```erb
|
15
|
+
<%= javascript_include_tag 'rails_notice/cable', 'data-turbolinks-eval': 'false' %>
|
16
|
+
<%= stylesheet_link_tag 'rails_notice/cable' %>
|
17
|
+
```
|
18
|
+
|
19
|
+
### View: add link
|
20
|
+
```erb
|
21
|
+
<%= link_to notifications_path, class: 'item', remote: true, id: 'notify_show' do %>
|
22
|
+
<i class="bell icon"></i>
|
23
|
+
<span id="notice_count" style="padding-left: 5px"><%= current_user.unread_count %></span>
|
24
|
+
<% end %>
|
25
|
+
```
|
26
|
+
|
27
|
+
### Model Setting
|
28
|
+
```ruby
|
29
|
+
# which model can receive notifications
|
30
|
+
class User < ApplicationRecord
|
31
|
+
include TheReceivable
|
32
|
+
end
|
33
|
+
|
34
|
+
```
|
35
|
+
|
36
|
+
### Controller Setting
|
37
|
+
```ruby
|
38
|
+
class ApplicationController < ActionController::Base
|
39
|
+
include RailsNoticeController
|
40
|
+
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
### Channel Setting
|
45
|
+
```ruby
|
46
|
+
module ApplicationCable
|
47
|
+
class Connection < ActionCable::Connection::Base
|
48
|
+
prepend RailsNoticeConnection
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
52
|
+
```
|
53
|
+
|
54
|
+
|
55
|
+
## Installation
|
56
|
+
Add this line to your application's Gemfile:
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
gem 'rails_notice'
|
60
|
+
```
|
61
|
+
|
62
|
+
And then execute:
|
63
|
+
```bash
|
64
|
+
$ bundle
|
65
|
+
```
|
66
|
+
|
67
|
+
Or install it yourself as:
|
68
|
+
```bash
|
69
|
+
$ gem install rails_notice
|
70
|
+
```
|
71
|
+
|
72
|
+
## Contributing
|
73
|
+
Contribution directions go here.
|
74
|
+
|
75
|
+
## License
|
76
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'RailsNotice'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'lib'
|
31
|
+
t.libs << 'test'
|
32
|
+
t.pattern = 'test/**/*_test.rb'
|
33
|
+
t.verbose = false
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
task default: :test
|
File without changes
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$('#q_receiver_type').dropdown();
|
2
|
+
$('#q_receiver_id').dropdown({
|
3
|
+
apiSettings: {
|
4
|
+
url: '/receivers/search?q={query}&receiver_type={receiver_type}',
|
5
|
+
beforeSend: function(settings) {
|
6
|
+
settings.urlData.receiver_type = document.querySelector('select[name="q[receiver_type]"]').value;
|
7
|
+
return settings;
|
8
|
+
}
|
9
|
+
},
|
10
|
+
fields: {
|
11
|
+
name: 'name',
|
12
|
+
value: 'id'
|
13
|
+
},
|
14
|
+
minCharacters: 2
|
15
|
+
});
|
16
|
+
|
17
|
+
$('.ui.toggle.checkbox').checkbox();
|
@@ -0,0 +1,15 @@
|
|
1
|
+
$('#q_receiver_type').dropdown();
|
2
|
+
$('#q_receiver_id').dropdown({
|
3
|
+
apiSettings: {
|
4
|
+
url: '/receivers/search?q={query}&receiver_type={receiver_type}',
|
5
|
+
beforeSend: function(settings) {
|
6
|
+
settings.urlData.receiver_type = document.querySelector('select[name="q[receiver_type]"]').value;
|
7
|
+
return settings;
|
8
|
+
}
|
9
|
+
},
|
10
|
+
fields: {
|
11
|
+
name: 'name',
|
12
|
+
value: 'id'
|
13
|
+
},
|
14
|
+
minCharacters: 2
|
15
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$('#q_receiver_type').dropdown();
|
2
|
+
$('#q_receiver_id').dropdown({
|
3
|
+
apiSettings: {
|
4
|
+
url: '/receivers/search?q={query}&receiver_type={receiver_type}',
|
5
|
+
beforeSend: function(settings) {
|
6
|
+
settings.urlData.receiver_type = document.querySelector('select[name="q[receiver_type]"]').value;
|
7
|
+
return settings;
|
8
|
+
}
|
9
|
+
},
|
10
|
+
fields: {
|
11
|
+
name: 'name',
|
12
|
+
value: 'id'
|
13
|
+
},
|
14
|
+
minCharacters: 2
|
15
|
+
});
|
16
|
+
|
17
|
+
$('.ui.toggle.checkbox').checkbox();
|
@@ -0,0 +1,18 @@
|
|
1
|
+
//= require rails_com/fetch_xhr_script
|
2
|
+
$('#notify_setting_notifiable_type').dropdown({
|
3
|
+
placeholder: false,
|
4
|
+
onChange: function(value, text, $selectedItem) {
|
5
|
+
var search_path = '/admin/notify_settings/columns';
|
6
|
+
var search_url = new URL(window.location.origin + search_path);
|
7
|
+
search_url.searchParams.set('notifiable_type', value);
|
8
|
+
|
9
|
+
var params = {
|
10
|
+
credentials: 'same-origin',
|
11
|
+
headers: {
|
12
|
+
'Accept': 'application/javascript',
|
13
|
+
'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
|
14
|
+
}
|
15
|
+
};
|
16
|
+
fetch_xhr_script(search_url, params);
|
17
|
+
}
|
18
|
+
});
|
@@ -0,0 +1,19 @@
|
|
1
|
+
//= require action_cable
|
2
|
+
//= require ./messenger.min
|
3
|
+
//= require ./messenger-theme-future
|
4
|
+
//= require rails_com/fetch_xhr_script
|
5
|
+
//= require_self
|
6
|
+
//= require_tree ./channels
|
7
|
+
|
8
|
+
(function() {
|
9
|
+
this.App || (this.App = {});
|
10
|
+
|
11
|
+
App.cable = ActionCable.createConsumer('/cable');
|
12
|
+
|
13
|
+
}).call(this);
|
14
|
+
|
15
|
+
Messenger.options = {
|
16
|
+
extraClasses: 'messenger-fixed messenger-on-bottom messenger-on-right',
|
17
|
+
theme: 'air',
|
18
|
+
parentLocations: ['footer']
|
19
|
+
};
|
@@ -0,0 +1,39 @@
|
|
1
|
+
App.cable.subscriptions.create('NoticesChannel', {
|
2
|
+
collection: function() {
|
3
|
+
return $("[data-channel='notices']");
|
4
|
+
},
|
5
|
+
received: function(data) {
|
6
|
+
this.collection().css('color', '#ff7f24');
|
7
|
+
this.collection().html(data.body);
|
8
|
+
|
9
|
+
var msg = Messenger().post({
|
10
|
+
message: data.body,
|
11
|
+
type: 'info',
|
12
|
+
showCloseButton: true,
|
13
|
+
hideAfter: data.showtime,
|
14
|
+
actions: {
|
15
|
+
confirm: {
|
16
|
+
label: 'Confirm',
|
17
|
+
action: function(e){
|
18
|
+
var url = '/notifications/' + data.id + '/read';
|
19
|
+
var params = {
|
20
|
+
credentials: 'same-origin',
|
21
|
+
headers: {
|
22
|
+
'Accept': 'application/javascript',
|
23
|
+
'X-CSRF-Token': document.head.querySelector("[name=csrf-token]").content
|
24
|
+
}
|
25
|
+
};
|
26
|
+
fetch_xhr_script(url, params);
|
27
|
+
window.location.href = data.link;
|
28
|
+
}
|
29
|
+
}
|
30
|
+
}
|
31
|
+
});
|
32
|
+
|
33
|
+
$('#notify_show').css('color', '#ff7f24');
|
34
|
+
$('#notice_count').html(data.count);
|
35
|
+
},
|
36
|
+
connected: function() {
|
37
|
+
console.log('Notice channel connected success');
|
38
|
+
}
|
39
|
+
});
|
@@ -0,0 +1,33 @@
|
|
1
|
+
(function() {
|
2
|
+
var $, FutureMessage, spinner_template,
|
3
|
+
__hasProp = {}.hasOwnProperty,
|
4
|
+
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
5
|
+
|
6
|
+
$ = jQuery;
|
7
|
+
|
8
|
+
spinner_template = '<div class="messenger-spinner">\n <span class="messenger-spinner-side messenger-spinner-side-left">\n <span class="messenger-spinner-fill"></span>\n </span>\n <span class="messenger-spinner-side messenger-spinner-side-right">\n <span class="messenger-spinner-fill"></span>\n </span>\n</div>';
|
9
|
+
|
10
|
+
FutureMessage = (function(_super) {
|
11
|
+
|
12
|
+
__extends(FutureMessage, _super);
|
13
|
+
|
14
|
+
function FutureMessage() {
|
15
|
+
return FutureMessage.__super__.constructor.apply(this, arguments);
|
16
|
+
}
|
17
|
+
|
18
|
+
FutureMessage.prototype.template = function(opts) {
|
19
|
+
var $message;
|
20
|
+
$message = FutureMessage.__super__.template.apply(this, arguments);
|
21
|
+
$message.append($(spinner_template));
|
22
|
+
return $message;
|
23
|
+
};
|
24
|
+
|
25
|
+
return FutureMessage;
|
26
|
+
|
27
|
+
})(window.Messenger.Message);
|
28
|
+
|
29
|
+
window.Messenger.themes.future = {
|
30
|
+
Message: FutureMessage
|
31
|
+
};
|
32
|
+
|
33
|
+
}).call(this);
|