message_train 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (214) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/.travis.yml +7 -0
  7. data/Gemfile +51 -0
  8. data/LICENSE.txt +20 -0
  9. data/README.rdoc +83 -0
  10. data/Rakefile +71 -0
  11. data/VERSION +1 -0
  12. data/app/assets/javascripts/message_train.js +138 -0
  13. data/app/assets/stylesheets/message_train.scss +107 -0
  14. data/app/controllers/message_train/application_controller.rb +64 -0
  15. data/app/controllers/message_train/boxes_controller.rb +37 -0
  16. data/app/controllers/message_train/conversations_controller.rb +38 -0
  17. data/app/controllers/message_train/messages_controller.rb +74 -0
  18. data/app/controllers/message_train/participants_controller.rb +36 -0
  19. data/app/helpers/message_train/application_helper.rb +4 -0
  20. data/app/helpers/message_train/boxes_helper.rb +30 -0
  21. data/app/helpers/message_train/conversations_helper.rb +73 -0
  22. data/app/helpers/message_train/messages_helper.rb +58 -0
  23. data/app/models/message_train/attachment.rb +17 -0
  24. data/app/models/message_train/box.rb +268 -0
  25. data/app/models/message_train/conversation.rb +101 -0
  26. data/app/models/message_train/ignore.rb +18 -0
  27. data/app/models/message_train/message.rb +146 -0
  28. data/app/models/message_train/receipt.rb +70 -0
  29. data/app/views/application/404.html.haml +3 -0
  30. data/app/views/message_train/application/results.json.jbuilder +8 -0
  31. data/app/views/message_train/boxes/_dropdown_list.html.haml +5 -0
  32. data/app/views/message_train/boxes/_list_item.html.haml +5 -0
  33. data/app/views/message_train/boxes/_widget.html.haml +6 -0
  34. data/app/views/message_train/boxes/show.html.haml +47 -0
  35. data/app/views/message_train/conversations/_conversation.html.haml +9 -0
  36. data/app/views/message_train/conversations/_deleted_toggle.html.haml +1 -0
  37. data/app/views/message_train/conversations/_ignored_toggle.html.haml +4 -0
  38. data/app/views/message_train/conversations/_read_toggle.html.haml +4 -0
  39. data/app/views/message_train/conversations/_toggle.html.haml +1 -0
  40. data/app/views/message_train/conversations/_trashed_toggle.html.haml +4 -0
  41. data/app/views/message_train/conversations/show.html.haml +11 -0
  42. data/app/views/message_train/conversations/show.json.jbuilder +2 -0
  43. data/app/views/message_train/messages/_deleted_toggle.html.haml +1 -0
  44. data/app/views/message_train/messages/_form.html.haml +8 -0
  45. data/app/views/message_train/messages/_message.html.haml +35 -0
  46. data/app/views/message_train/messages/_read_toggle.html.haml +4 -0
  47. data/app/views/message_train/messages/_toggle.html.haml +1 -0
  48. data/app/views/message_train/messages/_trashed_toggle.html.haml +4 -0
  49. data/app/views/message_train/messages/edit.html.haml +2 -0
  50. data/app/views/message_train/messages/new.html.haml +2 -0
  51. data/app/views/message_train/messages/show.json.jbuilder +2 -0
  52. data/app/views/message_train/participants/_field.html.haml +4 -0
  53. data/app/views/message_train/participants/_participant.json.jbuilder +5 -0
  54. data/app/views/message_train/participants/index.json.jbuilder +3 -0
  55. data/app/views/message_train/participants/show.json.jbuilder +1 -0
  56. data/bin/rails +12 -0
  57. data/config/initializers/bootstrap_pager_config.rb +10 -0
  58. data/config/initializers/date_time.rb +5 -0
  59. data/config/locales/en.yml +50 -0
  60. data/config/routes.rb +11 -0
  61. data/db/migrate/20150721145319_create_message_train_conversations.rb +9 -0
  62. data/db/migrate/20150721160322_create_message_train_messages.rb +14 -0
  63. data/db/migrate/20150721161144_create_message_train_attachments.rb +10 -0
  64. data/db/migrate/20150721161940_create_message_train_receipts.rb +16 -0
  65. data/db/migrate/20150721163838_create_message_train_ignores.rb +11 -0
  66. data/lib/generators/message_train/install/install_generator.rb +30 -0
  67. data/lib/generators/message_train/install/templates/initializer.rb +10 -0
  68. data/lib/generators/message_train/utils.rb +16 -0
  69. data/lib/message_train/configuration.rb +35 -0
  70. data/lib/message_train/engine.rb +19 -0
  71. data/lib/message_train/localization.rb +31 -0
  72. data/lib/message_train/mixin.rb +83 -0
  73. data/lib/message_train/version.rb +7 -0
  74. data/lib/message_train.rb +20 -0
  75. data/lib/tasks/message_train_tasks.rake +0 -0
  76. data/message_train.gemspec +325 -0
  77. data/night_train.gemspec +274 -0
  78. data/spec/controllers/message_train/boxes_controller_spec.rb +82 -0
  79. data/spec/controllers/message_train/conversations_controller_spec.rb +86 -0
  80. data/spec/controllers/message_train/messages_controller_spec.rb +210 -0
  81. data/spec/controllers/message_train/participants_controller_spec.rb +35 -0
  82. data/spec/dummy/.rspec +2 -0
  83. data/spec/dummy/Rakefile +6 -0
  84. data/spec/dummy/app/assets/files/message_train/attachments/1917-Boys_Race_Above-Wiki.jpg +0 -0
  85. data/spec/dummy/app/assets/files/message_train/attachments/ACD_Silverbarn's_Mayumi.jpg +0 -0
  86. data/spec/dummy/app/assets/files/message_train/attachments/ACD_obedience.jpg +0 -0
  87. data/spec/dummy/app/assets/files/message_train/attachments/A_Man_and_His_Dog.jpg +0 -0
  88. data/spec/dummy/app/assets/files/message_train/attachments/Alaskan_Malamute_agility_a-frame.jpg +0 -0
  89. data/spec/dummy/app/assets/files/message_train/attachments/American_water_spaniel_02.jpg +0 -0
  90. data/spec/dummy/app/assets/files/message_train/attachments/Aport_konkurs_rybnik.jpg +0 -0
  91. data/spec/dummy/app/assets/files/message_train/attachments/Askerhytta.jpg +0 -0
  92. data/spec/dummy/app/assets/files/message_train/attachments/Bambisj.jpg +0 -0
  93. data/spec/dummy/app/assets/files/message_train/attachments/Cattle_dog_skating.jpg +0 -0
  94. data/spec/dummy/app/assets/files/message_train/attachments/Dog's_Olympics_training_ground_-_geograph.org.uk_-_660324.jpg +0 -0
  95. data/spec/dummy/app/assets/files/message_train/attachments/DogShowHierarchy.png +0 -0
  96. data/spec/dummy/app/assets/files/message_train/attachments/Dog_weight_pull.jpg +0 -0
  97. data/spec/dummy/app/assets/files/message_train/attachments/Draghuntpostcard.jpg +0 -0
  98. data/spec/dummy/app/assets/files/message_train/attachments/Esham_51.JPG +0 -0
  99. data/spec/dummy/app/assets/files/message_train/attachments/FastCourseExample.jpg +0 -0
  100. data/spec/dummy/app/assets/files/message_train/attachments/Fotos_joel_141.JPG +0 -0
  101. data/spec/dummy/app/assets/files/message_train/attachments/Galgo_Spanish_male_brindle.jpg +0 -0
  102. data/spec/dummy/app/assets/files/message_train/attachments/Golden-retriever-carlos-bei-der-dummyarbeit.jpg +0 -0
  103. data/spec/dummy/app/assets/files/message_train/attachments/Habavk.jpg +0 -0
  104. data/spec/dummy/app/assets/files/message_train/attachments/Haie_rci.svg +1714 -0
  105. data/spec/dummy/app/assets/files/message_train/attachments/Hanging_18.jpg +0 -0
  106. data/spec/dummy/app/assets/files/message_train/attachments/Hundewa.jpg +0 -0
  107. data/spec/dummy/app/assets/files/message_train/attachments/K9ProSports_AttackOnHandler.jpg +0 -0
  108. data/spec/dummy/app/assets/files/message_train/attachments/K9ProSports_heel.jpg +0 -0
  109. data/spec/dummy/app/assets/files/message_train/attachments/K9Pro_Civil_agitation.JPG +0 -0
  110. data/spec/dummy/app/assets/files/message_train/attachments/TrainingSchutzhundRetrieveOverWall.jpg +0 -0
  111. data/spec/dummy/app/assets/files/message_train/attachments/example.pdf +0 -0
  112. data/spec/dummy/app/assets/files/message_train/attachments/letterlegal5.doc +0 -0
  113. data/spec/dummy/app/assets/files/message_train/attachments/pdf-sample.pdf +0 -0
  114. data/spec/dummy/app/assets/files/message_train/attachments/sample.pdf +0 -0
  115. data/spec/dummy/app/assets/files/message_train/attachments/tips.doc +0 -0
  116. data/spec/dummy/app/assets/files/message_train/attachments/wd-spectools-word-sample-04.doc +0 -0
  117. data/spec/dummy/app/assets/images/logo.svg +140 -0
  118. data/spec/dummy/app/assets/javascripts/application.js +17 -0
  119. data/spec/dummy/app/assets/stylesheets/application.css.scss +35 -0
  120. data/spec/dummy/app/controllers/application_controller.rb +14 -0
  121. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  122. data/spec/dummy/app/mailers/.keep +0 -0
  123. data/spec/dummy/app/models/.keep +0 -0
  124. data/spec/dummy/app/models/group.rb +19 -0
  125. data/spec/dummy/app/models/role.rb +10 -0
  126. data/spec/dummy/app/models/user.rb +23 -0
  127. data/spec/dummy/app/views/layouts/_top_navigation.html.haml +5 -0
  128. data/spec/dummy/app/views/layouts/application.html.haml +29 -0
  129. data/spec/dummy/bin/bundle +3 -0
  130. data/spec/dummy/bin/rails +4 -0
  131. data/spec/dummy/bin/rake +4 -0
  132. data/spec/dummy/bin/setup +29 -0
  133. data/spec/dummy/config/application.rb +40 -0
  134. data/spec/dummy/config/boot.rb +5 -0
  135. data/spec/dummy/config/database.yml +25 -0
  136. data/spec/dummy/config/environment.rb +5 -0
  137. data/spec/dummy/config/environments/development.rb +41 -0
  138. data/spec/dummy/config/environments/production.rb +79 -0
  139. data/spec/dummy/config/environments/test.rb +42 -0
  140. data/spec/dummy/config/initializers/assets.rb +11 -0
  141. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  142. data/spec/dummy/config/initializers/bootstrap_leather.rb +7 -0
  143. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  144. data/spec/dummy/config/initializers/devise.rb +265 -0
  145. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  146. data/spec/dummy/config/initializers/inflections.rb +16 -0
  147. data/spec/dummy/config/initializers/message_train.rb +10 -0
  148. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  149. data/spec/dummy/config/initializers/paperclip.rb +2 -0
  150. data/spec/dummy/config/initializers/rolify.rb +7 -0
  151. data/spec/dummy/config/initializers/session_store.rb +3 -0
  152. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  153. data/spec/dummy/config/locales/devise.en.yml +60 -0
  154. data/spec/dummy/config/locales/en.yml +23 -0
  155. data/spec/dummy/config/routes.rb +5 -0
  156. data/spec/dummy/config/secrets.yml +22 -0
  157. data/spec/dummy/config/unused/temporary_i18n_debugging.rb +12 -0
  158. data/spec/dummy/config.ru +4 -0
  159. data/spec/dummy/db/migrate/20150721140013_devise_create_users.rb +42 -0
  160. data/spec/dummy/db/migrate/20150721141009_rolify_create_roles.rb +19 -0
  161. data/spec/dummy/db/migrate/20150721141128_create_groups.rb +11 -0
  162. data/spec/dummy/db/migrate/20150721150307_add_display_name_column_to_users.rb +6 -0
  163. data/spec/dummy/db/migrate/20150724142846_create_message_train_conversations.night_train.rb +10 -0
  164. data/spec/dummy/db/migrate/20150724142847_create_message_train_messages.night_train.rb +15 -0
  165. data/spec/dummy/db/migrate/20150724142848_create_message_train_attachments.night_train.rb +11 -0
  166. data/spec/dummy/db/migrate/20150724142849_create_message_train_receipts.night_train.rb +17 -0
  167. data/spec/dummy/db/migrate/20150724142850_create_message_train_ignores.night_train.rb +12 -0
  168. data/spec/dummy/db/schema.rb +121 -0
  169. data/spec/dummy/db/seeds/conversations.seeds.rb +86 -0
  170. data/spec/dummy/db/seeds/development/conversations.seeds.rb +9 -0
  171. data/spec/dummy/db/seeds/groups.seeds.rb +9 -0
  172. data/spec/dummy/db/seeds/test/conversations.seeds.rb +9 -0
  173. data/spec/dummy/db/seeds/users.seeds.rb +15 -0
  174. data/spec/dummy/db/seeds.rb +0 -0
  175. data/spec/dummy/db/test.sqlite3 +0 -0
  176. data/spec/dummy/lib/assets/.keep +0 -0
  177. data/spec/dummy/log/.keep +0 -0
  178. data/spec/dummy/public/404.html +67 -0
  179. data/spec/dummy/public/422.html +67 -0
  180. data/spec/dummy/public/500.html +66 -0
  181. data/spec/dummy/public/capybara.html +193 -0
  182. data/spec/dummy/public/favicon.ico +0 -0
  183. data/spec/factories/attachment.rb +6 -0
  184. data/spec/factories/group.rb +20 -0
  185. data/spec/factories/message.rb +68 -0
  186. data/spec/factories/user.rb +8 -0
  187. data/spec/features/boxes_spec.rb +50 -0
  188. data/spec/features/conversations_spec.rb +36 -0
  189. data/spec/features/messages_spec.rb +53 -0
  190. data/spec/helpers/message_train/boxes_helper_spec.rb +44 -0
  191. data/spec/message_train_spec.rb +7 -0
  192. data/spec/models/group_spec.rb +23 -0
  193. data/spec/models/message_train/attachment_spec.rb +12 -0
  194. data/spec/models/message_train/box_spec.rb +195 -0
  195. data/spec/models/message_train/conversation_spec.rb +98 -0
  196. data/spec/models/message_train/ignore_spec.rb +27 -0
  197. data/spec/models/message_train/message_spec.rb +83 -0
  198. data/spec/models/message_train/receipt_spec.rb +73 -0
  199. data/spec/models/user_spec.rb +68 -0
  200. data/spec/rails_helper.rb +83 -0
  201. data/spec/spec_helper.rb +92 -0
  202. data/spec/support/controller_behaviors.rb +88 -0
  203. data/spec/support/controller_macros.rb +13 -0
  204. data/spec/support/conversations.rb +10 -0
  205. data/spec/support/factory_girl.rb +3 -0
  206. data/spec/support/feature_behaviors.rb +62 -0
  207. data/spec/support/groups.rb +3 -0
  208. data/spec/support/loaded_site.rb +5 -0
  209. data/spec/support/shared_connection.rb +13 -0
  210. data/spec/support/users.rb +6 -0
  211. data/spec/support/utilities.rb +8 -0
  212. data/vendor/assets/javascripts/bootstrap-tags.js +623 -0
  213. data/vendor/assets/stylesheets/bootstrap-tags.css +78 -0
  214. metadata +608 -0
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,265 @@
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
+ Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key`
8
+ # by default. You can change it below and use your own secret key.
9
+ # config.secret_key = '6352074d0d9160d3fa5da4c6eb7b86f3702ac8d0e630f59705dc800d2f161ad8e53494e61585088250bf10ce403e61cf93e9f1ab3d9ecb4a8b3616857f86cabd'
10
+
11
+ # ==> Mailer Configuration
12
+ # Configure the e-mail address which will be shown in Devise::Mailer,
13
+ # note that it will be overwritten if you use your own mailer class
14
+ # with default "from" parameter.
15
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
16
+
17
+ # Configure the class responsible to send e-mails.
18
+ # config.mailer = 'Devise::Mailer'
19
+
20
+ # ==> ORM configuration
21
+ # Load and configure the ORM. Supports :active_record (default) and
22
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
23
+ # available as additional gems.
24
+ require 'devise/orm/active_record'
25
+
26
+ # ==> Configuration for any authentication mechanism
27
+ # Configure which keys are used when authenticating a user. The default is
28
+ # just :email. You can configure it to use [:username, :subdomain], so for
29
+ # authenticating a user, both parameters are required. Remember that those
30
+ # parameters are used only when authenticating and not when retrieving from
31
+ # session. If you need permissions, you should implement that in a before filter.
32
+ # You can also supply a hash where the value is a boolean determining whether
33
+ # or not authentication should be aborted when the value is not present.
34
+ # config.authentication_keys = [:email]
35
+
36
+ # Configure parameters from the request object used for authentication. Each entry
37
+ # given should be a request method and it will automatically be passed to the
38
+ # find_for_authentication method and considered in your model lookup. For instance,
39
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
40
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
41
+ # config.request_keys = []
42
+
43
+ # Configure which authentication keys should be case-insensitive.
44
+ # These keys will be downcased upon creating or modifying a user and when used
45
+ # to authenticate or find a user. Default is :email.
46
+ config.case_insensitive_keys = [:email]
47
+
48
+ # Configure which authentication keys should have whitespace stripped.
49
+ # These keys will have whitespace before and after removed upon creating or
50
+ # modifying a user and when used to authenticate or find a user. Default is :email.
51
+ config.strip_whitespace_keys = [:email]
52
+
53
+ # Tell if authentication through request.params is enabled. True by default.
54
+ # It can be set to an array that will enable params authentication only for the
55
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
56
+ # enable it only for database (email + password) authentication.
57
+ # config.params_authenticatable = true
58
+
59
+ # Tell if authentication through HTTP Auth is enabled. False by default.
60
+ # It can be set to an array that will enable http authentication only for the
61
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
62
+ # enable it only for database authentication. The supported strategies are:
63
+ # :database = Support basic authentication with authentication key + password
64
+ # config.http_authenticatable = false
65
+
66
+ # If 401 status code should be returned for AJAX requests. True by default.
67
+ # config.http_authenticatable_on_xhr = true
68
+
69
+ # The realm used in Http Basic Authentication. 'Application' by default.
70
+ # config.http_authentication_realm = 'Application'
71
+
72
+ # It will change confirmation, password recovery and other workflows
73
+ # to behave the same regardless if the e-mail provided was right or wrong.
74
+ # Does not affect registerable.
75
+ # config.paranoid = true
76
+
77
+ # By default Devise will store the user in session. You can skip storage for
78
+ # particular strategies by setting this option.
79
+ # Notice that if you are skipping storage for all authentication paths, you
80
+ # may want to disable generating routes to Devise's sessions controller by
81
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
82
+ config.skip_session_storage = [:http_auth]
83
+
84
+ # By default, Devise cleans up the CSRF token on authentication to
85
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
86
+ # requests for sign in and sign up, you need to get a new CSRF token
87
+ # from the server. You can disable this option at your own risk.
88
+ # config.clean_up_csrf_token_on_authentication = true
89
+
90
+ # ==> Configuration for :database_authenticatable
91
+ # For bcrypt, this is the cost for hashing the password and defaults to 10. If
92
+ # using other encryptors, it sets how many times you want the password re-encrypted.
93
+ #
94
+ # Limiting the stretches to just one in testing will increase the performance of
95
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
96
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
97
+ # encryptor), the cost increases exponentially with the number of stretches (e.g.
98
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
99
+ config.stretches = Rails.env.test? ? 1 : 10
100
+
101
+ # Setup a pepper to generate the encrypted password.
102
+ # config.pepper = 'a95ea3408f3feea9a0ba1963155da0f113da027cafeff20e1af3c599af7f0e1ef9e3128be4a1656a756e754dd7db15b089d67fc2fb2845510618a2edb74ef7dc'
103
+
104
+ # ==> Configuration for :confirmable
105
+ # A period that the user is allowed to access the website even without
106
+ # confirming their account. For instance, if set to 2.days, the user will be
107
+ # able to access the website for two days without confirming their account,
108
+ # access will be blocked just in the third day. Default is 0.days, meaning
109
+ # the user cannot access the website without confirming their account.
110
+ # config.allow_unconfirmed_access_for = 2.days
111
+
112
+ # A period that the user is allowed to confirm their account before their
113
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
114
+ # their account within 3 days after the mail was sent, but on the fourth day
115
+ # their account can't be confirmed with the token any more.
116
+ # Default is nil, meaning there is no restriction on how long a user can take
117
+ # before confirming their account.
118
+ # config.confirm_within = 3.days
119
+
120
+ # If true, requires any email changes to be confirmed (exactly the same way as
121
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
122
+ # db field (see migrations). Until confirmed, new email is stored in
123
+ # unconfirmed_email column, and copied to email column on successful confirmation.
124
+ config.reconfirmable = true
125
+
126
+ # Defines which key will be used when confirming an account
127
+ # config.confirmation_keys = [:email]
128
+
129
+ # ==> Configuration for :rememberable
130
+ # The time the user will be remembered without asking for credentials again.
131
+ # config.remember_for = 2.weeks
132
+
133
+ # Invalidates all the remember me tokens when the user signs out.
134
+ config.expire_all_remember_me_on_sign_out = true
135
+
136
+ # If true, extends the user's remember period when remembered via cookie.
137
+ # config.extend_remember_period = false
138
+
139
+ # Options to be passed to the created cookie. For instance, you can set
140
+ # secure: true in order to force SSL only cookies.
141
+ # config.rememberable_options = {}
142
+
143
+ # ==> Configuration for :validatable
144
+ # Range for password length.
145
+ config.password_length = 8..72
146
+
147
+ # Email regex used to validate email formats. It simply asserts that
148
+ # one (and only one) @ exists in the given string. This is mainly
149
+ # to give user feedback and not to assert the e-mail validity.
150
+ # config.email_regexp = /\A[^@]+@[^@]+\z/
151
+
152
+ # ==> Configuration for :timeoutable
153
+ # The time you want to timeout the user session without activity. After this
154
+ # time the user will be asked for credentials again. Default is 30 minutes.
155
+ # config.timeout_in = 30.minutes
156
+
157
+ # If true, expires auth token on session timeout.
158
+ # config.expire_auth_token_on_timeout = false
159
+
160
+ # ==> Configuration for :lockable
161
+ # Defines which strategy will be used to lock an account.
162
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
163
+ # :none = No lock strategy. You should handle locking by yourself.
164
+ # config.lock_strategy = :failed_attempts
165
+
166
+ # Defines which key will be used when locking and unlocking an account
167
+ # config.unlock_keys = [:email]
168
+
169
+ # Defines which strategy will be used to unlock an account.
170
+ # :email = Sends an unlock link to the user email
171
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
172
+ # :both = Enables both strategies
173
+ # :none = No unlock strategy. You should handle unlocking by yourself.
174
+ # config.unlock_strategy = :both
175
+
176
+ # Number of authentication tries before locking an account if lock_strategy
177
+ # is failed attempts.
178
+ # config.maximum_attempts = 20
179
+
180
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
181
+ # config.unlock_in = 1.hour
182
+
183
+ # Warn on the last attempt before the account is locked.
184
+ # config.last_attempt_warning = true
185
+
186
+ # ==> Configuration for :recoverable
187
+ #
188
+ # Defines which key will be used when recovering the password for an account
189
+ # config.reset_password_keys = [:email]
190
+
191
+ # Time interval you can reset your password with a reset password key.
192
+ # Don't put a too small interval or your users won't have the time to
193
+ # change their passwords.
194
+ config.reset_password_within = 6.hours
195
+
196
+ # When set to false, does not sign a user in automatically after their password is
197
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
198
+ # config.sign_in_after_reset_password = true
199
+
200
+ # ==> Configuration for :encryptable
201
+ # Allow you to use another encryption algorithm besides bcrypt (default). You can use
202
+ # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
203
+ # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
204
+ # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
205
+ # REST_AUTH_SITE_KEY to pepper).
206
+ #
207
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
208
+ # config.encryptor = :sha512
209
+
210
+ # ==> Scopes configuration
211
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
212
+ # "users/sessions/new". It's turned off by default because it's slower if you
213
+ # are using only default views.
214
+ # config.scoped_views = false
215
+
216
+ # Configure the default scope given to Warden. By default it's the first
217
+ # devise role declared in your routes (usually :user).
218
+ # config.default_scope = :user
219
+
220
+ # Set this configuration to false if you want /users/sign_out to sign out
221
+ # only the current scope. By default, Devise signs out all scopes.
222
+ # config.sign_out_all_scopes = true
223
+
224
+ # ==> Navigation configuration
225
+ # Lists the formats that should be treated as navigational. Formats like
226
+ # :html, should redirect to the sign in page when the user does not have
227
+ # access, but formats like :xml or :json, should return 401.
228
+ #
229
+ # If you have any extra navigational formats, like :iphone or :mobile, you
230
+ # should add them to the navigational formats lists.
231
+ #
232
+ # The "*/*" below is required to match Internet Explorer requests.
233
+ # config.navigational_formats = ['*/*', :html]
234
+
235
+ # The default HTTP method used to sign out a resource. Default is :delete.
236
+ config.sign_out_via = :delete
237
+
238
+ # ==> OmniAuth
239
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
240
+ # up on your models and hooks.
241
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
242
+
243
+ # ==> Warden configuration
244
+ # If you want to use other strategies, that are not supported by Devise, or
245
+ # change the failure app, you can configure them inside the config.warden block.
246
+ #
247
+ # config.warden do |manager|
248
+ # manager.intercept_401 = false
249
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
250
+ # end
251
+
252
+ # ==> Mountable engine configurations
253
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
254
+ # is mountable, there are some extra configurations to be taken into account.
255
+ # The following options are available, assuming the engine is mounted as:
256
+ #
257
+ # mount MyEngine, at: '/my_engine'
258
+ #
259
+ # The router that invoked `devise_for`, in the example above, would be:
260
+ # config.router_name = :my_engine
261
+ #
262
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
263
+ # so you need to do it manually. For the users scope, it would be:
264
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
265
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,10 @@
1
+ MessageTrain.configure do |config|
2
+ # config.friendly_id_tables << :groups
3
+ # config.friendly_id_tables << :users
4
+ # config.slug_columns[:users] = :slug
5
+ # config.name_columns[:users] = :display_name
6
+ # config.current_user_method = :current_user
7
+ # config.user_sign_in_path = '/users/sign_in'
8
+ # config.user_route_authentication_method = :user
9
+ # self.address_book_method = :address_book
10
+ end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,2 @@
1
+ Paperclip::Attachment.default_options[:path] = ':rails_root/public/system/:rails_env/:class/:attachment/:id_partition/:filename'
2
+ Paperclip::Attachment.default_options[:url] = '/system/:rails_env/:class/:attachment/:id_partition/:filename'
@@ -0,0 +1,7 @@
1
+ Rolify.configure do |config|
2
+ # By default ORM adapter is ActiveRecord. uncomment to use mongoid
3
+ # config.use_mongoid
4
+
5
+ # Dynamic shortcuts for User class (user.is_admin? like methods). Default is: false
6
+ # config.use_dynamic_shortcuts
7
+ end
@@ -0,0 +1,3 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Rails.application.config.session_store :cookie_store, key: '_dummy_session'
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,60 @@
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
+
3
+ en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your email address has been successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid %{authentication_keys} or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account is locked."
15
+ not_found_in_database: "Invalid %{authentication_keys} or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your email address before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password has been changed successfully. You are now signed in."
34
+ updated_not_active: "Your password has been changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
42
+ updated: "Your account has been updated successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ already_signed_out: "Signed out successfully."
47
+ unlocks:
48
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
49
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
50
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
51
+ errors:
52
+ messages:
53
+ already_confirmed: "was already confirmed, please try signing in"
54
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
55
+ expired: "has expired, please request a new one"
56
+ not_found: "not found"
57
+ not_locked: "was not locked"
58
+ not_saved:
59
+ one: "1 error prohibited this %{resource} from being saved:"
60
+ other: "%{count} errors prohibited this %{resource} from being saved:"
@@ -0,0 +1,23 @@
1
+ # Files in the config/locales directory are used for internationalization
2
+ # and are automatically loaded by Rails. If you want to use locales other
3
+ # than English, add the necessary files in this directory.
4
+ #
5
+ # To use the locales, use `I18n.t`:
6
+ #
7
+ # I18n.t 'hello'
8
+ #
9
+ # In views, this is aliased to just `t`:
10
+ #
11
+ # <%= t('hello') %>
12
+ #
13
+ # To use a different locale, set it with `I18n.locale`:
14
+ #
15
+ # I18n.locale = :es
16
+ #
17
+ # This would use the information in config/locales/es.yml.
18
+ #
19
+ # To learn more, please read the Rails Internationalization guide
20
+ # available at http://guides.rubyonrails.org/i18n.html.
21
+
22
+ en:
23
+ hello: "Hello world"
@@ -0,0 +1,5 @@
1
+ Rails.application.routes.draw do
2
+
3
+ mount MessageTrain::Engine => '/', :as => 'message_train'
4
+ devise_for :users
5
+ end
@@ -0,0 +1,22 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies will become invalid!
5
+
6
+ # Make sure the secret is at least 30 characters and all random,
7
+ # no regular words or you'll be exposed to dictionary attacks.
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure the secrets in this file are kept private
11
+ # if you're sharing your code publicly.
12
+
13
+ development:
14
+ secret_key_base: ac4907450d833ae9cdd320e25bdeedbf3ecb2617dd15e628bd9704882a26eb298f6cc0d5a11543d287de47f39c60c47e81290600189fe72205f34e84143260c9
15
+
16
+ test:
17
+ secret_key_base: 8b9c1409e1f4fbe98767d7df8e83d024eb7a2965217977a68bdfc7e4fd0940bab4bd61f658032fc7cfc9c0ec68d0d9ebdf99c2f1ab385f8f9306cb15330f1ab8
18
+
19
+ # Do not keep production secrets in the repository,
20
+ # instead read values from the environment.
21
+ production:
22
+ secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
@@ -0,0 +1,12 @@
1
+ module I18n
2
+ module Registry
3
+ protected
4
+ def lookup(locale, key, scope = [], options = {})
5
+ @log ||= Logger.new(File.join(Rails.root, 'log', 'i18n_registry.log'))
6
+ @log.info key
7
+ super
8
+ end
9
+ end
10
+ end
11
+
12
+ I18n::Backend::Simple.send :include, I18n::Registry
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,42 @@
1
+ class DeviseCreateUsers < ActiveRecord::Migration
2
+ def change
3
+ create_table(:users) do |t|
4
+ ## Database authenticatable
5
+ t.string :email, null: false, default: ""
6
+ t.string :encrypted_password, null: false, default: ""
7
+
8
+ ## Recoverable
9
+ t.string :reset_password_token
10
+ t.datetime :reset_password_sent_at
11
+
12
+ ## Rememberable
13
+ t.datetime :remember_created_at
14
+
15
+ ## Trackable
16
+ t.integer :sign_in_count, default: 0, null: false
17
+ t.datetime :current_sign_in_at
18
+ t.datetime :last_sign_in_at
19
+ t.string :current_sign_in_ip
20
+ t.string :last_sign_in_ip
21
+
22
+ ## Confirmable
23
+ # t.string :confirmation_token
24
+ # t.datetime :confirmed_at
25
+ # t.datetime :confirmation_sent_at
26
+ # t.string :unconfirmed_email # Only if using reconfirmable
27
+
28
+ ## Lockable
29
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
31
+ # t.datetime :locked_at
32
+
33
+
34
+ t.timestamps null: false
35
+ end
36
+
37
+ add_index :users, :email, unique: true
38
+ add_index :users, :reset_password_token, unique: true
39
+ # add_index :users, :confirmation_token, unique: true
40
+ # add_index :users, :unlock_token, unique: true
41
+ end
42
+ end
@@ -0,0 +1,19 @@
1
+ class RolifyCreateRoles < ActiveRecord::Migration
2
+ def change
3
+ create_table(:roles) do |t|
4
+ t.string :name
5
+ t.references :resource, :polymorphic => true
6
+
7
+ t.timestamps
8
+ end
9
+
10
+ create_table(:users_roles, :id => false) do |t|
11
+ t.references :user
12
+ t.references :role
13
+ end
14
+
15
+ add_index(:roles, :name)
16
+ add_index(:roles, [ :name, :resource_type, :resource_id ])
17
+ add_index(:users_roles, [ :user_id, :role_id ])
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ class CreateGroups < ActiveRecord::Migration
2
+ def change
3
+ create_table :groups do |t|
4
+ t.string :title
5
+ t.string :slug, unique: true
6
+ t.text :description
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,6 @@
1
+ class AddDisplayNameColumnToUsers < ActiveRecord::Migration
2
+ def change
3
+ add_column :users, :display_name, :string
4
+ add_column :users, :slug, :string, unique: true
5
+ end
6
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from message_train (originally 20150721145319)
2
+ class CreateMessageTrainConversations < ActiveRecord::Migration
3
+ def change
4
+ create_table :message_train_conversations do |t|
5
+ t.string :subject
6
+
7
+ t.timestamps null: false
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from message_train (originally 20150721160322)
2
+ class CreateMessageTrainMessages < ActiveRecord::Migration
3
+ def change
4
+ create_table :message_train_messages do |t|
5
+ t.references :conversation, index: true, foreign_key: true
6
+ t.references :sender, polymorphic: true, index: true
7
+ t.text :recipients_to_save
8
+ t.string :subject
9
+ t.text :body
10
+ t.boolean :draft, default: false
11
+
12
+ t.timestamps null: false
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,11 @@
1
+ # This migration comes from message_train (originally 20150721161144)
2
+ class CreateMessageTrainAttachments < ActiveRecord::Migration
3
+ def change
4
+ create_table :message_train_attachments do |t|
5
+ t.references :message, index: true, foreign_key: true
6
+ t.attachment :attachment
7
+
8
+ t.timestamps null: false
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,17 @@
1
+ # This migration comes from message_train (originally 20150721161940)
2
+ class CreateMessageTrainReceipts < ActiveRecord::Migration
3
+ def change
4
+ create_table :message_train_receipts do |t|
5
+ t.references :recipient, polymorphic: true
6
+ t.references :message, index: true, foreign_key: true
7
+ t.boolean :marked_read, default: false
8
+ t.boolean :marked_trash, default: false
9
+ t.boolean :marked_deleted, default: false
10
+ t.boolean :sender, default: false
11
+
12
+ t.timestamps null: false
13
+ end
14
+
15
+ add_index :message_train_receipts, [:recipient_type, :recipient_id], name: :index_message_train_receipts_on_recipient
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # This migration comes from message_train (originally 20150721163838)
2
+ class CreateMessageTrainIgnores < ActiveRecord::Migration
3
+ def change
4
+ create_table :message_train_ignores do |t|
5
+ t.references :participant, polymorphic: true
6
+ t.references :conversation, index: true, foreign_key: true
7
+
8
+ t.timestamps null: false
9
+ end
10
+ add_index :message_train_ignores, [:participant_type, :participant_id], name: 'participant_index'
11
+ end
12
+ end