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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5010df73f9c56158e2848567ff36f237e84416b8
4
- data.tar.gz: eb2c9683b06d54f40af0ca609af12c8f0794fae4
2
+ SHA256:
3
+ metadata.gz: 8ed66630af32fc0c1e8ef5217eb3cb511b60cfd34e9198fb1b8f1f12ae8054ff
4
+ data.tar.gz: a69c720636b0d4d86ea43bbd60294af073ad86561a165094cff5bad6a9c69960
5
5
  SHA512:
6
- metadata.gz: 830649b8fad5fc8c4206b1cc96b9ea6730d839a1c4a5638e1601c9327ecd947315d647b1b85ad10275d52e2a463fa4c704e16282c6b7045720247f177218e6b8
7
- data.tar.gz: 9f55f501b0639edda86983c4bcef68531df58edd279cf13d5922977510f4cf989bed9991e3f17a4b64acb5146deccf6145ae49eea6f66a29ae113d494a6ea9ce
6
+ metadata.gz: 89c16c4398abd72ff076c6abcb6cc8389477a8f0c623e979d4bef670cc69f668c3393e5caccd5a4c401240d2534748bea2eae88ddab01e939317a6659bc592ff
7
+ data.tar.gz: fe9c5f4aa15fd2aafa5a3b01869986b452b16bccace9676459876bb493990d494fb642bd8926ee5e538a8855aeb8b5dffba8bdd2d7e0a97f99fa3fac1d7397e6
data/Rakefile CHANGED
@@ -10,56 +10,23 @@ RDoc::Task.new(:rdoc) do |rdoc|
10
10
  rdoc.rdoc_dir = 'rdoc'
11
11
  rdoc.title = 'Proclaim'
12
12
  rdoc.options << '--line-numbers'
13
- rdoc.rdoc_files.include('README.rdoc')
13
+ rdoc.rdoc_files.include('README.md')
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
+ load 'rails/tasks/statistics.rake'
20
21
 
21
-
22
- Bundler::GemHelper.install_tasks
22
+ require 'bundler/gem_tasks'
23
23
 
24
24
  require 'rake/testtask'
25
25
 
26
26
  Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib'
28
27
  t.libs << 'test'
28
+ t.pattern = 'test/**/*_test.rb'
29
29
  t.verbose = false
30
- if ENV["TEST"].nil?
31
- t.pattern = 'test/**/*_test.rb'
32
- else
33
- t.pattern = ENV["TEST"]
34
- end
35
- end
36
-
37
- namespace :test do
38
- Rails::TestTask.new(:generators) do |t|
39
- t.pattern = "test/lib/generators/**/*_test.rb"
40
- end
41
-
42
- Rails::TestTask.new(:units) do |t|
43
- t.pattern = 'test/{models,helpers,unit,policies}/**/*_test.rb'
44
- end
45
-
46
- Rails::TestTask.new(:functionals) do |t|
47
- t.pattern = 'test/{controllers,mailers,functional}/**/*_test.rb'
48
- end
49
-
50
- Rails::TestTask.new(:integration) do |t|
51
- t.pattern = 'test/integration/**/*_test.rb'
52
- end
53
-
54
- namespace :integration do
55
- Rails::TestTask.new(:js) do |t|
56
- t.pattern = 'test/integration/with_javascript/**/*_test.rb'
57
- end
58
-
59
- Rails::TestTask.new(:no_js) do |t|
60
- t.pattern = 'test/integration/without_javascript/**/*_test.rb'
61
- end
62
- end
63
30
  end
64
31
 
65
32
  task default: :test
@@ -0,0 +1,2 @@
1
+ //= link_directory ../javascripts/proclaim .js
2
+ //= link_directory ../stylesheets/proclaim .css
@@ -2,17 +2,17 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
- //= require jquery
14
- //= require jquery_ujs
15
- //= require medium-editor
16
- //= require medium-editor-insert-plugin.all
13
+ //= require rails-ujs
14
+ //= require activestorage
17
15
  //= require rails-timeago
16
+ //= require katex
17
+ //= require quill
18
18
  //= require_tree .
@@ -51,12 +51,12 @@ class CommentsHandler
51
51
  $(document).off "change", @subscribeCheckboxClass
52
52
 
53
53
  # Disable the form until the new comment has been processed
54
- handleCommentStarted: (event, xhr, settings) =>
54
+ handleCommentStarted: (event) =>
55
55
  form = $(event.target)
56
56
  form.find(":input").prop("disabled", true);
57
57
  form.before('<div class = "loading" style = "width: 100px;"></div>')
58
58
 
59
- handleCommentFinished: (event, xhr, status) =>
59
+ handleCommentFinished: (event) =>
60
60
  form = $(event.target)
61
61
  target = $(form.data("target"))
62
62
  form.find(":input").prop("disabled", false);
@@ -65,19 +65,22 @@ class CommentsHandler
65
65
  if status == "success"
66
66
  @removeForm form
67
67
 
68
- handleCommentSuccess: (event, data, status, xhr) =>
69
- if data.html.length == 0
68
+ handleCommentSuccess: (event) =>
69
+ # As of rails-ujs, need to pull response out of detail instead of event handler
70
+ # args
71
+ html = event.detail[0].html
72
+ if html.length == 0
70
73
  console.error("Invalid comment HTML!")
71
74
  return
72
75
 
73
76
  form = $(event.target)
74
77
 
75
78
  if form.hasClass("edit_comment")
76
- form.closest(@discussionClass).replaceWith(data.html)
79
+ form.closest(@discussionClass).replaceWith(html)
77
80
  else
78
81
  target = $(form.data("target"))
79
82
  if target.length == 1
80
- target.append(data.html)
83
+ target.append(html)
81
84
  else
82
85
  console.error("Invalid comment target!")
83
86
  return
@@ -85,7 +88,10 @@ class CommentsHandler
85
88
  # Hide form, but don't remove so events can still be emitted
86
89
  @removeForm form, true
87
90
 
88
- handleCommentFailure: (event, xhr, status, error) =>
91
+ handleCommentFailure: (event) =>
92
+ # As of rails-ujs, need to pull xhr out of detail instead of event handler args
93
+ xhr = event.detail[2]
94
+
89
95
  $(event.target).siblings("div.error").remove()
90
96
  errorMessage = "<div class='error'>"
91
97
  errorMessage += "<strong>The following errors have prevented this comment from being saved:</strong>"
@@ -96,7 +102,7 @@ class CommentsHandler
96
102
  errorMessage += "</div>"
97
103
  $(event.target).before(errorMessage)
98
104
 
99
- handleDeleteCommentSuccess: (event, data, status, xhr) =>
105
+ handleDeleteCommentSuccess: (event) =>
100
106
  commentContainer = $(event.target).closest(@discussionClass)
101
107
  if commentContainer.length == 1
102
108
  commentContainer.fadeOut ->
@@ -104,7 +110,7 @@ class CommentsHandler
104
110
  else
105
111
  console.error("No comment container for removal!")
106
112
 
107
- handleDeleteCommentFailure: (event, xhr, status, error) =>
113
+ handleDeleteCommentFailure: (event) =>
108
114
  console.error("Unable to delete comment!")
109
115
 
110
116
  showNewCommentForm: (event) =>
@@ -116,7 +122,7 @@ class CommentsHandler
116
122
  return
117
123
 
118
124
  # Ensure form isn't already shown. If it is, don't show it again
119
- if target.children(@commentFormClass).length == 0
125
+ if target.children(@commentFormClass).length == 0 or ! target.children(@commentFormClass).is(":visible")
120
126
  form = $(event.target).data("form")
121
127
  if form.length == 0
122
128
  console.error("Invalid comment form data!")
@@ -0,0 +1,55 @@
1
+ class Editor
2
+ constructor: (@form, @titleFormField, @titleEditableItem, @titleContents,
3
+ @bodyFormField, @quillBodyFormField, @bodyEditableItem,
4
+ @bodyScrollingContainer, @bodyContents, @toolbar, @formats) ->
5
+ if (@form.length == 1) and (@titleFormField.length == 1) and
6
+ (@titleEditableItem.length == 1) and (@bodyFormField.length == 1) and
7
+ (@bodyEditableItem.length == 1) and (@bodyScrollingContainer.length == 1)
8
+ @bodyEditor = new Quill(@bodyEditableItem.get(0), {
9
+ placeholder: @bodyEditableItem.data("placeholder"),
10
+ scrollingContainer: @bodyScrollingContainer.get(0),
11
+ theme: 'bubble',
12
+ formats: @formats,
13
+ modules: {
14
+ toolbar: @toolbar,
15
+ }
16
+ })
17
+ @bodyEditor.setContents(@bodyContents)
18
+
19
+ @cleanBindings()
20
+ @addBindings()
21
+ else
22
+ console.error("Invalid length for editable items or form fields!")
23
+
24
+ addBindings: ->
25
+ @form.on "submit", @updateFormFields
26
+ @titleEditableItem.on "paste", @stripFormatting
27
+ @titleEditableItem.on "keypress", @disallowNewlines
28
+
29
+ cleanBindings: ->
30
+ @form.off "submit"
31
+ @titleEditableItem.off "paste"
32
+ @titleEditableItem.off "keypress"
33
+
34
+ updateFormFields: (event) =>
35
+ @titleFormField.val(@titleEditableItem.text())
36
+ @quillBodyFormField.val(JSON.stringify(@bodyEditor.getContents()))
37
+ @bodyFormField.val(@bodyEditableItem.children('div.ql-editor').html())
38
+
39
+ stripFormatting: (event) =>
40
+ event.stopPropagation()
41
+ event.preventDefault()
42
+
43
+ clipboardData = event.clipboardData || window.clipboardData || event.originalEvent.clipboardData
44
+ pastedData = clipboardData.getData('Text')
45
+
46
+ # Strip formatting out by setting HTML and then using the resulting text
47
+ event.currentTarget.innerHTML = pastedData
48
+ event.currentTarget.innerHTML = event.currentTarget.innerText
49
+
50
+ disallowNewlines: (event) =>
51
+ return event.which != 13;
52
+
53
+
54
+ # Make available to other scripts
55
+ @Editor = Editor
@@ -3,17 +3,16 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
- * compiled file so the styles you add here take precedence over styles defined in any styles
10
- * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
- * file per style scope.
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
12
  *
13
13
  *= require font-awesome
14
- *= require medium-editor/medium-editor
15
- *= require medium-editor/themes/mani
16
- *= require medium-editor-insert-plugin
14
+ *= require katex
15
+ *= require quill.bubble
17
16
  *= require_tree .
18
17
  *= require_self
19
18
  */
@@ -22,7 +21,7 @@ div.loading
22
21
  {
23
22
  width: 100%;
24
23
  height: 32px;
25
- background-image: image_url("ajax_loader.gif");
24
+ background-image: image-url("proclaim/ajax_loader.gif");
26
25
  background-repeat: no-repeat;
27
26
  background-position: center;
28
27
  }
@@ -9,6 +9,14 @@ h1.post_title
9
9
  padding-bottom: 10px;
10
10
  font-weight: bold;
11
11
  border-bottom: solid 1px #ddd;
12
+
13
+ &:empty:before
14
+ {
15
+ content: attr(placeholder);
16
+ display: block; /* For Firefox */
17
+ font-style: italic;
18
+ color: rgba(0,0,0,0.6);
19
+ }
12
20
  }
13
21
 
14
22
  div.post_information
@@ -67,48 +75,75 @@ input.datetime_picker
67
75
  }
68
76
  }
69
77
 
70
- .mediumInsert
71
- {
72
- margin: -1em 0 0 0;
73
- }
74
-
75
78
  div.post_body
76
79
  {
77
80
  width: calc(100% - 80px);
78
81
  margin: 0 auto;
82
+ height: auto;
83
+ min-height: 100%;
79
84
  }
80
85
 
81
- div.post_body.show .mediumInsert
86
+ div.post_body.editable:after
82
87
  {
83
- margin-left: 0px !important;
88
+ top: 0;
89
+ }
84
90
 
85
- .mediumInsert-images img
91
+ h1.post_title.editable
92
+ {
93
+ margin-bottom: 20px;
94
+ &:after
86
95
  {
87
- margin: 1em 0 0 0;
96
+ position: relative;
97
+ text-align: center;
88
98
  }
89
99
  }
90
100
 
91
- figure.mediumInsert-images
92
- {
93
- text-align: center;
101
+ /* Specify our own scrolling container */
102
+ div.scrolling-container {
103
+ height: 100%;
104
+ min-height: 100%;
105
+ overflow-y: auto;
94
106
  }
95
107
 
96
- .medium-editor-insert-plugin p
108
+ .ql-editor
97
109
  {
98
- margin: 0px 0px 10px;
99
- box-sizing: border-box;
100
- }
110
+ overflow-y: visible;
101
111
 
102
- div.post_body.editable:after
103
- {
104
- top: 0;
105
- }
112
+ p
113
+ {
114
+ img
115
+ {
116
+ float: left;
117
+ max-width: 30%;
118
+ margin-right: 15px;
119
+ }
120
+ }
106
121
 
107
- h1.post_title.editable
108
- {
109
- &:after
122
+ p.ql-align-right
110
123
  {
111
- position: relative;
112
- text-align: center;
124
+ img
125
+ {
126
+ float: right;
127
+ max-width: 30%;
128
+ margin-left: 15px;
129
+ }
130
+ }
131
+
132
+ p.ql-align-center
133
+ {
134
+ img
135
+ {
136
+ float: inherit;
137
+ max-width: 100%;
138
+ }
139
+ }
140
+
141
+ p.ql-align-justify
142
+ {
143
+ img
144
+ {
145
+ float: inherit;
146
+ max-width: 100%;
147
+ }
113
148
  }
114
149
  }
@@ -1,77 +1,81 @@
1
- class Proclaim::ApplicationController < ApplicationController
2
- include Pundit
1
+ module Proclaim
2
+ class ApplicationController < ::ApplicationController
3
+ protect_from_forgery with: :exception
3
4
 
4
- rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
5
+ include Pundit
5
6
 
6
- private
7
+ rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
7
8
 
8
- def user_not_authorized
9
- flash[:error] = "You are not authorized to perform this action."
10
- redirect_to(request.referrer || root_path)
11
- end
9
+ private
12
10
 
13
- def authenticate_author
14
- begin
15
- send(Proclaim.authentication_method)
16
- rescue NoMethodError
17
- raise "Proclaim doesn't know how to authenticate users! Please" \
18
- " ensure that `Proclaim.authentication_path` is valid."
11
+ def user_not_authorized
12
+ flash[:error] = "You are not authorized to perform this action."
13
+ redirect_to(request.referrer || root_path)
19
14
  end
20
- end
21
15
 
22
- def current_author
23
- begin
24
- send(Proclaim.current_author_method)
25
- rescue NoMethodError
26
- raise "Proclaim doesn't know how to get the current author! Please" \
27
- " ensure that `Proclaim.current_author_method` is valid."
16
+ def authenticate_author
17
+ begin
18
+ send(Proclaim.authentication_method)
19
+ rescue NoMethodError
20
+ raise "Proclaim doesn't know how to authenticate users! Please" \
21
+ " ensure that `Proclaim.authentication_method` is valid."
22
+ end
28
23
  end
29
- end
30
24
 
31
- def pundit_user
32
- current_author
33
- end
25
+ def current_author
26
+ begin
27
+ send(Proclaim.current_author_method)
28
+ rescue NoMethodError
29
+ raise "Proclaim doesn't know how to get the current author! Please" \
30
+ " ensure that `Proclaim.current_author_method` is valid."
31
+ end
32
+ end
34
33
 
35
- def image_id_and_name_from_url(url)
36
- match = url.match(/([^\/]*?)\/([^\/]*)\z/)
34
+ def pundit_user
35
+ current_author
36
+ end
37
37
 
38
- return match[1], match[2]
39
- end
38
+ def image_id_and_name_from_url(url)
39
+ match = url.match(/([^\/]*?)\/([^\/]*)\z/)
40
40
 
41
- def cache_name_from_url(url)
42
- url.match(/[^\/]*?\/[^\/]*\z/)
43
- end
41
+ return match[1], match[2]
42
+ end
44
43
 
45
- def handleJsonRequest(object, options = {})
46
- operation = options[:operation] || true
47
- successJson = options[:success_json] || true
48
- failureJson = options[:failure_json] || lambda {object.errors.full_messages}
49
- unauthorizedStatus = options[:unauthorized_status] || :unauthorized
44
+ def cache_name_from_url(url)
45
+ url.match(/[^\/]*?\/[^\/]*\z/)
46
+ end
50
47
 
51
- begin
52
- authorize object
48
+ def handleJsonRequest(object, options = {})
49
+ operation = options[:operation] || true
50
+ successJson = options[:success_json] || true
51
+ failureJson = options[:failure_json] || lambda {object.errors.full_messages}
52
+ unauthorizedStatus = options[:unauthorized_status] || :unauthorized
53
53
 
54
- yield if block_given?
55
- return if performed? # Don't continue if the block rendered
54
+ begin
55
+ authorize object
56
56
 
57
- respond_to do |format|
58
- if (operation == true) or (operation.respond_to?(:call) and operation.call)
59
- if successJson.respond_to? :call
60
- successJson = successJson.call
61
- end
57
+ yield if block_given?
58
+ return if performed? # Don't continue if the block rendered
62
59
 
63
- format.json { render json: successJson }
64
- else
65
- if failureJson.respond_to? :call
66
- failureJson = failureJson.call
67
- end
60
+ respond_to do |format|
61
+ if (operation == true) or (operation.respond_to?(:call) and operation.call)
62
+ if successJson.respond_to? :call
63
+ successJson = successJson.call
64
+ end
68
65
 
69
- format.json { render json: failureJson, status: :unprocessable_entity }
66
+ format.json { render json: successJson }
67
+ else
68
+ if failureJson.respond_to? :call
69
+ failureJson = failureJson.call
70
+ end
71
+
72
+ format.json { render json: failureJson, status: :unprocessable_entity }
73
+ end
74
+ end
75
+ rescue Pundit::NotAuthorizedError
76
+ respond_to do |format|
77
+ format.json { render json: true, status: unauthorizedStatus }
70
78
  end
71
- end
72
- rescue Pundit::NotAuthorizedError
73
- respond_to do |format|
74
- format.json { render json: true, status: unauthorizedStatus }
75
79
  end
76
80
  end
77
81
  end