message_train 0.6.17 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +16 -13
  3. data/.rubocop_todo.yml +12 -0
  4. data/.ruby-version +1 -1
  5. data/.travis.yml +1 -1
  6. data/Gemfile +28 -30
  7. data/README.md +284 -0
  8. data/Rakefile +6 -7
  9. data/VERSION +1 -1
  10. data/app/assets/javascripts/ckeditor/{config.js.coffee → config.js} +7 -6
  11. data/app/assets/stylesheets/message_train.scss +0 -8
  12. data/app/controllers/concerns/message_train_authorization.rb +37 -0
  13. data/app/controllers/concerns/message_train_support.rb +41 -69
  14. data/app/controllers/message_train/application_controller.rb +1 -0
  15. data/app/controllers/message_train/boxes_controller.rb +5 -4
  16. data/app/controllers/message_train/conversations_controller.rb +7 -5
  17. data/app/controllers/message_train/messages_controller.rb +43 -27
  18. data/app/controllers/message_train/participants_controller.rb +14 -25
  19. data/app/controllers/message_train/unsubscribes_controller.rb +96 -61
  20. data/app/helpers/message_train/application_helper.rb +13 -7
  21. data/app/helpers/message_train/attachments_helper.rb +4 -12
  22. data/app/helpers/message_train/boxes_helper.rb +4 -14
  23. data/app/helpers/message_train/collectives_helper.rb +23 -29
  24. data/app/helpers/message_train/conversations_helper.rb +52 -30
  25. data/app/helpers/message_train/messages_helper.rb +33 -20
  26. data/app/mailers/message_train/receipt_mailer.rb +22 -12
  27. data/app/models/message_train/attachment.rb +2 -2
  28. data/app/models/message_train/box.rb +182 -228
  29. data/app/models/message_train/conversation.rb +100 -103
  30. data/app/models/message_train/ignore.rb +83 -4
  31. data/app/models/message_train/message.rb +66 -117
  32. data/app/models/message_train/receipt.rb +73 -49
  33. data/app/views/message_train/boxes/show.html.haml +11 -7
  34. data/config/locales/en.yml +1 -0
  35. data/config/routes.rb +6 -12
  36. data/lib/message_train.rb +3 -1
  37. data/lib/message_train/class_methods.rb +51 -0
  38. data/lib/message_train/configuration.rb +28 -3
  39. data/lib/message_train/instance_methods.rb +209 -0
  40. data/lib/message_train/mixin.rb +25 -320
  41. data/message_train.gemspec +83 -83
  42. data/spec/controllers/message_train/boxes_controller_spec.rb +37 -19
  43. data/spec/controllers/message_train/concerns_spec.rb +21 -3
  44. data/spec/controllers/message_train/conversations_controller_spec.rb +41 -18
  45. data/spec/controllers/message_train/messages_controller_spec.rb +112 -31
  46. data/spec/controllers/message_train/participants_controller_spec.rb +33 -7
  47. data/spec/controllers/message_train/unsubscribes_controller_spec.rb +10 -8
  48. data/spec/dummy/app/assets/stylesheets/{application.css.scss → application.scss} +2 -1
  49. data/spec/dummy/app/assets/stylesheets/bootstrap-everything.scss +54 -0
  50. data/spec/dummy/app/models/group.rb +1 -1
  51. data/spec/dummy/app/views/layouts/application.html.haml +9 -8
  52. data/spec/dummy/bin/setup +8 -8
  53. data/spec/dummy/config/application.rb +0 -3
  54. data/spec/dummy/config/environments/test.rb +4 -2
  55. data/spec/dummy/db/schema.rb +94 -103
  56. data/spec/dummy/db/test.sqlite3 +0 -0
  57. data/spec/factories/attachment.rb +3 -1
  58. data/spec/factories/message.rb +2 -3
  59. data/spec/features/boxes_spec.rb +0 -3
  60. data/spec/helpers/message_train/application_helper_spec.rb +3 -2
  61. data/spec/helpers/message_train/attachment_helper_spec.rb +4 -0
  62. data/spec/helpers/message_train/boxes_helper_spec.rb +1 -0
  63. data/spec/helpers/message_train/collectives_helper_spec.rb +1 -0
  64. data/spec/helpers/message_train/conversations_helper_spec.rb +3 -2
  65. data/spec/helpers/message_train/messages_helper_spec.rb +2 -1
  66. data/spec/models/group_spec.rb +6 -4
  67. data/spec/models/message_train/box_spec.rb +0 -88
  68. data/spec/models/message_train/ignore_spec.rb +65 -0
  69. data/spec/models/message_train/message_spec.rb +6 -5
  70. data/spec/models/message_train/receipt_spec.rb +6 -8
  71. data/spec/models/role_spec.rb +2 -2
  72. data/spec/models/user_spec.rb +29 -101
  73. data/spec/rails_helper.rb +16 -30
  74. data/spec/support/feature_behaviors.rb +2 -1
  75. data/spec/support/shared_connection.rb +5 -0
  76. data/spec/support/utilities.rb +7 -8
  77. metadata +145 -120
  78. data/README.rdoc +0 -175
  79. data/spec/dummy/app/models/.keep +0 -0
  80. data/spec/dummy/log/.keep +0 -0
data/README.rdoc DELETED
@@ -1,175 +0,0 @@
1
- = MessageTrain
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
-
6
-
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
-
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
-
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
-
13
- Email messages are sent when a user receives a message, either directly or through a collective (unless they have unsubscribed from those notifications or all notifications).
14
-
15
- == Installation
16
-
17
- First, install the gem:
18
- gem 'ckeditor'
19
- gem 'message_train'
20
-
21
- Then, run the install generator:
22
-
23
- rails g message_train:install
24
-
25
- And then run `rake db:migrate`.
26
-
27
- Next, add to your models, each of which will need some kind of display name column and some kind of slug (could be the same). See below for the options for this mixin:
28
-
29
- # in /app/models/user.rb
30
- message_train
31
-
32
- OR to set the name and slug columns:
33
-
34
- message_train slug_column: :short_name, name_column: :display_name
35
-
36
- To include Message Train variables and helpers in your controllers, add this concern to your controller or application controller:
37
-
38
- include MessageTrainSupport
39
-
40
- Add to your application.css.scss:
41
-
42
- @import 'message_train';
43
-
44
- And in your application.js:
45
-
46
- //= require message_train
47
-
48
- In your layout, supposing you use haml:
49
-
50
- #alert_area
51
- = alert_flash_messages
52
-
53
- If you use bootstrap, you can use the built-in bootstrap sidebar menu (makes use of bootstrap_leather, which is a dependency of this gem)
54
-
55
- - if user_signed_in?
56
- = message_train_widget
57
- = render_widgets 'md', 3
58
-
59
- === Required helper methods
60
-
61
- If you don't use devise with its `current_user` method, you will need to configure MessageTrain to use whatever method you use:
62
-
63
- MessageTrain.configure do |config|
64
- config.current_user_method = :current_subscriber
65
- end
66
-
67
- === Mixin options
68
-
69
- The `message_train` mixin takes the following options:
70
-
71
- [:only] A symbol or array of symbols to be the only relationships used, which can include: [:sender, :recipient]
72
- [:except] A symbol or array of symbols not to create relationships for, which can include: [:sender, :recipient]
73
- [:valid_senders] A method name to call for a list of valid senders for this model
74
- [:collectives_for_recipient] A method that, when passed @box_user, will return a collection of valid instances of this model for that @box_user to receive. Probably a scope. (e.g. it might return groups that the user is a member of)
75
- [:valid_recipients] A method that returns a collection of valid recipients for this model. default: nil
76
- [:name_column] The column by which to name and find this model. default: :name
77
- [:slug_column] The column with the short, typeable form of the name. default: :slug
78
-
79
- === Smaller address book
80
-
81
- By default, the address book will contain all objects of the current_user_method object's model type. To change this behavior, define an address book method on your recipient models, something like this:
82
-
83
- def self.valid_recipients_for(user)
84
- # Supposing you use rolify
85
- with_role(:friend, user)
86
- end
87
-
88
- And in your model:
89
-
90
- message_train address_book_method: :valid_recipients_for
91
-
92
- Or in your initializer:
93
-
94
- config.address_book_methods[:users] = :valid_recipients_for
95
-
96
- == View Helpers
97
-
98
- === Boxes
99
- [boxes_dropdown_list] Bootstrap navigation dropdown list of boxes. (Be sure to check that user is signed in before calling, or you'll get errors.)
100
- [boxes_widget] Bootstrap widget with list of boxes
101
- [box_nav_item(box)] Bootstrap list item for one box
102
- [box_list_item(box)] Bootstrap list item for one box
103
- [box_participant_name(participant)] Name of the participant, according to the method specified in your configuration or model.
104
- [box_participant_slug(participant)] Slug of the participant, according to the method specified in your configuration or model.
105
-
106
- === Conversations
107
- [conversation_senders(conversation)] List of senders for a given conversation
108
- [conversation_class(box, conversation)] CSS class to put on a given conversation when in a certain box
109
- [conversation_trashed_toggle(conversation)] Link to toggle trashed status of a conversation
110
- [conversation_read_toggle(conversation)] Link to toggle read status of a conversation
111
- [conversation_ignored_toggle(conversation)] Link to toggle ignored status of a conversation
112
- [conversation_deleted_toggle(conversation)] Link to toggle deleted status of a conversation
113
- [conversation_toggle(conversation, icon, mark_to_set, method, title, options = {})] Link to toggle some status of a conversation
114
-
115
- === Messages
116
- [message_class(box, message)] CSS class to put on a given message when in a certain box
117
- [message_trashed_toggle(message)] Link to toggle trashed status of a message
118
- [message_read_toggle(message)] Link to toggle read status of a message
119
- [message_deleted_toggle(message)] Link to toggle ignored status of a message
120
- [message_toggle(message, icon, mark_to_set, title, options = {})] Link to toggle some status of a message
121
- [message_recipients(message)] Recipients for a given message
122
-
123
- == Configuration
124
-
125
- [config.slug_columns] Usually populated by options on the `message_train` mixin for models, this contains a `Hash` of tables and their slug columns
126
- [config.name_columns] Usually populated by options on the `message_train` mixin for models, this contains a `Hash` of tables and their name columns
127
- [config.user_model] Defaults to `'User'`
128
- [config.current_user_method] Defaults to `Devise`'s `current_user`
129
- [config.user_sign_in_path] Defaults to `Devise`'s `/users/sign_in`
130
- [config.user_route_authentication_method] Defaults to `Devise`'s `:user`
131
- [config.address_book_method] Default value if `address_book_methods` doesn't have a match for this table
132
- [config.address_book_methods] `Hash` of tables and the methods those tables use to provide a tab-completion address book for that table.
133
- [config.recipient_tables] Usually populated by options on the `message_train` mixin for models, this contains a `Hash` of tables and their class names
134
- [config.collectives_for_recipient_methods] Usually populated by options on the `message_train` mixin for models, this contains a list of collectives that act as recipients through which users receive messages.
135
- [config.valid_senders_methods] Usually populated by options on the `message_train` mixin for models, this contains a `Hash` of tables and the methods that indicate which users can send messages to a given instance from that table.
136
- [config.valid_recipients_methods] Usually populated by options on the `message_train` mixin for models, this contains a `Hash` of tables and the methods that indicate which users can receive messages from a given instance from that table.
137
- [config.from_email] The email address from which notification emails are sent.
138
- [config.site_name] The name of the site, for use in notification emails.
139
-
140
- == Upgrading
141
-
142
- === 0.4.0
143
-
144
- Version 0.4.0 introduced database changes to the foreign key columns to work with Rails 4.2.5. Let me know if you need help migrating your app to the newly named foreign keys.
145
-
146
- === 0.3.0
147
-
148
- A new config variable was added for the user model, which will be used to generate a new user if the user is anonymous.
149
-
150
- === 0.2.0
151
- New columns were added with version 0.2.0, so when upgrading be sure to install the latest migrations:
152
-
153
- rake message_train:install:migrations
154
-
155
- Running this command is harmless if the migrations are already installed, they will simply be skipped.
156
-
157
- == Contributing to MessageTrain
158
-
159
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
160
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
161
- * Fork the project.
162
- * Start a feature/bugfix branch.
163
- * Commit and push until you are happy with your contribution.
164
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
165
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
166
-
167
- == Contributors
168
- * {Karen Lundgren}[https://github.com/nerakdon]
169
- * {Chad Lundgren}[https://github.com/chadlundgren]
170
-
171
- == Copyright
172
-
173
- Copyright (c) 2015-2017 Gem Vein. See LICENSE.txt for
174
- further details.
175
-
File without changes
data/spec/dummy/log/.keep DELETED
File without changes