proclaim 0.5.6 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (236) hide show
  1. checksums.yaml +5 -5
  2. data/Rakefile +5 -38
  3. data/app/assets/config/proclaim_manifest.js +2 -0
  4. data/app/assets/images/{ajax_loader.gif → proclaim/ajax_loader.gif} +0 -0
  5. data/app/assets/javascripts/proclaim.js +7 -7
  6. data/app/assets/javascripts/proclaim/{comments_handler.js.coffee → comments_handler.coffee} +16 -10
  7. data/app/assets/javascripts/proclaim/editor.coffee +55 -0
  8. data/app/assets/stylesheets/{proclaim.css.scss → proclaim.scss} +7 -8
  9. data/app/assets/stylesheets/proclaim/{comments.css.scss → comments.scss} +0 -0
  10. data/app/assets/stylesheets/proclaim/{posts.css.scss → posts.scss} +60 -25
  11. data/app/assets/stylesheets/proclaim/{subscriptions.css.scss → subscriptions.scss} +0 -0
  12. data/app/controllers/proclaim/application_controller.rb +60 -56
  13. data/app/controllers/proclaim/comments_controller.rb +13 -42
  14. data/app/controllers/proclaim/posts_controller.rb +25 -57
  15. data/app/controllers/proclaim/subscriptions_controller.rb +3 -3
  16. data/app/jobs/proclaim/application_job.rb +4 -0
  17. data/app/mailers/proclaim/application_mailer.rb +5 -0
  18. data/app/mailers/proclaim/subscription_mailer.rb +19 -17
  19. data/app/models/proclaim/application_record.rb +5 -0
  20. data/app/models/proclaim/comment.rb +6 -1
  21. data/app/models/proclaim/post.rb +20 -28
  22. data/app/models/proclaim/subscription.rb +33 -11
  23. data/app/views/layouts/proclaim/subscription_mailer.html.erb +15 -36
  24. data/app/views/proclaim/comments/_comment.html.erb +7 -7
  25. data/app/views/proclaim/comments/_form.html.erb +7 -5
  26. data/app/views/proclaim/posts/_form.html.erb +34 -21
  27. data/app/views/proclaim/posts/show.html.erb +16 -3
  28. data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +2 -6
  29. data/config/initializers/friendly_id.rb +20 -1
  30. data/config/routes.rb +1 -5
  31. data/db/migrate/20141108222616_create_proclaim_posts.rb +8 -1
  32. data/db/migrate/20141114235359_create_proclaim_comments.rb +1 -1
  33. data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +1 -1
  34. data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +5 -4
  35. data/db/migrate/20150213015321_create_friendly_id_slugs.rb +1 -1
  36. data/lib/generators/proclaim/install_generator.rb +1 -1
  37. data/lib/generators/proclaim/templates/initialize_proclaim.rb +31 -29
  38. data/lib/generators/proclaim/views_generator.rb +1 -1
  39. data/lib/proclaim.rb +15 -15
  40. data/lib/proclaim/engine.rb +21 -19
  41. data/lib/proclaim/version.rb +1 -1
  42. data/vendor/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
  43. data/vendor/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
  44. data/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  45. data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  46. data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  47. data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  48. data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  49. data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  50. data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  51. data/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  52. data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  53. data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  54. data/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  55. data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  56. data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  57. data/vendor/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
  58. data/vendor/assets/fonts/KaTeX_Main-Bold.woff +0 -0
  59. data/vendor/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
  60. data/vendor/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  61. data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  62. data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  63. data/vendor/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
  64. data/vendor/assets/fonts/KaTeX_Main-Italic.woff +0 -0
  65. data/vendor/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
  66. data/vendor/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
  67. data/vendor/assets/fonts/KaTeX_Main-Regular.woff +0 -0
  68. data/vendor/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
  69. data/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  70. data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  71. data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  72. data/vendor/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
  73. data/vendor/assets/fonts/KaTeX_Math-Italic.woff +0 -0
  74. data/vendor/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
  75. data/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  76. data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  77. data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  78. data/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  79. data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  80. data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  81. data/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  82. data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  83. data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  84. data/vendor/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
  85. data/vendor/assets/fonts/KaTeX_Script-Regular.woff +0 -0
  86. data/vendor/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
  87. data/vendor/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
  88. data/vendor/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
  89. data/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  90. data/vendor/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
  91. data/vendor/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
  92. data/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  93. data/vendor/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
  94. data/vendor/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
  95. data/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  96. data/vendor/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
  97. data/vendor/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
  98. data/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  99. data/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  100. data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  101. data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  102. data/vendor/assets/javascripts/contrib/auto-render.js +339 -0
  103. data/vendor/assets/javascripts/contrib/auto-render.min.js +1 -0
  104. data/vendor/assets/javascripts/contrib/auto-render.mjs +215 -0
  105. data/vendor/assets/javascripts/contrib/copy-tex.css +14 -0
  106. data/vendor/assets/javascripts/contrib/copy-tex.js +213 -0
  107. data/vendor/assets/javascripts/contrib/copy-tex.min.css +1 -0
  108. data/vendor/assets/javascripts/contrib/copy-tex.min.js +1 -0
  109. data/vendor/assets/javascripts/contrib/copy-tex.mjs +85 -0
  110. data/vendor/assets/javascripts/contrib/mathtex-script-type.js +137 -0
  111. data/vendor/assets/javascripts/contrib/mathtex-script-type.min.js +1 -0
  112. data/vendor/assets/javascripts/contrib/mathtex-script-type.mjs +24 -0
  113. data/vendor/assets/javascripts/contrib/mhchem.js +3241 -0
  114. data/vendor/assets/javascripts/contrib/mhchem.min.js +1 -0
  115. data/vendor/assets/javascripts/contrib/mhchem.mjs +3109 -0
  116. data/vendor/assets/javascripts/katex.js +16517 -0
  117. data/vendor/assets/javascripts/katex.min.js +1 -0
  118. data/vendor/assets/javascripts/katex.mjs +16122 -0
  119. data/vendor/assets/javascripts/quill.core.js +8522 -0
  120. data/vendor/assets/javascripts/quill.js +11489 -0
  121. data/vendor/assets/javascripts/quill.min.js +8 -0
  122. data/vendor/assets/javascripts/quill.min.js.map +1 -0
  123. data/vendor/assets/stylesheets/katex.css +1011 -0
  124. data/vendor/assets/stylesheets/katex.min.css +1 -0
  125. data/vendor/assets/stylesheets/quill.bubble.css +952 -0
  126. data/vendor/assets/stylesheets/quill.core.css +397 -0
  127. data/vendor/assets/stylesheets/quill.snow.css +945 -0
  128. metadata +169 -278
  129. data/CHANGELOG +0 -77
  130. data/Gemfile +0 -14
  131. data/VERSION +0 -1
  132. data/app/assets/javascripts/proclaim/editor.js.coffee +0 -52
  133. data/app/assets/javascripts/proclaim/images.js.coffee +0 -3
  134. data/app/assets/javascripts/proclaim/subscriptions.js.coffee +0 -3
  135. data/app/assets/stylesheets/proclaim/images.scss +0 -3
  136. data/app/controllers/proclaim/images_controller.rb +0 -67
  137. data/app/helpers/proclaim/comments_helper.rb +0 -4
  138. data/app/helpers/proclaim/images_helper.rb +0 -4
  139. data/app/helpers/proclaim/subscriptions_helper.rb +0 -4
  140. data/app/models/proclaim/image.rb +0 -19
  141. data/app/policies/proclaim/image_policy.rb +0 -29
  142. data/app/uploaders/proclaim/image_uploader.rb +0 -82
  143. data/db/migrate/20141222224905_create_proclaim_images.rb +0 -12
  144. data/db/migrate/20150123115226_add_name_to_subscriptions.rb +0 -7
  145. data/db/migrate/20150213015850_add_slug_to_posts.rb +0 -20
  146. data/proclaim.gemspec +0 -51
  147. data/test/controllers/proclaim/comments_controller_test.rb +0 -228
  148. data/test/controllers/proclaim/images_controller_test.rb +0 -166
  149. data/test/controllers/proclaim/posts_controller_test.rb +0 -465
  150. data/test/controllers/proclaim/subscriptions_controller_test.rb +0 -154
  151. data/test/dummy/README.rdoc +0 -28
  152. data/test/dummy/Rakefile +0 -6
  153. data/test/dummy/app/assets/javascripts/application.js +0 -14
  154. data/test/dummy/app/assets/stylesheets/application.css +0 -16
  155. data/test/dummy/app/controllers/application_controller.rb +0 -15
  156. data/test/dummy/app/helpers/application_helper.rb +0 -28
  157. data/test/dummy/app/models/user.rb +0 -7
  158. data/test/dummy/app/views/layouts/application.html.erb +0 -16
  159. data/test/dummy/bin/bundle +0 -3
  160. data/test/dummy/bin/rails +0 -4
  161. data/test/dummy/bin/rake +0 -4
  162. data/test/dummy/config.ru +0 -4
  163. data/test/dummy/config/application.rb +0 -24
  164. data/test/dummy/config/boot.rb +0 -5
  165. data/test/dummy/config/database.yml +0 -25
  166. data/test/dummy/config/environment.rb +0 -5
  167. data/test/dummy/config/environments/development.rb +0 -45
  168. data/test/dummy/config/environments/production.rb +0 -80
  169. data/test/dummy/config/environments/test.rb +0 -49
  170. data/test/dummy/config/initializers/assets.rb +0 -8
  171. data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
  172. data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
  173. data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  174. data/test/dummy/config/initializers/inflections.rb +0 -16
  175. data/test/dummy/config/initializers/mime_types.rb +0 -4
  176. data/test/dummy/config/initializers/session_store.rb +0 -3
  177. data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
  178. data/test/dummy/config/locales/en.yml +0 -23
  179. data/test/dummy/config/routes.rb +0 -5
  180. data/test/dummy/config/secrets.yml +0 -22
  181. data/test/dummy/db/migrate/20141117214323_create_users.rb +0 -10
  182. data/test/dummy/db/schema.rb +0 -91
  183. data/test/dummy/public/404.html +0 -67
  184. data/test/dummy/public/422.html +0 -67
  185. data/test/dummy/public/500.html +0 -66
  186. data/test/dummy/public/favicon.ico +0 -0
  187. data/test/factories/proclaim/comment.rb +0 -11
  188. data/test/factories/proclaim/image.rb +0 -6
  189. data/test/factories/proclaim/post.rb +0 -14
  190. data/test/factories/proclaim/subscription.rb +0 -14
  191. data/test/factories/user.rb +0 -6
  192. data/test/helpers/proclaim/comments_helper_test.rb +0 -6
  193. data/test/helpers/proclaim/posts_helper_test.rb +0 -6
  194. data/test/helpers/proclaim/subscriptions_helper_test.rb +0 -6
  195. data/test/integration/with_javascript/comment_test.rb +0 -391
  196. data/test/integration/with_javascript/post_form_test.rb +0 -225
  197. data/test/integration/with_javascript/post_show_test.rb +0 -47
  198. data/test/integration/with_javascript/post_subscription_test.rb +0 -302
  199. data/test/integration/without_javascript/blog_subscription_test.rb +0 -114
  200. data/test/integration/without_javascript/manage_subscriptions_test.rb +0 -37
  201. data/test/integration/without_javascript/post_test.rb +0 -234
  202. data/test/integration/without_javascript/subscription_email_test.rb +0 -95
  203. data/test/integration/without_javascript/unsubscribe_test.rb +0 -32
  204. data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +0 -22
  205. data/test/mailers/proclaim/subscription_mailer_test.rb +0 -91
  206. data/test/models/proclaim/comment_test.rb +0 -41
  207. data/test/models/proclaim/image_test.rb +0 -70
  208. data/test/models/proclaim/post_test.rb +0 -193
  209. data/test/models/proclaim/subscription_test.rb +0 -77
  210. data/test/policies/application_policy_test.rb +0 -87
  211. data/test/policies/proclaim/comment_policy_test.rb +0 -71
  212. data/test/policies/proclaim/image_policy_test.rb +0 -83
  213. data/test/policies/proclaim/post_policy_test.rb +0 -98
  214. data/test/policies/proclaim/subscription_policy_test.rb +0 -103
  215. data/test/proclaim_test.rb +0 -7
  216. data/test/support/images/test.jpg +0 -0
  217. data/test/support/pages/posts/edit_page.rb +0 -5
  218. data/test/support/pages/posts/show_page.rb +0 -47
  219. data/test/support/wait_for_ajax.rb +0 -11
  220. data/test/test_helper.rb +0 -71
  221. data/test/unit/proclaim/new_comment_callback_test.rb +0 -62
  222. data/test/unit/proclaim/new_subscription_callback_test.rb +0 -62
  223. data/test/unit/proclaim/post_published_callback_test.rb +0 -74
  224. data/vendor/assets/images/link.png +0 -0
  225. data/vendor/assets/images/remove.png +0 -0
  226. data/vendor/assets/images/resize-bigger.png +0 -0
  227. data/vendor/assets/images/resize-smaller.png +0 -0
  228. data/vendor/assets/images/unlink.png +0 -0
  229. data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +0 -197
  230. data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +0 -572
  231. data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +0 -50
  232. data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +0 -496
  233. data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +0 -132
  234. data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +0 -1415
  235. data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css.scss +0 -55
  236. data/vendor/assets/stylesheets/medium-editor-insert-plugin.css.scss +0 -277
data/CHANGELOG DELETED
@@ -1,77 +0,0 @@
1
- v 0.5.6
2
- - Refactor json responses in controllers
3
- - Add a few more corner-case tests
4
-
5
- v 0.5.5
6
- - Add comment count to Post index
7
-
8
- v 0.5.4
9
- - Integrate with Travis CI, Sauce Labs, and Code Climate
10
-
11
- v 0.5.3
12
- - Fixed bug causing initial slugs to not be generated
13
-
14
- v 0.5.2
15
- - Fixed broken migration adding slugs to posts
16
-
17
- v 0.5.1
18
- - Fixed bad post body placeholder
19
-
20
- v 0.5.0
21
- - Fixed bug causing possible blank excerpt
22
- - Make post URLs more friendly (backward-compatible)
23
-
24
- v 0.4.0
25
- - Added media query to emails for better display on mobile devices
26
- - Added callbacks as a way for main app to be notified of new posts,
27
- comments, or subscriptions. Configured in initializer
28
- - Fixed bug where email field didn't hide after successful comment
29
- - Added ability to administer subscriptions
30
- - Added page titles for each Proclaim page
31
- - Removed the use of calc from mailer layout
32
-
33
- v 0.3.1
34
- - Fixed bug causing floated images to display improperly in emails
35
- - Added link to emails to view post online
36
-
37
- v 0.3.0
38
- - Implemented sanitization for post body, using lists of allowed HTML tags and
39
- attributes that can be customized via initializer
40
-
41
- v 0.2.4
42
- - Added simple format to comments, to preserve line breaks
43
-
44
- v 0.2.3
45
- - Fixed inability to set "from" field in emails sent from Proclaim
46
-
47
- v 0.2.2
48
- - Fixed post titles showing HTML entities
49
- - Fixed posts index to show published time instead of updated time
50
-
51
- v 0.2.1
52
- - Fixed out-of-date initializer template
53
-
54
- v 0.2.0
55
- - Added ability to alter the buttons shown on editor toolbar
56
- - Upgraded to Medium Editor 2.0.0
57
- - Fix image toolbar's missing icons in production
58
- - Edit/Delete buttons on post show page
59
- - Posts ordered by publication date
60
-
61
- v 0.1.3
62
- - Fixed incorrect foreign keys
63
-
64
- v 0.1.2
65
- - Fixed spacing around image on post show
66
- - Added Ruby version requirement to gemspec
67
-
68
- v 0.1.1
69
- - Fixed post form that was too wide to upload images
70
- - Fixed views generator missing email layout
71
-
72
- v 0.1.0
73
- - Added medium editor to post form, using Carrierwave for image uploads
74
- - Added subscriptions to both the blog and posts (i.e. subscribe to be
75
- notified of new posts or new comments on a given post)
76
- - Added comments to posts
77
- - Added posts
data/Gemfile DELETED
@@ -1,14 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Declare your gem's dependencies in proclaim.gemspec.
4
- # Bundler will treat runtime dependencies like base dependencies, and
5
- # development dependencies will be added by default to the :development group.
6
- gemspec
7
-
8
- # Declare any dependencies that are still in development here instead of in
9
- # your gemspec. These might include edge Rails or gems from your path or
10
- # Git. Remember to move these dependencies to your gemspec before releasing
11
- # your gem to rubygems.org.
12
-
13
- # To use debugger
14
- # gem 'debugger'
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.5.6
@@ -1,52 +0,0 @@
1
- class Editor
2
- constructor: (@form, @titleFormField, @titleEditableItem,
3
- @bodyFormField, @bodyEditableItem, @toolbarButtons) ->
4
- if (@form.length == 1) and (@titleFormField.length == 1) and
5
- (@titleEditableItem.length == 1) and (@bodyFormField.length == 1) and
6
- (@bodyEditableItem.length == 1)
7
- imageUploadPath = @bodyEditableItem.data("image-upload-path")
8
- imageDeletePath = @bodyEditableItem.data("image-delete-path")
9
-
10
- if (imageUploadPath.length > 0) and (imageDeletePath.length > 0)
11
- @bodyEditor = new MediumEditor(@bodyEditableItem, {
12
- buttonLabels: 'fontawesome',
13
- buttons: @toolbarButtons
14
- })
15
-
16
- @titleEditor = new MediumEditor(@titleEditableItem)
17
-
18
- @bodyEditableItem.mediumInsert({
19
- editor: @bodyEditor,
20
- addons: {
21
- images: {
22
- imagesUploadScript: imageUploadPath,
23
- imagesDeleteScript: imageDeletePath,
24
- deleteFile: (file, that) =>
25
- $.post that.options.imagesDeleteScript, {file: file}, (data, status, jqxhr) =>
26
- if data.id
27
- @form.append('<input type="hidden" name="post[images_attributes][' + data.id + '][id]" value="' + data.id + '" />')
28
- @form.append('<input type="hidden" name="post[images_attributes][' + data.id + '][_destroy]" value="true" />')
29
- , "json"
30
- }
31
- }
32
- })
33
-
34
- @cleanBindings()
35
- @addBindings()
36
- else
37
- console.error("Missing image upload and/or image delete paths for body editor!")
38
- else
39
- console.error("Invalid length for editable items or form fields!")
40
-
41
- addBindings: ->
42
- @form.on "submit", @updateFormFields
43
-
44
- cleanBindings: ->
45
- @form.off "submit"
46
-
47
- updateFormFields: (event) =>
48
- @titleFormField.val(@titleEditor.serialize()["element-0"].value)
49
- @bodyFormField.val(@bodyEditor.serialize()["element-0"].value)
50
-
51
- # Make available to other scripts
52
- @Editor = Editor
@@ -1,3 +0,0 @@
1
- # Place all the behaviors and hooks related to the matching controller here.
2
- # All this logic will automatically be available in application.js.
3
- # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -1,3 +0,0 @@
1
- # Place all the behaviors and hooks related to the matching controller here.
2
- # All this logic will automatically be available in application.js.
3
- # You can use CoffeeScript in this file: http://coffeescript.org/
@@ -1,3 +0,0 @@
1
- // Place all the styles related to the Images controller here.
2
- // They will automatically be included in application.css.
3
- // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -1,67 +0,0 @@
1
- require_dependency "proclaim/application_controller"
2
-
3
- module Proclaim
4
- class ImagesController < ApplicationController
5
- after_action :verify_authorized
6
-
7
- def create
8
- @image = Image.new(post_id: image_params[:post_id])
9
-
10
- handleJsonRequest(@image,
11
- operation: lambda {@image.save},
12
- success_json: lambda {@image.image.url}) do
13
- @image.image = image_params[:image]
14
- end
15
- end
16
-
17
- def cache
18
- @image = Image.new
19
-
20
- handleJsonRequest(@image, success_json: lambda {@image.image.url}) do
21
- @image.image = file_params[:file]
22
- end
23
- end
24
-
25
- def discard
26
- url = file_params[:file]
27
- image_id = nil
28
-
29
- # Is this a cached image?
30
- if (url.include? Proclaim::ImageUploader.cache_dir)
31
- # If so, retrieve it from the cache
32
- @image = Image.new
33
- @image.image.retrieve_from_cache!(cache_name_from_url(url))
34
- else
35
- # If not, retrieve it from the database
36
- image_id, image_name = image_id_and_name_from_url(url)
37
- @image = Image.find(image_id)
38
- end
39
-
40
- handleJsonRequest(@image, success_json: {id: image_id}) do
41
- if @image.new_record?
42
- @image.image.remove!
43
- end
44
- end
45
- end
46
-
47
- def destroy
48
- @image = Image.find(params[:id])
49
-
50
- handleJsonRequest(@image) do
51
- @image.destroy
52
- end
53
- end
54
-
55
- private
56
-
57
- # Only allow a trusted parameter "white list" through.
58
- def image_params
59
- params.require(:image).permit(:post_id,
60
- :image)
61
- end
62
-
63
- def file_params
64
- params.permit(:file)
65
- end
66
- end
67
- end
@@ -1,4 +0,0 @@
1
- module Proclaim
2
- module CommentsHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Proclaim
2
- module ImagesHelper
3
- end
4
- end
@@ -1,4 +0,0 @@
1
- module Proclaim
2
- module SubscriptionsHelper
3
- end
4
- end
@@ -1,19 +0,0 @@
1
- # == Schema Information
2
- #
3
- # Table name: proclaim_images
4
- #
5
- # id :integer not null, primary key
6
- # post_id :integer
7
- # image :string
8
- # created_at :datetime not null
9
- # updated_at :datetime not null
10
- #
11
-
12
- module Proclaim
13
- class Image < ActiveRecord::Base
14
- belongs_to :post, inverse_of: :images
15
- mount_uploader :image, ImageUploader
16
-
17
- validates_presence_of :post, :image
18
- end
19
- end
@@ -1,29 +0,0 @@
1
- module Proclaim
2
- class ImagePolicy < ApplicationPolicy
3
- def cache?
4
- create?
5
- end
6
-
7
- def create?
8
- not @user.nil? # As long as there's a user, it can create images
9
- end
10
-
11
- def discard?
12
- destroy?
13
- end
14
-
15
- def destroy?
16
- not @user.nil? # As long as there's a user, it can destroy images
17
- end
18
-
19
- class Scope < Scope
20
- def resolve
21
- if @user
22
- scope.all # Users can access all images
23
- else
24
- scope.none
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,82 +0,0 @@
1
- # encoding: utf-8
2
- module Proclaim
3
- class ImageUploader < CarrierWave::Uploader::Base
4
- before :remove, :backup_cache_id
5
- after :remove, :delete_cache_directory
6
- after :remove, :delete_store_directory
7
-
8
- # Include RMagick or MiniMagick support:
9
- # include CarrierWave::RMagick
10
- # include CarrierWave::MiniMagick
11
-
12
- # Choose what kind of storage to use for this uploader:
13
- storage :file
14
- # storage :fog
15
-
16
- # Override the directory where uploaded files will be stored.
17
- # This is a sensible default for uploaders that are meant to be mounted:
18
- def store_dir
19
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
20
- end
21
-
22
- # Provide a default URL as a default if there hasn't been a file uploaded:
23
- # def default_url
24
- # # For Rails 3.1+ asset pipeline compatibility:
25
- # # ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_'))
26
- #
27
- # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
28
- # end
29
-
30
- # Process files as they are uploaded:
31
- # process :scale => [200, 300]
32
- #
33
- # def scale(width, height)
34
- # # do something
35
- # end
36
-
37
- # Create different versions of your uploaded files:
38
- # version :thumb do
39
- # process :resize_to_fit => [50, 50]
40
- # end
41
-
42
- # Add a white list of extensions which are allowed to be uploaded.
43
- # For images you might use something like this:
44
- # def extension_white_list
45
- # %w(jpg jpeg gif png)
46
- # end
47
-
48
- # Override the filename of the uploaded files:
49
- # Avoid using model.id or version_name here, see uploader/store.rb for details.
50
- # def filename
51
- # "something.jpg" if original_filename
52
- # end
53
-
54
- private
55
-
56
- def backup_cache_id
57
- @cache_id_was = cache_id
58
- end
59
-
60
- def delete_cache_directory
61
- @cache_id = @cache_id_was
62
- delete_cache_id
63
- end
64
-
65
- def delete_store_directory
66
- store_path = store_dir
67
- if Pathname.new(store_dir).relative?
68
- store_path = File.expand_path(store_dir, CarrierWave.root)
69
- end
70
-
71
- begin
72
- Dir.rmdir(store_path)
73
- rescue Errno::ENOENT
74
- # Ignore: path does not exist
75
- rescue Errno::ENOTDIR
76
- # Ignore: path is not a dir
77
- rescue Errno::ENOTEMPTY, Errno::EEXIST
78
- # Ignore: dir is not empty
79
- end
80
- end
81
- end
82
- end
@@ -1,12 +0,0 @@
1
- class CreateProclaimImages < ActiveRecord::Migration
2
- def change
3
- create_table :proclaim_images do |t|
4
- t.belongs_to :post, index: true
5
- t.string :image
6
-
7
- t.timestamps null: false
8
- end
9
-
10
- add_foreign_key :proclaim_images, :proclaim_posts, column: :post_id
11
- end
12
- end
@@ -1,7 +0,0 @@
1
- class AddNameToSubscriptions < ActiveRecord::Migration
2
- def change
3
- change_table :proclaim_subscriptions do |t|
4
- t.string :name, null: false, default: ""
5
- end
6
- end
7
- end
@@ -1,20 +0,0 @@
1
- class AddSlugToPosts < ActiveRecord::Migration
2
- def change
3
- change_table :proclaim_posts do |t|
4
- t.string :slug
5
- end
6
-
7
- # This ensures that even if two clients try to create the same
8
- # post slug at exactly the same time, the database won't accept
9
- # one of them (Rails would have)
10
- add_index :proclaim_posts, :slug, unique: true
11
-
12
- reversible do |direction|
13
- direction.up do
14
- print "Generating slugs for existing posts... "
15
- Proclaim::Post.find_each(&:save)
16
- puts "done."
17
- end
18
- end
19
- end
20
- end
@@ -1,51 +0,0 @@
1
- $:.push File.expand_path("../lib", __FILE__)
2
-
3
- require "proclaim/version"
4
-
5
- Gem::Specification.new do |s|
6
- s.name = "proclaim"
7
- s.version = Proclaim::VERSION
8
- s.authors = ["Kyle Fazzari"]
9
- s.email = ["proclaim@status.e4ward.com"]
10
- s.homepage = "https://github.com/kyle-f/proclaim"
11
- s.summary = "A Rails blogging engine that simplifies your life."
12
- s.description = <<-EOF
13
- Most Rails blogging tools include everything you could ever want,
14
- including things you don't. Proclaim tries to provide the simplest (yet
15
- beautiful) implementation of a blog via a mountable engine; if more
16
- functionality is desired, it can easily be combined with other engines.
17
- EOF
18
- s.license = "GPLv3"
19
-
20
- s.files = Dir["{app,config,db,lib,vendor,test}/**/*", "LICENSE", "Rakefile", "README.md", "Gemfile", "proclaim.gemspec", "CHANGELOG", "VERSION"]
21
- s.test_files = Dir["test/**/*"]
22
-
23
- s.required_ruby_version = '>= 1.9.3'
24
-
25
- s.add_dependency "rails", "~> 4.2"
26
- s.add_dependency "coffee-rails", "~> 4.1"
27
- s.add_dependency "sass-rails", "~> 5.0"
28
- s.add_dependency "jquery-rails", "~> 4.0"
29
- s.add_dependency "htmlentities", "~> 4.3"
30
- s.add_dependency "friendly_id", "~> 5.1"
31
- s.add_dependency "nokogiri", "~> 1.6"
32
- s.add_dependency "premailer", "~> 1.8"
33
- s.add_dependency "closure_tree", "~> 5.2"
34
- s.add_dependency "font-awesome-rails", "~> 4.3"
35
- s.add_dependency "medium-editor-rails", "~> 2.0"
36
- s.add_dependency "carrierwave", "~> 0.10"
37
- s.add_dependency "aasm", "~> 4.2"
38
- s.add_dependency "rails-timeago", "~> 2.12"
39
- s.add_dependency "pundit", "~> 1.0"
40
-
41
- s.add_development_dependency "sqlite3", "~> 1.3"
42
- s.add_development_dependency "factory_girl_rails", "~> 4.5"
43
- s.add_development_dependency "mocha", "~> 1.1"
44
- s.add_development_dependency "annotate", "~> 2.6"
45
- s.add_development_dependency "capybara", "~> 2.4"
46
- s.add_development_dependency "selenium-webdriver", "~> 2.46"
47
- s.add_development_dependency "database_cleaner", "~> 1.4"
48
- s.add_development_dependency "faker", "~> 1.4"
49
- s.add_development_dependency "test_after_commit", "~> 0.4"
50
- s.add_development_dependency "codeclimate-test-reporter", "~> 0.4"
51
- end