proclaim 0.5.6 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Rakefile +5 -38
- data/app/assets/config/proclaim_manifest.js +2 -0
- data/app/assets/images/{ajax_loader.gif → proclaim/ajax_loader.gif} +0 -0
- data/app/assets/javascripts/proclaim.js +7 -7
- data/app/assets/javascripts/proclaim/{comments_handler.js.coffee → comments_handler.coffee} +16 -10
- data/app/assets/javascripts/proclaim/editor.coffee +55 -0
- data/app/assets/stylesheets/{proclaim.css.scss → proclaim.scss} +7 -8
- data/app/assets/stylesheets/proclaim/{comments.css.scss → comments.scss} +0 -0
- data/app/assets/stylesheets/proclaim/{posts.css.scss → posts.scss} +60 -25
- data/app/assets/stylesheets/proclaim/{subscriptions.css.scss → subscriptions.scss} +0 -0
- data/app/controllers/proclaim/application_controller.rb +60 -56
- data/app/controllers/proclaim/comments_controller.rb +13 -42
- data/app/controllers/proclaim/posts_controller.rb +25 -57
- data/app/controllers/proclaim/subscriptions_controller.rb +3 -3
- data/app/jobs/proclaim/application_job.rb +4 -0
- data/app/mailers/proclaim/application_mailer.rb +5 -0
- data/app/mailers/proclaim/subscription_mailer.rb +19 -17
- data/app/models/proclaim/application_record.rb +5 -0
- data/app/models/proclaim/comment.rb +6 -1
- data/app/models/proclaim/post.rb +20 -28
- data/app/models/proclaim/subscription.rb +33 -11
- data/app/views/layouts/proclaim/subscription_mailer.html.erb +15 -36
- data/app/views/proclaim/comments/_comment.html.erb +7 -7
- data/app/views/proclaim/comments/_form.html.erb +7 -5
- data/app/views/proclaim/posts/_form.html.erb +34 -21
- data/app/views/proclaim/posts/show.html.erb +16 -3
- data/app/views/proclaim/subscription_mailer/welcome_email.html.erb +2 -6
- data/config/initializers/friendly_id.rb +20 -1
- data/config/routes.rb +1 -5
- data/db/migrate/20141108222616_create_proclaim_posts.rb +8 -1
- data/db/migrate/20141114235359_create_proclaim_comments.rb +1 -1
- data/db/migrate/20141115022230_create_proclaim_comment_hierarchies.rb +1 -1
- data/db/migrate/20141210234057_create_proclaim_subscriptions.rb +5 -4
- data/db/migrate/20150213015321_create_friendly_id_slugs.rb +1 -1
- data/lib/generators/proclaim/install_generator.rb +1 -1
- data/lib/generators/proclaim/templates/initialize_proclaim.rb +31 -29
- data/lib/generators/proclaim/views_generator.rb +1 -1
- data/lib/proclaim.rb +15 -15
- data/lib/proclaim/engine.rb +21 -19
- data/lib/proclaim/version.rb +1 -1
- data/vendor/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- data/vendor/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- data/vendor/assets/javascripts/contrib/auto-render.js +339 -0
- data/vendor/assets/javascripts/contrib/auto-render.min.js +1 -0
- data/vendor/assets/javascripts/contrib/auto-render.mjs +215 -0
- data/vendor/assets/javascripts/contrib/copy-tex.css +14 -0
- data/vendor/assets/javascripts/contrib/copy-tex.js +213 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.css +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.min.js +1 -0
- data/vendor/assets/javascripts/contrib/copy-tex.mjs +85 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.js +137 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mathtex-script-type.mjs +24 -0
- data/vendor/assets/javascripts/contrib/mhchem.js +3241 -0
- data/vendor/assets/javascripts/contrib/mhchem.min.js +1 -0
- data/vendor/assets/javascripts/contrib/mhchem.mjs +3109 -0
- data/vendor/assets/javascripts/katex.js +16517 -0
- data/vendor/assets/javascripts/katex.min.js +1 -0
- data/vendor/assets/javascripts/katex.mjs +16122 -0
- data/vendor/assets/javascripts/quill.core.js +8522 -0
- data/vendor/assets/javascripts/quill.js +11489 -0
- data/vendor/assets/javascripts/quill.min.js +8 -0
- data/vendor/assets/javascripts/quill.min.js.map +1 -0
- data/vendor/assets/stylesheets/katex.css +1011 -0
- data/vendor/assets/stylesheets/katex.min.css +1 -0
- data/vendor/assets/stylesheets/quill.bubble.css +952 -0
- data/vendor/assets/stylesheets/quill.core.css +397 -0
- data/vendor/assets/stylesheets/quill.snow.css +945 -0
- metadata +169 -278
- data/CHANGELOG +0 -77
- data/Gemfile +0 -14
- data/VERSION +0 -1
- data/app/assets/javascripts/proclaim/editor.js.coffee +0 -52
- data/app/assets/javascripts/proclaim/images.js.coffee +0 -3
- data/app/assets/javascripts/proclaim/subscriptions.js.coffee +0 -3
- data/app/assets/stylesheets/proclaim/images.scss +0 -3
- data/app/controllers/proclaim/images_controller.rb +0 -67
- data/app/helpers/proclaim/comments_helper.rb +0 -4
- data/app/helpers/proclaim/images_helper.rb +0 -4
- data/app/helpers/proclaim/subscriptions_helper.rb +0 -4
- data/app/models/proclaim/image.rb +0 -19
- data/app/policies/proclaim/image_policy.rb +0 -29
- data/app/uploaders/proclaim/image_uploader.rb +0 -82
- data/db/migrate/20141222224905_create_proclaim_images.rb +0 -12
- data/db/migrate/20150123115226_add_name_to_subscriptions.rb +0 -7
- data/db/migrate/20150213015850_add_slug_to_posts.rb +0 -20
- data/proclaim.gemspec +0 -51
- data/test/controllers/proclaim/comments_controller_test.rb +0 -228
- data/test/controllers/proclaim/images_controller_test.rb +0 -166
- data/test/controllers/proclaim/posts_controller_test.rb +0 -465
- data/test/controllers/proclaim/subscriptions_controller_test.rb +0 -154
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/Rakefile +0 -6
- data/test/dummy/app/assets/javascripts/application.js +0 -14
- data/test/dummy/app/assets/stylesheets/application.css +0 -16
- data/test/dummy/app/controllers/application_controller.rb +0 -15
- data/test/dummy/app/helpers/application_helper.rb +0 -28
- data/test/dummy/app/models/user.rb +0 -7
- data/test/dummy/app/views/layouts/application.html.erb +0 -16
- data/test/dummy/bin/bundle +0 -3
- data/test/dummy/bin/rails +0 -4
- data/test/dummy/bin/rake +0 -4
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -24
- data/test/dummy/config/boot.rb +0 -5
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -45
- data/test/dummy/config/environments/production.rb +0 -80
- data/test/dummy/config/environments/test.rb +0 -49
- data/test/dummy/config/initializers/assets.rb +0 -8
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/cookies_serializer.rb +0 -3
- data/test/dummy/config/initializers/filter_parameter_logging.rb +0 -4
- data/test/dummy/config/initializers/inflections.rb +0 -16
- data/test/dummy/config/initializers/mime_types.rb +0 -4
- data/test/dummy/config/initializers/session_store.rb +0 -3
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -23
- data/test/dummy/config/routes.rb +0 -5
- data/test/dummy/config/secrets.yml +0 -22
- data/test/dummy/db/migrate/20141117214323_create_users.rb +0 -10
- data/test/dummy/db/schema.rb +0 -91
- data/test/dummy/public/404.html +0 -67
- data/test/dummy/public/422.html +0 -67
- data/test/dummy/public/500.html +0 -66
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/proclaim/comment.rb +0 -11
- data/test/factories/proclaim/image.rb +0 -6
- data/test/factories/proclaim/post.rb +0 -14
- data/test/factories/proclaim/subscription.rb +0 -14
- data/test/factories/user.rb +0 -6
- data/test/helpers/proclaim/comments_helper_test.rb +0 -6
- data/test/helpers/proclaim/posts_helper_test.rb +0 -6
- data/test/helpers/proclaim/subscriptions_helper_test.rb +0 -6
- data/test/integration/with_javascript/comment_test.rb +0 -391
- data/test/integration/with_javascript/post_form_test.rb +0 -225
- data/test/integration/with_javascript/post_show_test.rb +0 -47
- data/test/integration/with_javascript/post_subscription_test.rb +0 -302
- data/test/integration/without_javascript/blog_subscription_test.rb +0 -114
- data/test/integration/without_javascript/manage_subscriptions_test.rb +0 -37
- data/test/integration/without_javascript/post_test.rb +0 -234
- data/test/integration/without_javascript/subscription_email_test.rb +0 -95
- data/test/integration/without_javascript/unsubscribe_test.rb +0 -32
- data/test/mailers/previews/proclaim/subscription_mailer_preview.rb +0 -22
- data/test/mailers/proclaim/subscription_mailer_test.rb +0 -91
- data/test/models/proclaim/comment_test.rb +0 -41
- data/test/models/proclaim/image_test.rb +0 -70
- data/test/models/proclaim/post_test.rb +0 -193
- data/test/models/proclaim/subscription_test.rb +0 -77
- data/test/policies/application_policy_test.rb +0 -87
- data/test/policies/proclaim/comment_policy_test.rb +0 -71
- data/test/policies/proclaim/image_policy_test.rb +0 -83
- data/test/policies/proclaim/post_policy_test.rb +0 -98
- data/test/policies/proclaim/subscription_policy_test.rb +0 -103
- data/test/proclaim_test.rb +0 -7
- data/test/support/images/test.jpg +0 -0
- data/test/support/pages/posts/edit_page.rb +0 -5
- data/test/support/pages/posts/show_page.rb +0 -47
- data/test/support/wait_for_ajax.rb +0 -11
- data/test/test_helper.rb +0 -71
- data/test/unit/proclaim/new_comment_callback_test.rb +0 -62
- data/test/unit/proclaim/new_subscription_callback_test.rb +0 -62
- data/test/unit/proclaim/post_published_callback_test.rb +0 -74
- data/vendor/assets/images/link.png +0 -0
- data/vendor/assets/images/remove.png +0 -0
- data/vendor/assets/images/resize-bigger.png +0 -0
- data/vendor/assets/images/resize-smaller.png +0 -0
- data/vendor/assets/images/unlink.png +0 -0
- data/vendor/assets/javascripts/addons/medium-editor-insert-embeds.js +0 -197
- data/vendor/assets/javascripts/addons/medium-editor-insert-images.js +0 -572
- data/vendor/assets/javascripts/addons/medium-editor-insert-maps.js +0 -50
- data/vendor/assets/javascripts/addons/medium-editor-insert-plugin.js +0 -496
- data/vendor/assets/javascripts/addons/medium-editor-insert-tables.js +0 -132
- data/vendor/assets/javascripts/medium-editor-insert-plugin.all.js +0 -1415
- data/vendor/assets/stylesheets/medium-editor-insert-plugin-frontend.css.scss +0 -55
- data/vendor/assets/stylesheets/medium-editor-insert-plugin.css.scss +0 -277
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 8ed66630af32fc0c1e8ef5217eb3cb511b60cfd34e9198fb1b8f1f12ae8054ff
|
|
4
|
+
data.tar.gz: a69c720636b0d4d86ea43bbd60294af073ad86561a165094cff5bad6a9c69960
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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("
|
|
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
|
|
File without changes
|
|
@@ -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
|
|
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/
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
11
|
// about supported directives.
|
|
12
12
|
//
|
|
13
|
-
//= require
|
|
14
|
-
//= require
|
|
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
|
|
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
|
|
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
|
|
69
|
-
|
|
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(
|
|
79
|
+
form.closest(@discussionClass).replaceWith(html)
|
|
77
80
|
else
|
|
78
81
|
target = $(form.data("target"))
|
|
79
82
|
if target.length == 1
|
|
80
|
-
target.append(
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
10
|
-
*
|
|
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
|
|
15
|
-
*= require
|
|
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:
|
|
24
|
+
background-image: image-url("proclaim/ajax_loader.gif");
|
|
26
25
|
background-repeat: no-repeat;
|
|
27
26
|
background-position: center;
|
|
28
27
|
}
|
|
File without changes
|
|
@@ -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.
|
|
86
|
+
div.post_body.editable:after
|
|
82
87
|
{
|
|
83
|
-
|
|
88
|
+
top: 0;
|
|
89
|
+
}
|
|
84
90
|
|
|
85
|
-
|
|
91
|
+
h1.post_title.editable
|
|
92
|
+
{
|
|
93
|
+
margin-bottom: 20px;
|
|
94
|
+
&:after
|
|
86
95
|
{
|
|
87
|
-
|
|
96
|
+
position: relative;
|
|
97
|
+
text-align: center;
|
|
88
98
|
}
|
|
89
99
|
}
|
|
90
100
|
|
|
91
|
-
|
|
92
|
-
{
|
|
93
|
-
|
|
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
|
-
.
|
|
108
|
+
.ql-editor
|
|
97
109
|
{
|
|
98
|
-
|
|
99
|
-
box-sizing: border-box;
|
|
100
|
-
}
|
|
110
|
+
overflow-y: visible;
|
|
101
111
|
|
|
102
|
-
|
|
103
|
-
{
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
p
|
|
113
|
+
{
|
|
114
|
+
img
|
|
115
|
+
{
|
|
116
|
+
float: left;
|
|
117
|
+
max-width: 30%;
|
|
118
|
+
margin-right: 15px;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
106
121
|
|
|
107
|
-
|
|
108
|
-
{
|
|
109
|
-
&:after
|
|
122
|
+
p.ql-align-right
|
|
110
123
|
{
|
|
111
|
-
|
|
112
|
-
|
|
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
|
}
|
|
File without changes
|
|
@@ -1,77 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module Proclaim
|
|
2
|
+
class ApplicationController < ::ApplicationController
|
|
3
|
+
protect_from_forgery with: :exception
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
include Pundit
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
|
|
7
8
|
|
|
8
|
-
|
|
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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
36
|
-
|
|
34
|
+
def pundit_user
|
|
35
|
+
current_author
|
|
36
|
+
end
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
def image_id_and_name_from_url(url)
|
|
39
|
+
match = url.match(/([^\/]*?)\/([^\/]*)\z/)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
41
|
+
return match[1], match[2]
|
|
42
|
+
end
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
52
|
-
|
|
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
|
-
|
|
55
|
-
|
|
54
|
+
begin
|
|
55
|
+
authorize object
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
if
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
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
|