thredded 0.1.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (196) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.mkdn +202 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.mkdn +391 -0
  5. data/app/assets/images/thredded/breadcrumb-chevron.svg +1 -0
  6. data/app/assets/javascripts/thredded/currently_online.es6 +25 -0
  7. data/app/assets/javascripts/thredded/post_form.es6 +20 -0
  8. data/app/assets/javascripts/thredded/time_stamps.es6 +8 -0
  9. data/app/assets/javascripts/thredded/topic_form.es6 +55 -0
  10. data/app/assets/javascripts/thredded/users_select.es6 +5 -0
  11. data/app/assets/javascripts/thredded.es6 +10 -0
  12. data/app/assets/stylesheets/thredded/_base.scss +11 -0
  13. data/app/assets/stylesheets/thredded/_dependencies.scss +1 -0
  14. data/app/assets/stylesheets/thredded/_thredded.scss +27 -0
  15. data/app/assets/stylesheets/thredded/base/_alerts.scss +40 -0
  16. data/app/assets/stylesheets/thredded/base/_buttons.scss +39 -0
  17. data/app/assets/stylesheets/thredded/base/_forms.scss +79 -0
  18. data/app/assets/stylesheets/thredded/base/_grid.scss +19 -0
  19. data/app/assets/stylesheets/thredded/base/_lists.scss +31 -0
  20. data/app/assets/stylesheets/thredded/base/_tables.scss +25 -0
  21. data/app/assets/stylesheets/thredded/base/_typography.scss +36 -0
  22. data/app/assets/stylesheets/thredded/base/_variables.scss +54 -0
  23. data/app/assets/stylesheets/thredded/components/_base.scss +13 -0
  24. data/app/assets/stylesheets/thredded/components/_currently-online.scss +48 -0
  25. data/app/assets/stylesheets/thredded/components/_empty.scss +11 -0
  26. data/app/assets/stylesheets/thredded/components/_flash-message.scss +19 -0
  27. data/app/assets/stylesheets/thredded/components/_form-list.scss +35 -0
  28. data/app/assets/stylesheets/thredded/components/_main-section.scss +3 -0
  29. data/app/assets/stylesheets/thredded/components/_messageboard.scss +55 -0
  30. data/app/assets/stylesheets/thredded/components/_pagination.scss +26 -0
  31. data/app/assets/stylesheets/thredded/components/_post-form.scss +21 -0
  32. data/app/assets/stylesheets/thredded/components/_post.scss +66 -0
  33. data/app/assets/stylesheets/thredded/components/_preferences.scss +6 -0
  34. data/app/assets/stylesheets/thredded/components/_select2.scss +42 -0
  35. data/app/assets/stylesheets/thredded/components/_topic-delete.scss +9 -0
  36. data/app/assets/stylesheets/thredded/components/_topic-header.scss +20 -0
  37. data/app/assets/stylesheets/thredded/components/_topics.scss +113 -0
  38. data/app/assets/stylesheets/thredded/layout/_main-container.scss +15 -0
  39. data/app/assets/stylesheets/thredded/layout/_main-navigation.scss +45 -0
  40. data/app/assets/stylesheets/thredded/layout/_topic-navigation.scss +53 -0
  41. data/app/assets/stylesheets/thredded/layout/_user-navigation.scss +87 -0
  42. data/app/assets/stylesheets/thredded/utilities/_is-compact.scss +26 -0
  43. data/app/assets/stylesheets/thredded/utilities/_is-expanded.scss +16 -0
  44. data/app/assets/stylesheets/thredded.scss +3 -0
  45. data/app/commands/thredded/at_notification_extractor.rb +15 -0
  46. data/app/commands/thredded/members_marked_notified.rb +18 -0
  47. data/app/commands/thredded/messageboard_destroyer.rb +60 -0
  48. data/app/commands/thredded/notify_mentioned_users.rb +68 -0
  49. data/app/commands/thredded/notify_private_topic_users.rb +51 -0
  50. data/app/commands/thredded/user_reads_private_topic.rb +22 -0
  51. data/app/commands/thredded/user_resets_private_topic_to_unread.rb +23 -0
  52. data/app/controllers/thredded/application_controller.rb +105 -0
  53. data/app/controllers/thredded/messageboards_controller.rb +58 -0
  54. data/app/controllers/thredded/posts_controller.rb +78 -0
  55. data/app/controllers/thredded/preferences_controller.rb +28 -0
  56. data/app/controllers/thredded/private_topics_controller.rb +65 -0
  57. data/app/controllers/thredded/setups_controller.rb +53 -0
  58. data/app/controllers/thredded/theme_previews_controller.rb +59 -0
  59. data/app/controllers/thredded/topics_controller.rb +153 -0
  60. data/app/decorators/thredded/base_topic_decorator.rb +14 -0
  61. data/app/decorators/thredded/base_user_topic_decorator.rb +63 -0
  62. data/app/decorators/thredded/messageboard_decorator.rb +41 -0
  63. data/app/decorators/thredded/post_decorator.rb +40 -0
  64. data/app/decorators/thredded/private_topic_decorator.rb +23 -0
  65. data/app/decorators/thredded/topic_decorator.rb +25 -0
  66. data/app/decorators/thredded/topic_email_decorator.rb +24 -0
  67. data/app/decorators/thredded/user_private_topic_decorator.rb +13 -0
  68. data/app/decorators/thredded/user_topic_decorator.rb +37 -0
  69. data/app/forms/thredded/private_topic_form.rb +126 -0
  70. data/app/forms/thredded/topic_form.rb +94 -0
  71. data/app/helpers/thredded/application_helper.rb +41 -0
  72. data/app/jobs/thredded/activity_updater_job.rb +20 -0
  73. data/app/jobs/thredded/at_notifier_job.rb +11 -0
  74. data/app/jobs/thredded/notify_private_topic_users_job.rb +11 -0
  75. data/app/mailers/thredded/base_mailer.rb +4 -0
  76. data/app/mailers/thredded/post_mailer.rb +15 -0
  77. data/app/mailers/thredded/private_post_mailer.rb +15 -0
  78. data/app/mailers/thredded/private_topic_mailer.rb +15 -0
  79. data/app/models/concerns/thredded/post_common.rb +105 -0
  80. data/app/models/concerns/thredded/topic_common.rb +48 -0
  81. data/app/models/thredded/ability.rb +60 -0
  82. data/app/models/thredded/category.rb +12 -0
  83. data/app/models/thredded/messageboard.rb +50 -0
  84. data/app/models/thredded/messageboard_user.rb +12 -0
  85. data/app/models/thredded/notification_preference.rb +17 -0
  86. data/app/models/thredded/null_preference.rb +11 -0
  87. data/app/models/thredded/null_topic.rb +15 -0
  88. data/app/models/thredded/null_topic_read.rb +19 -0
  89. data/app/models/thredded/null_user.rb +51 -0
  90. data/app/models/thredded/post.rb +37 -0
  91. data/app/models/thredded/post_notification.rb +17 -0
  92. data/app/models/thredded/private_post.rb +25 -0
  93. data/app/models/thredded/private_topic.rb +60 -0
  94. data/app/models/thredded/private_user.rb +6 -0
  95. data/app/models/thredded/stats.rb +37 -0
  96. data/app/models/thredded/topic.rb +104 -0
  97. data/app/models/thredded/topic_category.rb +6 -0
  98. data/app/models/thredded/user_detail.rb +26 -0
  99. data/app/models/thredded/user_extender.rb +33 -0
  100. data/app/models/thredded/user_permissions/admin/if_admin_column_true.rb +12 -0
  101. data/app/models/thredded/user_permissions/admin/none.rb +12 -0
  102. data/app/models/thredded/user_permissions/message/readers_of_writeable_boards.rb +13 -0
  103. data/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb +25 -0
  104. data/app/models/thredded/user_permissions/moderate/none.rb +25 -0
  105. data/app/models/thredded/user_permissions/read/all.rb +25 -0
  106. data/app/models/thredded/user_permissions/write/all.rb +25 -0
  107. data/app/models/thredded/user_permissions/write/none.rb +25 -0
  108. data/app/models/thredded/user_preference.rb +6 -0
  109. data/app/models/thredded/user_topic_read.rb +10 -0
  110. data/app/views/layouts/thredded/application.html.erb +15 -0
  111. data/app/views/thredded/categories/_category.html.erb +1 -0
  112. data/app/views/thredded/kaminari/_first_page.html.erb +11 -0
  113. data/app/views/thredded/kaminari/_gap.html.erb +8 -0
  114. data/app/views/thredded/kaminari/_last_page.html.erb +11 -0
  115. data/app/views/thredded/kaminari/_next_page.html.erb +11 -0
  116. data/app/views/thredded/kaminari/_page.html.erb +12 -0
  117. data/app/views/thredded/kaminari/_paginator.html.erb +23 -0
  118. data/app/views/thredded/kaminari/_prev_page.html.erb +11 -0
  119. data/app/views/thredded/messageboards/_messageboard.html.erb +15 -0
  120. data/app/views/thredded/messageboards/index.html.erb +20 -0
  121. data/app/views/thredded/messageboards/new.html.erb +18 -0
  122. data/app/views/thredded/post_mailer/at_notification.html.erb +14 -0
  123. data/app/views/thredded/post_mailer/at_notification.text.erb +10 -0
  124. data/app/views/thredded/posts/_content_field.html.erb +4 -0
  125. data/app/views/thredded/posts/_form.html.erb +1 -0
  126. data/app/views/thredded/posts/_post.html.erb +1 -0
  127. data/app/views/thredded/posts/_user.html.erb +3 -0
  128. data/app/views/thredded/posts/edit.html.erb +13 -0
  129. data/app/views/thredded/posts_common/_form.html.erb +10 -0
  130. data/app/views/thredded/posts_common/_post.html.erb +20 -0
  131. data/app/views/thredded/preferences/_form.html.erb +28 -0
  132. data/app/views/thredded/preferences/_header.html.erb +1 -0
  133. data/app/views/thredded/preferences/edit.html.erb +12 -0
  134. data/app/views/thredded/private_post_mailer/at_notification.html.erb +11 -0
  135. data/app/views/thredded/private_posts/_form.html.erb +1 -0
  136. data/app/views/thredded/private_posts/_private_post.html.erb +1 -0
  137. data/app/views/thredded/private_topic_mailer/message_notification.html.erb +17 -0
  138. data/app/views/thredded/private_topic_mailer/message_notification.text.erb +13 -0
  139. data/app/views/thredded/private_topics/_breadcrumbs.html.erb +4 -0
  140. data/app/views/thredded/private_topics/_form.html.erb +24 -0
  141. data/app/views/thredded/private_topics/_no_private_topics.html.erb +6 -0
  142. data/app/views/thredded/private_topics/_private_topic.html.erb +22 -0
  143. data/app/views/thredded/private_topics/index.html.erb +23 -0
  144. data/app/views/thredded/private_topics/new.html.erb +13 -0
  145. data/app/views/thredded/private_topics/show.html.erb +14 -0
  146. data/app/views/thredded/search/_form.html.erb +7 -0
  147. data/app/views/thredded/shared/_currently_online.html.erb +16 -0
  148. data/app/views/thredded/shared/_flash_messages.html.erb +7 -0
  149. data/app/views/thredded/shared/_header.html.erb +4 -0
  150. data/app/views/thredded/shared/_messageboard_topics_breadcrumbs.html.erb +6 -0
  151. data/app/views/thredded/shared/_notification_preferences.html.erb +7 -0
  152. data/app/views/thredded/shared/_page.html.erb +6 -0
  153. data/app/views/thredded/shared/_time_ago.html.erb +7 -0
  154. data/app/views/thredded/shared/_top_nav.html.erb +36 -0
  155. data/app/views/thredded/shared/_topic_nav.html.erb +22 -0
  156. data/app/views/thredded/theme_previews/_section_title.html.erb +3 -0
  157. data/app/views/thredded/theme_previews/show.html.erb +108 -0
  158. data/app/views/thredded/topics/_form.html.erb +23 -0
  159. data/app/views/thredded/topics/_recent_topics_by_user.html.erb +8 -0
  160. data/app/views/thredded/topics/_topic.html.erb +29 -0
  161. data/app/views/thredded/topics/_topic_form_admin_options.html.erb +12 -0
  162. data/app/views/thredded/topics/by_category.html.erb +56 -0
  163. data/app/views/thredded/topics/edit.html.erb +38 -0
  164. data/app/views/thredded/topics/index.html.erb +18 -0
  165. data/app/views/thredded/topics/menu/_new_topic.html.erb +3 -0
  166. data/app/views/thredded/topics/new.html.erb +11 -0
  167. data/app/views/thredded/topics/search.html.erb +9 -0
  168. data/app/views/thredded/topics/show.html.erb +31 -0
  169. data/app/views/thredded/topics_common/_header.html.erb +6 -0
  170. data/app/views/thredded/users/_link.html.erb +9 -0
  171. data/config/routes.rb +28 -0
  172. data/db/migrate/20160329231848_create_thredded.rb +173 -0
  173. data/lib/generators/thredded/install/USAGE +13 -0
  174. data/lib/generators/thredded/install/install_generator.rb +23 -0
  175. data/lib/generators/thredded/install/templates/initializer.rb +51 -0
  176. data/lib/html/pipeline/at_mention_filter.rb +20 -0
  177. data/lib/html/pipeline/bbcode_filter.rb +19 -0
  178. data/lib/tasks/thredded_tasks.rake +18 -0
  179. data/lib/thredded/at_users.rb +19 -0
  180. data/lib/thredded/engine.rb +35 -0
  181. data/lib/thredded/errors.rb +67 -0
  182. data/lib/thredded/main_app_route_delegator.rb +24 -0
  183. data/lib/thredded/messageboard_user_permissions.rb +22 -0
  184. data/lib/thredded/post_sql_builder.rb +12 -0
  185. data/lib/thredded/post_user_permissions.rb +32 -0
  186. data/lib/thredded/private_topic_user_permissions.rb +26 -0
  187. data/lib/thredded/search_parser.rb +45 -0
  188. data/lib/thredded/search_sql_builder.rb +21 -0
  189. data/lib/thredded/seed_database.rb +76 -0
  190. data/lib/thredded/table_sql_builder.rb +41 -0
  191. data/lib/thredded/topic_sql_builder.rb +11 -0
  192. data/lib/thredded/topic_user_permissions.rb +32 -0
  193. data/lib/thredded/version.rb +3 -0
  194. data/lib/thredded.rb +85 -0
  195. data/thredded.gemspec +68 -0
  196. metadata +248 -122
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d30782583b8a9e0e3a0119d15b36e3393b8a4204
4
- data.tar.gz: b92bc0203052d8c22a2a172edfab1be764c948d1
3
+ metadata.gz: bdc0bf6e1d3f247baed2faa7a7a4250f28d8f86a
4
+ data.tar.gz: f0b738be8742980e4758c9f4514eb75439f77e2c
5
5
  SHA512:
6
- metadata.gz: 0eec98398aa948df84f33fcc968a00004d8370718bce9dff87749dcb5aa55021c41c71fe6ed9a9b04ddc441d17a3ef0af3455707670c05c9cb1d0a661e923a10
7
- data.tar.gz: 833718abdf8cbd86323d4e54f23f998e22ae78673ce56e7c72d96c7be2830461031c86113a315d4ee6ccce1b6e1b0e0cbd051bd23e11387e05d9043dc6ddeca0
6
+ metadata.gz: 7e2d79cc9507fe73ce4fd3c373bb0517da2e4cd1147a347a16c2653453a903f4d7de8ae0ee4ea070cc3004afea220de682ae489a964ffe98669b351368fbf553
7
+ data.tar.gz: 07cf1575cd4cf81cd5eb601a709ce556183cf0e54f3f03f67d58bfbe4b43a43fb2aa50eab19650fea02d8910237e2654759c5a7bd1fc5d3aa79fcff69bd939c0
data/CHANGELOG.mkdn ADDED
@@ -0,0 +1,202 @@
1
+ # MASTER
2
+
3
+ # 0.2.2 - 2016-04-04
4
+
5
+ ## Fixed
6
+
7
+ * Gemspec had been missing the file-listing for a while therefore previous gem versions would have
8
+ had installation issues. To use previous, broken, versions refer to the changelog notes for each
9
+ below.
10
+ * Images are now no larger than the post container div. CSS now makes sure the images are
11
+ appropriately sized.
12
+ * Fix an incorrectly closed div in `thredded/topics#show`
13
+ * Small fix for topics count circle - making sure 3 digit numbers fit in container circle.
14
+
15
+ ## Added
16
+
17
+ * Rake task added to copy emojis to correct location in parent application.
18
+ * Properly styled categories in `thredded/topics#index`
19
+
20
+
21
+ # 0.2.1 - 2016-04-03
22
+
23
+ To install, in your Gemfile:
24
+
25
+ ```
26
+ gem 'thredded', git: 'https://github.com/thredded/thredded.git', tag: 'v0.2.1'
27
+ ```
28
+
29
+ ## Changed
30
+
31
+ * All migrations have been squashed into one single db-agnostic migration.
32
+ * README has been updated with better instructions/support
33
+
34
+ # 0.2.0 - 2016-04-03
35
+
36
+ To install, in your Gemfile:
37
+
38
+ ```
39
+ gem 'thredded', git: 'https://github.com/thredded/thredded.git', tag: 'v0.2.0'
40
+ ```
41
+
42
+ ## TLDR
43
+
44
+ A lot was updated. Apologies for not keeping this updated since `0.1.0`!
45
+
46
+ ## Added
47
+
48
+ * Entirely new default theme. Courtesy @kylefiedler
49
+ * Full-text search abstracted out to gem (db_text_search) thanks to @glebm
50
+ * Rack-mini-profiler added to dummy app
51
+
52
+ ## Changed
53
+
54
+ * Rails depedency bumped up to raisl 4.1+
55
+ * User permissions have been simplified considerably. (@glebm)
56
+ * Changed from using Q gem to ActiveJob
57
+ * Move SeedDatabase class out of an autoloaded path since it's for dev only (@cgunther)
58
+
59
+
60
+ ## Fixed
61
+
62
+ * User path corrected (@saturnflyer)
63
+ * Move requiring turbolinks from thredded to dummy app (@cgunther)
64
+ * Fix location of layout in install generator (@mlaco)
65
+
66
+ ##
67
+
68
+ # 0.1.0 - 2015-06-29
69
+
70
+ ## Added
71
+
72
+ * Rake task to spin up a web server using the dummy application
73
+ * Rake task to assign user to a superadmin role
74
+ * A relatively large effort was put in effect for 0.1.0 to provide more thorough support for themes, new css and design, a small bit of javascript.
75
+ * Views have had a nice overhaul.
76
+ * Provide a generator that installs the default theme and integrates the associated css framework (if necessary). In the first theme we're using bourbon and neat. In the future - probably including foundation and bootstrap.
77
+ * Add a Dockerfile and docker-compose.yml to aid in getting a fully working instance of the thredded dummy app up and running.
78
+ * Instead of having a messageboard "setup" controller that is only available on the first run of the gem, move it over to `messageboards#new`.
79
+
80
+ ## Changed
81
+
82
+ * Instead of creating a messageboard only once, allow superadmins to create new messageboards whenever through the messageboards resource.
83
+ * Use Puma instead of Webrick for the dev server
84
+ * Oft-used form elements (topics, posts) use the required html attribute.
85
+
86
+ ## Fixed
87
+
88
+ * Remove Gemfile.lock from the repo
89
+ * Active users now shows the current user in addition to everyone else on the first (without having to refresh).
90
+
91
+
92
+ # 0.0.14
93
+
94
+ ## Changed
95
+
96
+ * Until this release PrivateTopic inherited from Topic and used STI to reuse that table. Over time this led to some intermingling of concerns and more than the occasional shotgun surgery. As of now the Topic class has been split into Topic AND PrivateTopic, each with their own table.
97
+ * Provide means to display, or inspect, the unread private topics count. This now allows us to see if there are any private topics that one has not read.
98
+ * Add queue support for multiple background job libraries using the Q gem. Previous to now the only instances where we really cared about shoving something in the background was when we sent out mail - this is a bit myopic. There are several cases where some processes could/should be put into the background - hence needing a queue. The explicit requirement of a specific queue library is something we should avoid so the Q gem was pulled in to provide the abstraction layer that allows one of several libraries to be used - resque, sidekiq, delayed_job, or, the default, an in-memory threaded queue.
99
+ * Update rails dependency from `'~> 4.0.0'` to `'>= 4.0.0'`
100
+ * Replace nested forms with form objects
101
+ * Remove unused columns in tables - `state` from `thredded_topics`.
102
+ * Link to user from post on topic page (thanks @taylorkearns!)
103
+
104
+ ## Fixed
105
+
106
+ * Fix issue where post did not inherit the test filter set per messagebard
107
+ * Building a new post for reply form must use the parent messageboard filter
108
+
109
+ # 0.0.13
110
+
111
+ ## Fixed
112
+
113
+ * Users' messageboard preferences are created if one does not exist for a given messageboard. This had caused people who had not updated their own preferences to NOT receive @ notifications by default. As of this release they will, by default, receive @'s and private thread notifications until they change their preferences.
114
+
115
+ ## Changed
116
+
117
+ * A topic's categories can now be rendered in the view. `categories/category` partial addded.
118
+ * Adding attachments to a post has been removed. (Attachment model and association will be removed in 0.0.15)
119
+
120
+ # 0.0.12
121
+
122
+ ## Fixed
123
+
124
+ * Requiring the sql search builder explicitly fixes the issue where anonymous visitors would not be able to search
125
+ * Users, when they edit a topic they started, should not be able to pin/lock it. This has been changed to only allow admins to do so.
126
+ * bbcode now renders line-breaks
127
+ * html is now better sanitized
128
+
129
+ ## Changed
130
+
131
+ * Replace the previously used inheritance-based filter chain with
132
+ [html-pipeline](https://github.com/jch/html-pipeline). Much better.
133
+ * Replace bb-ruby with bbcoder gem.
134
+ * Replace `redcarpet` with `github-markdown`
135
+ * Provide a more explicit contract between the gem and the parent application with regards to the layout the thredded views will render within
136
+ * `:thredded_page_title` and `:thredded_page_id` provided as content blocks that may be yielded to the layout
137
+ * Allow gravatar image to be overridden in the config
138
+ * Thredded::PostDecorator#user_link now available for use in post-related views
139
+
140
+ # 0.0.11
141
+
142
+ ## Feature / Bug Fix
143
+
144
+ * Up until now the manner by which file uploads (via Carrierwave) had its storage
145
+ location determined was in the uploaded classes themselves. This commit allows the
146
+ location to be set from the Thredded module itself - `Thredded.file_storage` - to
147
+ either :file or :fog.
148
+
149
+ # 0.0.10
150
+
151
+ ## Fixed
152
+
153
+ * Fixed: private topics not being created correctly
154
+ * Test coverage for above
155
+
156
+ # 0.0.8
157
+
158
+ ## Fixed
159
+
160
+ * Make sure messageboard slug is populated upon creation
161
+
162
+ ## Changed
163
+
164
+ * Refactor controllers for a little more cleanliness
165
+ * Exceptions raised and caught instead of asking for existence of objects
166
+ * Update pagination path format
167
+
168
+ # 0.0.7
169
+
170
+ ## Fixed
171
+
172
+ * Get search back to working
173
+
174
+ # 0.0.6
175
+
176
+ ## Changed
177
+
178
+ * Update rails dependency in gemspec to use a `~>` instead of `>=`
179
+
180
+ ## Fixed
181
+
182
+ * Fix `convert_textile_to_markdown` migration to use proper sql syntax
183
+
184
+ # 0.0.5
185
+
186
+ ## New Features
187
+
188
+ * A CHANGELOG!
189
+
190
+ ## Fixed
191
+
192
+ * Fix `PostsController#topic` to ensure the `user_topic_reads` association is eager loaded
193
+ * Make that `topic` method pass along to an obviously named and intention revealing method
194
+ * Delete the filter select from `posts/_form` partial
195
+ * require `thredded/at_notifier` in `thredded.rb` (thanks @srussking)
196
+
197
+ ## Changed
198
+
199
+ * Introduce a more robust `MessageboardDecorator`
200
+ * Allow `messagebord` obj or collection to be decorated with `#decorate` method
201
+ * Introduce `NullTopic` to stand in for instances where a topic is not found
202
+ * remove `rspec/autorun` from `spec_helper`
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2013 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.mkdn ADDED
@@ -0,0 +1,391 @@
1
+ # Thredded [![Code Climate](https://codeclimate.com/github/thredded/thredded/badges/gpa.svg)](https://codeclimate.com/github/thredded/thredded) [![Travis-CI](https://api.travis-ci.org/thredded/thredded.svg?branch=master)](https://travis-ci.org/thredded/thredded/) [![Test Coverage](https://codeclimate.com/github/thredded/thredded/badges/coverage.svg)](https://codeclimate.com/github/thredded/thredded/coverage) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/thredded/thredded?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2
+
3
+ _Thredded_ is a Rails 4.1+ forum/messageboard engine. Its goal is to be as simple and feature rich as possible.
4
+
5
+ Some of the features currently in Thredded:
6
+
7
+ * Markdown post formatting (by default).
8
+ * (Un)read posts tracking.
9
+ * Email notifications, @-mentions, per-messageboard notification settings.
10
+ * Private group messaging.
11
+ * Full-text search using the database.
12
+ * Pinned and locked topics.
13
+ * List of currently online users, for all forums and per-messageboard.
14
+ * Flexible permissions system.
15
+ * Lightweight default theme configurable via Sass.
16
+
17
+ Planned features:
18
+
19
+ * Flexible moderation system with per-messageboard settings. #45
20
+
21
+ <a href='https://pledgie.com/campaigns/27480'><img alt='Click here to lend your support to: Thredded and make a donation at pledgie.com !' src='https://pledgie.com/campaigns/27480.png?skin_name=chrome' border='0' ></a>
22
+
23
+ <img src="http://emoji.fileformat.info/gemoji/point_up.png" width="24"> If you are so inclined, donating to the project will help aid in its development
24
+
25
+ [Discourse]: http://www.discourse.org/
26
+ [Forem]: https://www.github.com/radar/forem
27
+
28
+ Thredded works with SQLite, MySQL (v5.6.4+), and PostgreSQL. Thredded has no infrastructure
29
+ dependencies other than the database and, if configured in the parent application, the ActiveJob
30
+ backend dependency such as Redis. Currently only MRI Ruby 2.2+ is supported. We would love to
31
+ support JRuby and Rubinius as well.
32
+
33
+ If you're looking for variations on a theme - see [Forem] and [Discourse]. Forem is also an engine,
34
+ while Discourse is a full app.
35
+
36
+ ## Installation
37
+
38
+ Add the gem to your Gemfile:
39
+
40
+ ```ruby
41
+ gem 'thredded', github: 'thredded/thredded'
42
+ ```
43
+
44
+ Add the Thredded [initializer] to your parent app by running the install generator.
45
+
46
+ ```console
47
+ rails generate thredded:install
48
+ ```
49
+
50
+ Copy emoji images to your `public/emoji` directory.
51
+
52
+ ```console
53
+ rake thredded:install:emoji
54
+ ```
55
+
56
+ Thredded needs to know the base application User model name and certain columns on it. Configure
57
+ these in the initializer installed with the command above.
58
+
59
+ Then, copy the migrations over to your parent application and migrate:
60
+
61
+ ```console
62
+ rake thredded:install:migrations db:migrate db:test:prepare
63
+ ```
64
+
65
+ Mount the thredded engine in your routes file:
66
+
67
+ ```ruby
68
+ mount Thredded::Engine => '/forum'
69
+ ```
70
+
71
+ Add thredded styles to your `application.scss` (see below for customizing the styles):
72
+
73
+ ```scss
74
+ @import "thredded";
75
+ ```
76
+
77
+ Include thredded JavaScripts in your `application.js`:
78
+
79
+ ```js
80
+ //= require thredded
81
+ ```
82
+
83
+ [initializer]: https://github.com/thredded/thredded/blob/master/lib/generators/thredded/install/templates/initializer.rb
84
+
85
+ ## Theming
86
+
87
+ The engine comes by default with a light and effective implementation of the
88
+ views, styles, and javascript. Once you mount the engine you will be presented
89
+ with a "themed" version of thredded.
90
+
91
+ ### Styles
92
+
93
+ Thredded comes with a light Sass theme controlled by a handful of variables that can be found here:
94
+ https://github.com/thredded/thredded/blob/master/app/assets/stylesheets/thredded/base/_variables.scss.
95
+
96
+ To override the styles, override the variables *before* importing Thredded styles, e.g.:
97
+
98
+ ```scss
99
+ // application.scss
100
+ $thredded-brand: #9c27b0;
101
+ @import "thredded";
102
+ ```
103
+
104
+ The `@import "thredded"` directive above will import thredded styles and the [dependencies][thredded-scss-dependencies]
105
+ (currently just "select2" from [select2-rails]). If you already include your own styles for any of thredded
106
+ dependencies, you can import just the thredded styles alone like this:
107
+
108
+ ```scss
109
+ // application.scss
110
+ @import "thredded/thredded";
111
+ ```
112
+
113
+ If you are writing a Thredded plugin, import the [`thredded/base`][thredded-scss-base] Sass package instead.
114
+ The `base` package only defines variables, mixins, and %-placeholders, so it can be imported safely without producing
115
+ any duplicate CSS.
116
+
117
+ [thredded-scss-dependencies]: https://github.com/thredded/thredded/blob/master/app/assets/stylesheets/thredded/_dependencies.scss
118
+ [select2-rails]: https://github.com/argerim/select2-rails
119
+ [thredded-scss-base]: https://github.com/thredded/thredded/blob/master/app/assets/stylesheets/thredded/_base.scss
120
+
121
+ ### Views and other assets
122
+
123
+ By default, thredded renders in its own layout, but you can easily override this by setting `Thredded.layout` in the
124
+ initializer.
125
+
126
+ You can also override any views and assets by placing them in the same path in your application as they are in the gem.
127
+ This uses the [standard Rails mechanism](http://guides.rubyonrails.org/engines.html#overriding-views) for overriding
128
+ engine views. For example, to copy the post view for customization:
129
+
130
+ ```bash
131
+ # Copy the post view into the application to customize it:
132
+ mkdir -p app/views/thredded/posts && cp "$(bundle show thredded)/$_/_post.html.erb" "$_"
133
+ ```
134
+
135
+ **NB:** Overriding the views like this means that on every update of the thredded gem you have to check that your
136
+ customizations are still compatible with the new version of thredded. This is difficult and error-prone.
137
+ Whenever possible, use the styles and i18n to customize Thredded to your needs.
138
+
139
+ Thredded views also provide two content_tags available to yield - `:thredded_page_title` and `:thredded_page_id`.
140
+ The views within Thredded pass those up through to your layout if you would like to use them.
141
+
142
+ ## Permissions
143
+
144
+ Thredded comes with a flexible permissions system that can be configured per messageboard/user.
145
+ It calls a handful of methods on the application `User` model to determine permissions for logged in users, and calls
146
+ the same methods on `Thredded:NullUser` to determine permissions for non-logged in users.
147
+
148
+ ### Permission methods
149
+
150
+ The methods used by Thredded for determining the permissions are described below.
151
+
152
+ * To customize permissions for logged in users, override any of the methods below on your `User` model.
153
+ * To customize permissions for non-logged in users, override these methods on `Thredded::NullUser`.
154
+
155
+ #### Reading messageboards
156
+
157
+ 1. A list of messageboards that a given user can read:
158
+
159
+ ```ruby
160
+ # @return [ActiveRecord::Relation] messageboards that the user can read
161
+ thredded_can_read_messageboards
162
+ ```
163
+ 2. A list of users that can read a given list of messageboards:
164
+
165
+ ```ruby
166
+ # @param messageboards [Array<Thredded::Messageboard>]
167
+ # @return [ActiveRecord::Relation] users that can read the given messageboards
168
+ self.thredded_messageboards_readers(messageboards)
169
+ ```
170
+
171
+ #### Posting to messageboards
172
+
173
+ 1. A list of messageboards that a given user can post in.
174
+
175
+ ```ruby
176
+ # @return [ActiveRecord::Relation<Thredded::Messageboard>] messageboards that the user can post in
177
+ thredded_can_write_messageboards
178
+ ```
179
+
180
+ 2. A list of users that can post to a given list of messageboards.
181
+
182
+ ```ruby
183
+ # @param messageboards [Array<Thredded::Messageboard>]
184
+ # @return [ActiveRecord::Relation<User>] users that can post to the given messageboards
185
+ self.thredded_messageboards_writers(messageboards)
186
+ ```
187
+
188
+ #### Messaging other users (posting to private topics)
189
+
190
+ A list of users a given user can message:
191
+
192
+ ```ruby
193
+ # @return [ActiveRecord::Relation] the users this user can include in a private topic
194
+ thredded_can_message_users
195
+ ```
196
+
197
+ #### Moderating messageboards
198
+
199
+ 1. A list of messageboards that a given user can moderate:
200
+
201
+ ```ruby
202
+ # @return [ActiveRecord::Relation<Thredded::Messageboard>] messageboards that the user can moderate
203
+ thredded_can_moderate_messageboards
204
+ ```
205
+ 2. A list of users that can moderate a given list of messageboards:
206
+
207
+ ```ruby
208
+ # @param messageboards [Array<Thredded::Messageboard>]
209
+ # @return [ActiveRecord::Relation<User>] users that can moderate the given messageboards
210
+ self.thredded_messageboards_moderators(messageboards)
211
+ ```
212
+
213
+ #### Admin permissions
214
+
215
+ Includes all of the above for all messageboards:
216
+
217
+ ```ruby
218
+ # @return [boolean] Whether this user has full admin rights on Thredded
219
+ thredded_admin?
220
+ ```
221
+
222
+ ### Default permissions
223
+
224
+ Below is an overview of the default permissions, with links to the implementations:
225
+
226
+ <table>
227
+ <thead>
228
+ <tr>
229
+ <th align="center"></th>
230
+ <th align="center">Read</th>
231
+ <th align="center">Post</th>
232
+ <th align="center">Message</th>
233
+ <th align="center">Moderate</th>
234
+ <th align="center">Administrate</th>
235
+ </tr>
236
+ </thead>
237
+ <tbody>
238
+ <tr>
239
+ <th align="center">Logged in</th>
240
+ <td align="center" rowspan="2"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/read/all.rb">
241
+ ✅ All
242
+ </a></td>
243
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/write/all.rb">
244
+ ✅ All
245
+ </a></td>
246
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/message/readers_of_writeable_boards.rb">
247
+ Readers of the messageboards<br>the user can post in
248
+ </a></td>
249
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/moderate/if_moderator_column_true.rb">
250
+ <code>moderator_column</code>
251
+ </a></td>
252
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/admin/if_admin_column_true.rb">
253
+ <code>admin_column</code>
254
+ </a></td>
255
+ </tr>
256
+ <tr>
257
+ <th align="center">Not logged in</th>
258
+ <!-- rowspan -->
259
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/write/none.rb">
260
+ ❌ No
261
+ </a></td>
262
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/message/none.rb">
263
+ ❌ No
264
+ </a></td>
265
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/moderate/none.rb">
266
+ ❌ No
267
+ </a></td>
268
+ <td align="center"><a href="https://github.com/thredded/thredded/blob/master/app/models/thredded/user_permissions/admin/none.rb">
269
+ ❌ No
270
+ </a></td>
271
+ </tr>
272
+ </tbody>
273
+ </table>
274
+
275
+ ### Handling "Permission denied"
276
+
277
+ Thredded defines a number of Exception classes that you can `[rescue_from]` in your `ApplicationController`
278
+ to handle permission denied errors.
279
+
280
+ These are:
281
+
282
+ * `Thredded::Errors::MessageboardNotFound`.
283
+ * `Thredded::Errors::MessageboardReadDenied`.
284
+ * `Thredded::Errors::TopicCreateDenied`.
285
+ * `Thredded::Errors::MessageboardCreateDenied`.
286
+ * `Thredded::Errors::PrivateTopicCreateDenied`.
287
+ * `CanCan::AccessDenied` - all the other errors.
288
+
289
+ Currently, the default behaviour is to redirect to the forums root page with a flash alert.
290
+
291
+ [rescue_from]: http://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html
292
+
293
+ ## Rails 4.1 and ActiveJob Support
294
+
295
+ If you're currently using Rails 4.1 make sure to add ...
296
+
297
+ ```ruby
298
+ gem 'activejob_backport'
299
+ ```
300
+
301
+ ... to your Gemfile. ActiveJob is now the main background job abstraction layer in Thredded.
302
+ It was not introduced to rails until 4.2 so you'll need the backport to provide the support for it.
303
+
304
+ ## Development
305
+
306
+ To be more clear - this is the for when you are working on *this* gem.
307
+ Not for when you are implementing it into your Rails app.
308
+
309
+ First, to get started, migrate and seed the database (SQLite by default):
310
+
311
+ ```bash
312
+ bundle
313
+ rake db:migrate
314
+ # Seed the development database with fake forum users, topics, and posts:
315
+ rake dev:seed
316
+ ```
317
+
318
+ Then, start the dummy app server:
319
+
320
+ ```bash
321
+ rake dev:server
322
+ ```
323
+
324
+ To run the tests, just run `rspec`. The test suite will re-create the test database on every run, so there is no need to
325
+ run tasks that maintain the test database.
326
+
327
+ Run `rubocop` to ensure a consistent code style across the codebase.
328
+
329
+ By default, SQLite is used in development and test. On Travis, the tests will run using SQLite, PostgreSQL, SQLite,
330
+ and all the supported Rails versions.
331
+
332
+ ### Testing with all the databases and Rails versions locally.
333
+
334
+ You can also test the gem with all the supported databases and Rails versions locally.
335
+
336
+ First install PostgreSQL and MySQL, and run:
337
+
338
+ ```bash
339
+ script/create-db-users
340
+ ```
341
+
342
+ Then, to test with all the databases and the default Rails version (as defined in `Gemfile`), run:
343
+
344
+ ```bash
345
+ rake test_all_dbs
346
+ ```
347
+
348
+ To test with a specific database and all the Rails versions, run:
349
+
350
+ ```bash
351
+ # Test with SQLite3:
352
+ rake test_all_gemfiles
353
+ # Test with MySQL:
354
+ DB=mysql2 rake test_all_gemfiles
355
+ # Test with PostgreSQL:
356
+ DB=postgresql rake test_all_gemfiles
357
+ ```
358
+
359
+ To test all combinations of supported databases and Rails versions, run:
360
+
361
+ ```bash
362
+ rake test_all
363
+ ```
364
+
365
+ ## Developing and Testing with [Docker Compose](http://docs.docker.com/compose/)
366
+
367
+ To quickly try out _Thredded_ with the included dummy app, clone the source and
368
+ start the included docker-compose.yml file with:
369
+
370
+ ```console
371
+ docker-compose build
372
+ docker-compose up -d
373
+ ```
374
+
375
+ The above will build and run everything, daemonized, resulting in a running
376
+ instance on port 9292. Running `docker-compose logs` will let you know when
377
+ everything is up and running. Editing the source on your host machine will
378
+ be reflected in the running docker'ized application.
379
+
380
+ Note that when using [boot2docker](https://github.com/boot2docker/boot2docker)
381
+ on a Mac make sure you visit the boot2docker host ip at
382
+ `http://$(boot2docker ip):9292`.
383
+
384
+ After booting up the containers you can run the test suite with the following:
385
+
386
+ ```console
387
+ docker-compose run web bundle exec rake
388
+ ```
389
+
390
+ The docker container uses PostgreSQL.
391
+
@@ -0,0 +1 @@
1
+ <svg width="7" height="11" viewBox="0 0 7 11" xmlns="http://www.w3.org/2000/svg"><title>breadcrumb-chevron</title><desc>Created with Sketch.</desc><g fill="none" fill-rule="evenodd"><g fill="#B0AEBC"><path d="M1.96.19c-.19-.198-.497-.198-.685 0L.592.91c-.19.197-.19.518 0 .715l3.295 3.405L.564 8.462c-.19.198-.19.518 0 .716l.684.717c.188.197.494.197.684 0l4.35-4.508c.187-.2.187-.52 0-.717L1.958.19"/></g></g></svg>
@@ -0,0 +1,25 @@
1
+ (function($) {
2
+ const COMPONENT_SELECTOR = '[data-thredded-currently-online]';
3
+
4
+ class ThreddedCurrentlyOnline {
5
+ init($nodes) {
6
+ $($nodes).
7
+ on('mouseenter', function(e) {
8
+ $(this).addClass('thredded--is-expanded');
9
+ }).
10
+ on('mouseleave', function(e) {
11
+ $(this).removeClass('thredded--is-expanded');
12
+ }).
13
+ on('touchstart', function(e) {
14
+ $(this).toggleClass('thredded--is-expanded');
15
+ });
16
+ }
17
+ }
18
+
19
+ $(function() {
20
+ var $nodes = $(COMPONENT_SELECTOR);
21
+ if ($nodes.length) {
22
+ new ThreddedCurrentlyOnline().init($nodes);
23
+ }
24
+ });
25
+ })(jQuery);
@@ -0,0 +1,20 @@
1
+ (function($) {
2
+ const COMPONENT_SELECTOR = '[data-thredded-post-form]';
3
+
4
+ class ThreddedPostForm {
5
+ constructor() {
6
+ this.textareaSelector = 'textarea';
7
+ }
8
+
9
+ init($nodes) {
10
+ $nodes.find(this.textareaSelector).autosize();
11
+ }
12
+ }
13
+
14
+ $(function() {
15
+ var $nodes = $(COMPONENT_SELECTOR);
16
+ if ($nodes.length) {
17
+ new ThreddedPostForm().init($nodes);
18
+ }
19
+ });
20
+ })(jQuery);
@@ -0,0 +1,8 @@
1
+ jQuery(function($) {
2
+ const COMPONENT_SELECTOR = '#thredded--container abbr.timeago';
3
+
4
+ var allowFutureWas = jQuery.timeago.settings.allowFuture;
5
+ $.timeago.settings.allowFuture = true;
6
+ $(COMPONENT_SELECTOR).timeago();
7
+ $.timeago.settings.allowFuture = allowFutureWas;
8
+ });