message_train 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +20 -0
- data/.ruby-gemset +1 -1
- data/.scss-lint.yml +7 -0
- data/.simplecov +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +6 -2
- data/LICENSE.txt +2 -2
- data/README.rdoc +5 -5
- data/Rakefile +22 -21
- data/VERSION +1 -1
- data/app/assets/javascripts/message_train.js +1 -1
- data/app/assets/stylesheets/message_train.scss +29 -19
- data/app/controllers/concerns/message_train_support.rb +41 -37
- data/app/controllers/message_train/application_controller.rb +1 -0
- data/app/controllers/message_train/boxes_controller.rb +5 -4
- data/app/controllers/message_train/conversations_controller.rb +8 -7
- data/app/controllers/message_train/messages_controller.rb +25 -22
- data/app/controllers/message_train/participants_controller.rb +27 -23
- data/app/controllers/message_train/unsubscribes_controller.rb +37 -23
- data/app/helpers/message_train/application_helper.rb +6 -8
- data/app/helpers/message_train/attachments_helper.rb +12 -4
- data/app/helpers/message_train/boxes_helper.rb +38 -11
- data/app/helpers/message_train/collectives_helper.rb +38 -12
- data/app/helpers/message_train/conversations_helper.rb +43 -35
- data/app/helpers/message_train/messages_helper.rb +32 -25
- data/app/mailers/message_train/application_mailer.rb +7 -4
- data/app/mailers/message_train/previews/receipt_mailer_preview.rb +2 -3
- data/app/mailers/message_train/receipt_mailer.rb +14 -4
- data/app/models/message_train/attachment.rb +41 -25
- data/app/models/message_train/box.rb +159 -122
- data/app/models/message_train/conversation.rb +84 -41
- data/app/models/message_train/ignore.rb +8 -2
- data/app/models/message_train/message.rb +72 -42
- data/app/models/message_train/receipt.rb +30 -17
- data/app/models/message_train/unsubscribe.rb +1 -0
- data/app/views/application/404.html.haml +1 -1
- data/app/views/layouts/mailer.html.haml +2 -2
- data/app/views/layouts/mailer.text.haml +1 -1
- data/app/views/message_train/application/_attachment_fields.html.haml +1 -1
- data/app/views/message_train/application/_widget.html.haml +1 -1
- data/app/views/message_train/application/results.json.jbuilder +1 -1
- data/app/views/message_train/boxes/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/boxes/_list_item.html.haml +1 -1
- data/app/views/message_train/boxes/show.html.haml +1 -1
- data/app/views/message_train/collectives/_dropdown_list.html.haml +1 -1
- data/app/views/message_train/collectives/_list_item.html.haml +1 -1
- data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_ignored_toggle.html.haml +2 -2
- data/app/views/message_train/conversations/_read_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/_trashed_toggle.html.haml +1 -1
- data/app/views/message_train/conversations/show.html.haml +2 -2
- data/app/views/message_train/conversations/show.json.jbuilder +5 -1
- data/app/views/message_train/messages/_form.html.haml +1 -1
- data/app/views/message_train/messages/_message.html.haml +6 -6
- data/app/views/message_train/messages/_toggle.html.haml +1 -1
- data/app/views/message_train/messages/show.json.jbuilder +5 -1
- data/app/views/message_train/participants/_participant.json.jbuilder +1 -1
- data/app/views/message_train/participants/index.json.jbuilder +1 -1
- data/app/views/message_train/participants/show.json.jbuilder +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.html.haml +1 -1
- data/app/views/message_train/receipt_mailer/notification_email.text.haml +1 -1
- data/app/views/message_train/unsubscribes/index.html.haml +1 -1
- data/config/environment.rb +1 -1
- data/config/initializers/date_time.rb +2 -2
- data/config/locales/en.yml +1 -1
- data/config/routes.rb +37 -15
- data/lib/generators/message_train/install/install_generator.rb +26 -11
- data/lib/generators/message_train/install/templates/initializer.rb +0 -2
- data/lib/generators/message_train/utils.rb +11 -4
- data/lib/message_train/configuration.rb +4 -5
- data/lib/message_train/engine.rb +1 -7
- data/lib/message_train/localization.rb +14 -18
- data/lib/message_train/mixin.rb +211 -150
- data/lib/message_train/version.rb +1 -0
- data/lib/message_train.rb +7 -6
- data/message_train.gemspec +24 -11
- data/spec/controllers/message_train/boxes_controller_spec.rb +63 -15
- data/spec/controllers/message_train/concerns_spec.rb +17 -13
- data/spec/controllers/message_train/conversations_controller_spec.rb +44 -12
- data/spec/controllers/message_train/messages_controller_spec.rb +87 -40
- data/spec/controllers/message_train/participants_controller_spec.rb +10 -4
- data/spec/controllers/message_train/unsubscribes_controller_spec.rb +43 -13
- data/spec/dummy/Rakefile +2 -1
- data/spec/dummy/app/assets/stylesheets/application.css.scss +7 -23
- data/spec/dummy/app/controllers/application_controller.rb +7 -7
- data/spec/dummy/app/models/group.rb +1 -1
- data/spec/dummy/app/models/role.rb +11 -7
- data/spec/dummy/app/models/user.rb +6 -5
- data/spec/dummy/app/views/layouts/_top_navigation.html.haml +1 -1
- data/spec/dummy/app/views/layouts/application.html.haml +1 -1
- data/spec/dummy/app/views/pages/index.html.haml +1 -1
- data/spec/dummy/config/application.rb +23 -17
- data/spec/dummy/config/environments/development.rb +5 -4
- data/spec/dummy/config/environments/production.rb +10 -6
- data/spec/dummy/config/environments/test.rb +4 -3
- data/spec/dummy/config/initializers/assets.rb +2 -1
- data/spec/dummy/config/initializers/backtrace_silencers.rb +4 -2
- data/spec/dummy/config/initializers/bootstrap_leather.rb +1 -1
- data/spec/dummy/config/initializers/devise.rb +63 -44
- data/spec/dummy/config/initializers/high_voltage.rb +1 -1
- data/spec/dummy/config/initializers/message_train.rb +5 -2
- data/spec/dummy/config/initializers/mime_types.rb +1 -1
- data/spec/dummy/config/initializers/paperclip.rb +5 -2
- data/spec/dummy/config/initializers/rolify.rb +3 -2
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -1
- data/spec/dummy/config/routes.rb +1 -3
- data/spec/dummy/config/settings.yml +1 -1
- data/spec/dummy/db/schema.rb +98 -98
- data/spec/dummy/db/seeds/conversations.seeds.rb +160 -160
- data/spec/dummy/db/seeds/development/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/groups.seeds.rb +11 -12
- data/spec/dummy/db/seeds/test/attachments.seeds.rb +13 -3
- data/spec/dummy/db/seeds/test/conversations.seeds.rb +6 -2
- data/spec/dummy/db/seeds/unsubscribes.seeds.rb +1 -1
- data/spec/dummy/db/seeds/users.seeds.rb +47 -42
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/attachment.rb +6 -2
- data/spec/factories/group.rb +1 -4
- data/spec/factories/message.rb +29 -23
- data/spec/factories/user.rb +6 -4
- data/spec/features/boxes_spec.rb +76 -24
- data/spec/features/conversations_spec.rb +19 -7
- data/spec/features/messages_spec.rb +24 -5
- data/spec/features/unsubscribes_spec.rb +36 -9
- data/spec/helpers/message_train/application_helper_spec.rb +1 -1
- data/spec/helpers/message_train/attachment_helper_spec.rb +27 -12
- data/spec/helpers/message_train/boxes_helper_spec.rb +1 -1
- data/spec/helpers/message_train/collectives_helper_spec.rb +25 -9
- data/spec/helpers/message_train/conversations_helper_spec.rb +239 -120
- data/spec/helpers/message_train/messages_helper_spec.rb +137 -81
- data/spec/message_train_spec.rb +3 -2
- data/spec/models/group_spec.rb +12 -9
- data/spec/models/message_train/attachment_spec.rb +33 -30
- data/spec/models/message_train/box_spec.rb +243 -60
- data/spec/models/message_train/conversation_spec.rb +16 -12
- data/spec/models/message_train/ignore_spec.rb +3 -1
- data/spec/models/message_train/message_spec.rb +22 -7
- data/spec/models/message_train/receipt_spec.rb +14 -4
- data/spec/models/role_spec.rb +10 -6
- data/spec/models/user_spec.rb +74 -22
- data/spec/rails_helper.rb +9 -4
- data/spec/spec_helper.rb +6 -54
- data/spec/support/controller_behaviors.rb +8 -5
- data/spec/support/controller_macros.rb +2 -2
- data/spec/support/factory_girl.rb +1 -1
- data/spec/support/feature_behaviors.rb +42 -13
- data/spec/support/loaded_site/attachments.rb +8 -0
- data/spec/support/loaded_site/conversations.rb +73 -0
- data/spec/support/{groups.rb → loaded_site/groups.rb} +1 -1
- data/spec/support/{loaded_site.rb → loaded_site/loaded_site.rb} +1 -1
- data/spec/support/{messages.rb → loaded_site/messages.rb} +13 -5
- data/spec/support/{roles.rb → loaded_site/roles.rb} +1 -1
- data/spec/support/{users.rb → loaded_site/users.rb} +1 -1
- data/spec/support/shared_connection.rb +8 -6
- data/spec/support/utilities.rb +10 -10
- metadata +67 -10
- data/spec/dummy/config/unused/temporary_i18n_debugging.rb +0 -12
- data/spec/support/attachments.rb +0 -4
- data/spec/support/conversations.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 279f6b86182280de36d875bc58b839cffefbb5bd
|
4
|
+
data.tar.gz: 24ad6a58c91cf45ddc80f645c642a12e480ef106
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20e06ae5d8f27c9760a5bc05ee3b46a59df822824ef8929b92eb93905006b5d6a670ce6a7c34c8cf9fdc94eecbad77f987b6ccdb4df75bc0f8b8b4a3d1fe35c0
|
7
|
+
data.tar.gz: 396db8fa546546fa128a7bdeea851bc377e8340bbffbe16f7f4d0db302ecef3d6cb72d10445ecefaf6b69119cd398dc447197b6b9e09f5022e33984c5dc3b2c2
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- message_train.gemspec
|
4
|
+
- db/migrate/*
|
5
|
+
- spec/dummy/db/schema.rb
|
6
|
+
- spec/dummy/db/migrate/*
|
7
|
+
Style/ClassVars:
|
8
|
+
Enabled: false
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/ClassLength:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/CyclomaticComplexity:
|
14
|
+
Enabled: false
|
15
|
+
Metrics/MethodLength:
|
16
|
+
Enabled: false
|
17
|
+
Metrics/ModuleLength:
|
18
|
+
Enabled: false
|
19
|
+
Metrics/PerceivedComplexity:
|
20
|
+
Enabled: false
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
message_train
|
1
|
+
message_train
|
data/.scss-lint.yml
ADDED
data/.simplecov
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source '
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
# Add dependencies required to use your gem here.
|
3
3
|
# Example:
|
4
4
|
# gem 'activesupport', '>= 2.3.5'
|
@@ -32,6 +32,10 @@ group :development do
|
|
32
32
|
gem 'sdoc', '~> 0.4.1'
|
33
33
|
gem 'bundler', '~> 1.0'
|
34
34
|
gem 'jeweler', '~> 2.0'
|
35
|
+
gem 'pre-commit', '~> 0.27'
|
36
|
+
gem 'rubocop', '~> 0.37'
|
37
|
+
gem 'coffeelint', '~> 1.14'
|
38
|
+
gem 'scss_lint', '~> 0.47.0', require: false
|
35
39
|
end
|
36
40
|
|
37
41
|
group :development, :test do
|
@@ -57,4 +61,4 @@ group :test do
|
|
57
61
|
gem 'coveralls', '~> 0.8', require: false
|
58
62
|
gem 'rspec-html-matchers', '~> 0.7'
|
59
63
|
gem 'selenium-webdriver', '~> 2'
|
60
|
-
end
|
64
|
+
end
|
data/LICENSE.txt
CHANGED
@@ -2,7 +2,7 @@ Copyright (c) 2015 Gem Vein
|
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining
|
4
4
|
a copy of this software and associated documentation files (the
|
5
|
-
|
5
|
+
'Software'), to deal in the Software without restriction, including
|
6
6
|
without limitation the rights to use, copy, modify, merge, publish,
|
7
7
|
distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
permit persons to whom the Software is furnished to do so, subject to
|
@@ -11,7 +11,7 @@ the following conditions:
|
|
11
11
|
The above copyright notice and this permission notice shall be
|
12
12
|
included in all copies or substantial portions of the Software.
|
13
13
|
|
14
|
-
THE SOFTWARE IS PROVIDED
|
14
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
17
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
data/README.rdoc
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
= MessageTrain
|
2
|
-
{<img src=
|
3
|
-
{<img src=
|
4
|
-
{<img src=
|
2
|
+
{<img src='https://travis-ci.org/gemvein/message_train.svg' alt='Build Status' />}[https://travis-ci.org/gemvein/message_train]
|
3
|
+
{<img src='https://coveralls.io/repos/gemvein/message_train/badge.svg?branch=master&service=github' alt='Coverage Status' />}[https://coveralls.io/github/gemvein/message_train?branch=master]
|
4
|
+
{<img src='https://badge.fury.io/rb/message_train.svg' alt='Gem Version' />}[http://badge.fury.io/rb/message_train]
|
5
5
|
|
6
6
|
|
7
7
|
MessageTrain is a Rails 4 Private Messaging Gem that uses bootstrap to send and display private messages from one user to another. It can also be configured to send messages to a user collective (such as a certain Role or Group of users).
|
8
8
|
|
9
|
-
Messages can be saved as drafts instead of sending. Message composition features type-ahead completion for recipients, wysiwyg html bodies, and an arbitrary number of attachments. Messages are grouped together into conversations, and allow valid senders to reply to a given message. Any given conversation can be ignored if it is no longer of interest to the user, at which point no further messages will be received in that conversation. The
|
9
|
+
Messages can be saved as drafts instead of sending. Message composition features type-ahead completion for recipients, wysiwyg html bodies, and an arbitrary number of attachments. Messages are grouped together into conversations, and allow valid senders to reply to a given message. Any given conversation can be ignored if it is no longer of interest to the user, at which point no further messages will be received in that conversation. The 'read' or 'unread' status of messages is tracked automatically, and can also be changed manually by the user.
|
10
10
|
|
11
11
|
Conversations are grouped into various boxes, depending on their status for that user: in, sent, all, drafts, trash, ignored. Any message can be trashed by the user, at which point the user has the option to permanently delete it.
|
12
12
|
|
@@ -39,7 +39,7 @@ To include Message Train variables and helpers in your controllers, add this con
|
|
39
39
|
|
40
40
|
Add to your application.css.scss:
|
41
41
|
|
42
|
-
@import
|
42
|
+
@import 'message_train';
|
43
43
|
|
44
44
|
And in your application.js:
|
45
45
|
|
data/Rakefile
CHANGED
@@ -1,26 +1,27 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
3
2
|
require 'rubygems'
|
4
3
|
require 'bundler'
|
5
4
|
begin
|
6
5
|
Bundler.setup(:default, :development)
|
7
6
|
rescue Bundler::BundlerError => e
|
8
7
|
$stderr.puts e.message
|
9
|
-
$stderr.puts
|
8
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
9
|
exit e.status_code
|
11
10
|
end
|
12
11
|
require 'rake'
|
13
12
|
|
14
13
|
require 'jeweler'
|
15
14
|
Jeweler::Tasks.new do |gem|
|
16
|
-
# gem is a Gem::Specification...
|
17
|
-
|
18
|
-
gem.
|
19
|
-
gem.
|
20
|
-
gem.
|
21
|
-
gem.
|
22
|
-
gem.
|
23
|
-
|
15
|
+
# gem is a Gem::Specification...
|
16
|
+
# see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = 'message_train'
|
18
|
+
gem.homepage = 'http://www.gemvein.com/museum/cases/message_train'
|
19
|
+
gem.license = 'MIT'
|
20
|
+
gem.summary = 'Rails 4 Engine providing messaging for any object'
|
21
|
+
gem.description = 'Rails 4 Engine providing private/public messaging for '\
|
22
|
+
'any object, such as Users or Groups'
|
23
|
+
gem.email = 'karen.e.lundgren@gmail.com'
|
24
|
+
gem.authors = ['Karen Lundgren']
|
24
25
|
# dependencies defined in Gemfile
|
25
26
|
end
|
26
27
|
Jeweler::RubygemsDotOrgTasks.new
|
@@ -31,17 +32,17 @@ RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
31
32
|
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
33
|
end
|
33
34
|
|
34
|
-
desc
|
35
|
+
desc 'Code coverage detail'
|
35
36
|
task :simplecov do
|
36
|
-
ENV['COVERAGE'] =
|
37
|
+
ENV['COVERAGE'] = 'true'
|
37
38
|
Rake::Task['spec'].execute
|
38
39
|
end
|
39
40
|
|
40
|
-
task :
|
41
|
+
task default: :spec
|
41
42
|
|
42
43
|
require 'rdoc/task'
|
43
44
|
Rake::RDocTask.new do |rdoc|
|
44
|
-
version = File.exist?('VERSION') ? File.read('VERSION') :
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
45
46
|
|
46
47
|
rdoc.rdoc_dir = 'rdoc'
|
47
48
|
rdoc.title = "message_train #{version}"
|
@@ -49,22 +50,22 @@ Rake::RDocTask.new do |rdoc|
|
|
49
50
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
51
|
end
|
51
52
|
|
52
|
-
APP_RAKEFILE = File.expand_path(
|
53
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
53
54
|
load 'rails/tasks/engine.rake'
|
54
55
|
|
55
|
-
|
56
56
|
# load 'rails/tasks/statistics.rake'
|
57
57
|
|
58
58
|
namespace :message_train do
|
59
|
-
desc
|
59
|
+
desc 'Clean out development system files'
|
60
60
|
task files: :environment do
|
61
61
|
FileUtils.rm_rf(Dir["#{Rails.root}/public/system/development/*/*"])
|
62
62
|
end
|
63
|
-
desc
|
63
|
+
desc 'Recreate database from seeds and clean out all system files'
|
64
64
|
task clean: :environment do
|
65
65
|
import 'spec/dummy/Rakefile'
|
66
|
-
Rake::Task[
|
66
|
+
Rake::Task['message_train:files'].invoke
|
67
67
|
dummy_app_path = MessageTrain::Engine.root.join('spec', 'dummy')
|
68
|
-
system "bundle exec rake -f #{dummy_app_path.join('Rakefile')} db:drop
|
68
|
+
system "bundle exec rake -f #{dummy_app_path.join('Rakefile')} db:drop "\
|
69
|
+
'db:create db:migrate db:seed db:test:prepare'
|
69
70
|
end
|
70
|
-
end
|
71
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
@@ -14,7 +14,9 @@ img {
|
|
14
14
|
}
|
15
15
|
|
16
16
|
.message-train-conversations {
|
17
|
-
a,
|
17
|
+
a,
|
18
|
+
a:link,
|
19
|
+
a:visited {
|
18
20
|
color: $text-color;
|
19
21
|
}
|
20
22
|
|
@@ -25,57 +27,65 @@ img {
|
|
25
27
|
input[type='checkbox'] {
|
26
28
|
margin-right: 1em;
|
27
29
|
}
|
30
|
+
|
28
31
|
.unread {
|
29
32
|
font-weight: bold;
|
30
33
|
}
|
31
34
|
|
32
35
|
.read {
|
33
|
-
background-color: rgba($list-group-disabled-bg,
|
36
|
+
background-color: rgba($list-group-disabled-bg, .75);
|
37
|
+
|
38
|
+
.flicker.flicker-out {
|
39
|
+
background-color: $list-group-disabled-bg;
|
40
|
+
transition: background-color 1s ease-out;
|
41
|
+
}
|
34
42
|
}
|
35
43
|
|
36
44
|
.draft {
|
37
45
|
font-style: italic;
|
38
46
|
}
|
39
47
|
|
40
|
-
.selected,
|
48
|
+
.selected,
|
49
|
+
.read.selected {
|
50
|
+
background-color: $state-warning-bg;
|
51
|
+
|
41
52
|
a {
|
42
53
|
color: $state-warning-text;
|
43
54
|
}
|
44
|
-
background-color: $state-warning-bg;
|
45
55
|
}
|
46
56
|
|
47
|
-
.flicker,
|
57
|
+
.flicker,
|
58
|
+
.read.flicker,
|
59
|
+
.selected.flicker {
|
48
60
|
background-color: $state-info-bg;
|
49
|
-
transition: background-color
|
61
|
+
transition: background-color .1s ease-in;
|
50
62
|
}
|
51
63
|
|
52
|
-
.flicker.flicker-out,
|
64
|
+
.flicker.flicker-out,
|
65
|
+
.unread.flicker.flicker-out {
|
53
66
|
background-color: $list-group-bg;
|
54
67
|
transition: background-color 1s ease-out;
|
55
68
|
}
|
56
|
-
|
57
|
-
.read.flicker.flicker-out {
|
58
|
-
background-color: $list-group-disabled-bg;
|
59
|
-
transition: background-color 1s ease-out;
|
60
|
-
}
|
61
69
|
}
|
62
70
|
|
63
71
|
.box-actions {
|
64
|
-
margin: 2em 0 1em
|
72
|
+
margin: 2em 0 1em;
|
73
|
+
|
65
74
|
.check-all button {
|
66
75
|
min-height: 2.5em;
|
67
76
|
}
|
68
77
|
}
|
69
78
|
|
70
79
|
div.conversation-actions {
|
71
|
-
margin: 1em 0
|
80
|
+
margin: 1em 0;
|
72
81
|
}
|
73
82
|
|
74
83
|
td.conversation-actions {
|
84
|
+
white-space: nowrap;
|
85
|
+
|
75
86
|
a {
|
76
87
|
visibility: hidden;
|
77
88
|
}
|
78
|
-
white-space: nowrap;
|
79
89
|
}
|
80
90
|
|
81
91
|
.date-column {
|
@@ -91,8 +101,8 @@ tr:hover .conversation-actions a {
|
|
91
101
|
}
|
92
102
|
|
93
103
|
.glyphicon.spinning {
|
94
|
-
animation: spin 1s infinite linear;
|
95
104
|
-webkit-animation: spin2 1s infinite linear;
|
105
|
+
animation: spin 1s infinite linear;
|
96
106
|
}
|
97
107
|
|
98
108
|
@keyframes spin {
|
@@ -118,9 +128,9 @@ tr:hover .conversation-actions a {
|
|
118
128
|
}
|
119
129
|
|
120
130
|
.btn-compose {
|
121
|
-
margin: 0 auto 10px
|
122
|
-
width: 100%;
|
131
|
+
margin: 0 auto 10px;
|
123
132
|
white-space: inherit;
|
133
|
+
width: 100%;
|
124
134
|
}
|
125
135
|
|
126
136
|
.tt-menu {
|
@@ -131,4 +141,4 @@ tr:hover .conversation-actions a {
|
|
131
141
|
|
132
142
|
.dropdown-menu {
|
133
143
|
width: 240px;
|
134
|
-
}
|
144
|
+
}
|
@@ -1,8 +1,7 @@
|
|
1
|
+
# MessageTrain support
|
1
2
|
module MessageTrainSupport
|
2
3
|
extend ActiveSupport::Concern
|
3
|
-
|
4
4
|
included do
|
5
|
-
|
6
5
|
# Last in first out
|
7
6
|
prepend_before_filter :load_collective_boxes,
|
8
7
|
:load_box,
|
@@ -23,14 +22,9 @@ module MessageTrainSupport
|
|
23
22
|
rescue_from ActiveRecord::RecordNotFound do
|
24
23
|
render '404', status: :not_found
|
25
24
|
end
|
26
|
-
|
27
25
|
end
|
28
26
|
|
29
|
-
protected
|
30
|
-
|
31
|
-
# def require_authentication
|
32
|
-
# redirect_to url_for(MessageTrain.configuration.user_sign_in_path), flash: { error: :you_must_sign_in_or_sign_up_to_continue.l }
|
33
|
-
# end
|
27
|
+
protected
|
34
28
|
|
35
29
|
def anonymous
|
36
30
|
@anonymous = true
|
@@ -42,9 +36,9 @@ protected
|
|
42
36
|
end
|
43
37
|
|
44
38
|
def load_box_user
|
45
|
-
|
46
|
-
|
47
|
-
|
39
|
+
@box_user = send(
|
40
|
+
MessageTrain.configuration.current_user_method
|
41
|
+
) || anonymous
|
48
42
|
end
|
49
43
|
|
50
44
|
def load_division
|
@@ -54,40 +48,51 @@ protected
|
|
54
48
|
def load_collective
|
55
49
|
if params[:collective_id].present?
|
56
50
|
collective_table, collective_id = params[:collective_id].split(':')
|
57
|
-
collective_class_name = MessageTrain.configuration.recipient_tables[
|
51
|
+
collective_class_name = MessageTrain.configuration.recipient_tables[
|
52
|
+
collective_table.to_sym
|
53
|
+
]
|
58
54
|
collective_model = collective_class_name.constantize
|
59
|
-
slug_column = MessageTrain.configuration
|
55
|
+
slug_column = MessageTrain.configuration
|
56
|
+
.slug_columns[collective_table.to_sym] || :slug
|
60
57
|
@collective = collective_model.find_by!(slug_column => collective_id)
|
61
58
|
|
62
|
-
unless @collective.allows_receiving_by?(
|
59
|
+
unless @collective.allows_receiving_by?(
|
60
|
+
@box_user
|
61
|
+
) || @collective.allows_sending_by?(
|
62
|
+
@box_user
|
63
|
+
)
|
63
64
|
flash[:error] = :access_to_that_box_denied.l
|
64
65
|
redirect_to main_app.root_url
|
65
66
|
return
|
66
67
|
end
|
67
68
|
|
68
69
|
case @division
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
70
|
+
when :in, :ignored
|
71
|
+
unless @collective.allows_receiving_by? @box_user
|
72
|
+
flash[:error] = :access_to_that_box_denied.l
|
73
|
+
redirect_to message_train.collective_box_url(
|
74
|
+
@collective.path_part,
|
75
|
+
:sent
|
76
|
+
)
|
77
|
+
end
|
78
|
+
when :sent, :drafts
|
79
|
+
unless @collective.allows_sending_by? @box_user
|
80
|
+
flash[:error] = :access_to_that_box_denied.l
|
81
|
+
redirect_to message_train.collective_box_url(
|
82
|
+
@collective.path_part,
|
83
|
+
:in
|
84
|
+
)
|
85
|
+
end
|
81
86
|
end
|
82
87
|
end
|
83
88
|
end
|
84
89
|
|
85
90
|
def load_box
|
86
|
-
if !@collective.nil?
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
+
@box = if !@collective.nil?
|
92
|
+
@collective.box(@division, @box_user)
|
93
|
+
else
|
94
|
+
@box_user.box(@division)
|
95
|
+
end
|
91
96
|
end
|
92
97
|
|
93
98
|
def load_collective_boxes
|
@@ -110,25 +115,24 @@ protected
|
|
110
115
|
def respond_to_marking
|
111
116
|
if !@box.errors.all.empty?
|
112
117
|
respond_to do |format|
|
113
|
-
format.html
|
118
|
+
format.html do
|
114
119
|
flash[:error] = @box.message
|
115
120
|
show
|
116
|
-
|
121
|
+
end
|
117
122
|
format.json { render :results, status: :unprocessable_entity }
|
118
123
|
end
|
119
124
|
else
|
120
125
|
respond_to do |format|
|
121
|
-
format.html
|
126
|
+
format.html do
|
122
127
|
if @box.results.all.empty?
|
123
128
|
flash[:alert] = @box.message
|
124
129
|
else
|
125
130
|
flash[:notice] = @box.message
|
126
131
|
end
|
127
132
|
show
|
128
|
-
|
133
|
+
end
|
129
134
|
format.json { render :results, status: :accepted }
|
130
135
|
end
|
131
136
|
end
|
132
137
|
end
|
133
|
-
|
134
|
-
end
|
138
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Boxes controller
|
2
3
|
class BoxesController < MessageTrain::ApplicationController
|
3
4
|
before_filter :load_conversations
|
4
5
|
|
@@ -18,7 +19,7 @@ module MessageTrain
|
|
18
19
|
|
19
20
|
# DELETE /box/:division
|
20
21
|
def destroy
|
21
|
-
if
|
22
|
+
if %w( ignore unignore ).include? params[:mark_to_set]
|
22
23
|
@box.send(params[:mark_to_set], @objects)
|
23
24
|
end
|
24
25
|
respond_to_marking
|
@@ -26,8 +27,8 @@ module MessageTrain
|
|
26
27
|
|
27
28
|
private
|
28
29
|
|
29
|
-
|
30
|
-
|
31
|
-
|
30
|
+
def load_conversations
|
31
|
+
@conversations = @box.conversations
|
32
|
+
end
|
32
33
|
end
|
33
34
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Conversations controller
|
2
3
|
class ConversationsController < MessageTrain::ApplicationController
|
3
4
|
before_filter :load_conversation
|
4
5
|
after_filter :mark_as_read
|
@@ -20,7 +21,7 @@ module MessageTrain
|
|
20
21
|
|
21
22
|
# DELETE /box/:division/conversations/:id
|
22
23
|
def destroy
|
23
|
-
if
|
24
|
+
if %w( ignore unignore ).include? params[:mark_to_set]
|
24
25
|
@box.send(params[:mark_to_set], @conversation)
|
25
26
|
end
|
26
27
|
respond_to_marking
|
@@ -28,12 +29,12 @@ module MessageTrain
|
|
28
29
|
|
29
30
|
private
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
32
|
+
def load_conversation
|
33
|
+
@conversation = @box.find_conversation(params[:id])
|
34
|
+
end
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
def mark_as_read
|
37
|
+
@box.mark :read, conversations: @conversation
|
38
|
+
end
|
38
39
|
end
|
39
40
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module MessageTrain
|
2
|
+
# Messages controller
|
2
3
|
class MessagesController < MessageTrain::ApplicationController
|
3
4
|
before_filter :load_message, only: [:show, :edit, :update]
|
4
5
|
|
@@ -11,14 +12,14 @@ module MessageTrain
|
|
11
12
|
|
12
13
|
# GET /box/:division/messages/new
|
13
14
|
def new
|
14
|
-
@message = @box.new_message(
|
15
|
+
@message = @box.new_message(
|
16
|
+
message_train_conversation_id: params[:conversation_id]
|
17
|
+
)
|
15
18
|
end
|
16
19
|
|
17
20
|
# GET /box/:division/messages/:id/edit
|
18
21
|
def edit
|
19
|
-
|
20
|
-
raise ActiveRecord::RecordNotFound
|
21
|
-
end
|
22
|
+
!@message.draft && raise(ActiveRecord::RecordNotFound)
|
22
23
|
end
|
23
24
|
|
24
25
|
# POST /box/:division/messages
|
@@ -38,15 +39,19 @@ module MessageTrain
|
|
38
39
|
|
39
40
|
# PATCH/PUT /box/:division/messages/:id
|
40
41
|
def update
|
41
|
-
|
42
|
-
raise ActiveRecord::RecordNotFound
|
43
|
-
end
|
42
|
+
!@message.draft && raise(ActiveRecord::RecordNotFound)
|
44
43
|
@box.update_message(@message, message_params)
|
45
44
|
if @box.errors.all.empty?
|
46
45
|
if @message.draft
|
47
|
-
redirect_to
|
46
|
+
redirect_to(
|
47
|
+
message_train.box_conversation_url(@box, @message.conversation),
|
48
|
+
alert: @box.message
|
49
|
+
)
|
48
50
|
else
|
49
|
-
redirect_to
|
51
|
+
redirect_to(
|
52
|
+
message_train.box_path(:sent),
|
53
|
+
notice: @box.message
|
54
|
+
)
|
50
55
|
end
|
51
56
|
else
|
52
57
|
flash[:error] = @box.message
|
@@ -54,26 +59,24 @@ module MessageTrain
|
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
57
|
-
|
62
|
+
private
|
63
|
+
|
58
64
|
def load_message
|
59
65
|
@message = @box.find_message(params[:id])
|
60
66
|
end
|
61
67
|
|
62
|
-
# Never trust parameters from the scary internet, only allow the white list
|
68
|
+
# Never trust parameters from the scary internet, only allow the white list
|
69
|
+
# through.
|
63
70
|
def message_params
|
64
71
|
permitted = params.require(:message).permit(
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
72
|
+
:conversation_id,
|
73
|
+
:subject,
|
74
|
+
:body,
|
75
|
+
:draft,
|
76
|
+
attachments_attributes: [:id, :attachment, :_destroy],
|
77
|
+
recipients_to_save: MessageTrain.configuration.recipient_tables.keys
|
71
78
|
)
|
72
|
-
|
73
|
-
permitted['draft'] = true
|
74
|
-
else
|
75
|
-
permitted['draft'] = false
|
76
|
-
end
|
79
|
+
permitted['draft'] = (permitted['draft'] == :save_as_draft.l)
|
77
80
|
permitted
|
78
81
|
end
|
79
82
|
end
|