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
|
@@ -43,55 +43,35 @@
|
|
|
43
43
|
padding: 0;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
{
|
|
48
|
-
margin: 0px;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.mediumInsert.small
|
|
46
|
+
p img
|
|
52
47
|
{
|
|
53
48
|
float: left;
|
|
54
49
|
max-width: 35%;
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.mediumInsert img
|
|
59
|
-
{
|
|
60
|
-
margin: 0px;
|
|
61
|
-
vertical-align: top;
|
|
62
|
-
max-width: 100%;
|
|
63
|
-
border: 0px none;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.mediumInsert.small img
|
|
67
|
-
{
|
|
68
|
-
max-width: 100%;
|
|
50
|
+
margin-right: 15px;
|
|
69
51
|
}
|
|
70
52
|
|
|
71
|
-
|
|
53
|
+
p.ql-align-right
|
|
72
54
|
{
|
|
73
|
-
|
|
74
|
-
margin: 0px;
|
|
75
|
-
text-align: center;
|
|
76
|
-
display: inline-block;
|
|
55
|
+
text-align: right;
|
|
77
56
|
}
|
|
78
57
|
|
|
79
|
-
|
|
58
|
+
p.ql-align-right img
|
|
80
59
|
{
|
|
81
|
-
|
|
82
|
-
|
|
60
|
+
float: right;
|
|
61
|
+
max-width: 35%;
|
|
62
|
+
margin-left: 15px;
|
|
83
63
|
}
|
|
84
64
|
|
|
85
|
-
|
|
65
|
+
p.ql-align-center img
|
|
86
66
|
{
|
|
87
|
-
|
|
88
|
-
width: 100%;
|
|
67
|
+
float: inherit;
|
|
68
|
+
max-width: 100%;
|
|
89
69
|
}
|
|
90
70
|
|
|
91
|
-
.
|
|
71
|
+
p.ql-align-justify img
|
|
92
72
|
{
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
float: inherit;
|
|
74
|
+
max-width: 100%;
|
|
95
75
|
}
|
|
96
76
|
|
|
97
77
|
td.post_body
|
|
@@ -159,8 +139,7 @@
|
|
|
159
139
|
<% url = root_url.gsub(/\A.*:\/\//, '').gsub(/\A(.*?)\/*\z/, '\1') %>
|
|
160
140
|
|
|
161
141
|
<% if @subscription.post %>
|
|
162
|
-
You're receiving this email because you requested to be notified if a new comment was made on <%= link_to "this post", @subscription.post %>
|
|
163
|
-
at <%= link_to url, posts_url %>.
|
|
142
|
+
You're receiving this email because you requested to be notified if a new comment was made on <%= link_to "this post", @subscription.post %> at <%= link_to url, posts_url %>.
|
|
164
143
|
<% else %>
|
|
165
144
|
You're receiving this email because you requested to be notified if a new post was made at <%= link_to url, posts_url %>.
|
|
166
145
|
<% end %>
|
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
%>
|
|
16
16
|
|
|
17
17
|
<%= link_to "Reply", "#", class: "reply",
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
data: {
|
|
19
|
+
form: "#{render(partial: "proclaim/comments/form", locals: {comment: replyComment, target: target})}",
|
|
20
|
+
target: target
|
|
21
|
+
} %>
|
|
22
22
|
|
|
23
23
|
<% if policy(comment).destroy? %>
|
|
24
24
|
<%= link_to "Edit", "#", class: "edit",
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
data: {
|
|
26
|
+
form: "#{render(partial: "proclaim/comments/form", locals: {comment: comment})}"
|
|
27
|
+
} %>
|
|
28
28
|
<% end %>
|
|
29
29
|
|
|
30
30
|
<% if policy(comment).destroy? %>
|
|
@@ -34,12 +34,14 @@
|
|
|
34
34
|
<% end %>
|
|
35
35
|
|
|
36
36
|
<%= label namespace_space+"subscription", "subscribe", "Notify me of other comments on this post" %><br />
|
|
37
|
-
<%=
|
|
37
|
+
<%= check_box_tag "subscribe", "subscribe", false, {id: namespace_space+"subscription_subscribe", class: "subscription_subscribe"} %><br />
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
<%= f.fields_for :subscription, Proclaim::Subscription.new do |f| %>
|
|
40
|
+
<div class = "subscription_email" style = "display: none;">
|
|
41
|
+
<%= f.label :email, "Email" %><br />
|
|
42
|
+
<%= f.email_field :email %>
|
|
43
|
+
</div>
|
|
44
|
+
<% end %>
|
|
43
45
|
|
|
44
46
|
<%= f.hidden_field :post_id %>
|
|
45
47
|
<%= f.hidden_field :parent_id %>
|
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
<script type="text/javascript">
|
|
2
2
|
$(document).ready(function()
|
|
3
3
|
{
|
|
4
|
+
<%
|
|
5
|
+
quill_body = @post.quill_body.html_safe
|
|
6
|
+
if quill_body.empty?
|
|
7
|
+
quill_body = '{}'
|
|
8
|
+
end
|
|
9
|
+
%>
|
|
4
10
|
<% if @post.new_record? %>
|
|
5
11
|
new Editor($(document).find("form.new_post"),
|
|
6
12
|
$(document).find("input#post_title"),
|
|
7
|
-
|
|
13
|
+
$(document).find("form.new_post h1.editable"),
|
|
14
|
+
'<%= @post.title.html_safe.strip %>',
|
|
8
15
|
$(document).find("input#post_body"),
|
|
9
|
-
$(document).find("
|
|
10
|
-
|
|
16
|
+
$(document).find("input#post_quill_body"),
|
|
17
|
+
$(document).find("form.new_post div.editable"),
|
|
18
|
+
$(document).find("div#scrolling-container"),
|
|
19
|
+
<%= quill_body %>,
|
|
20
|
+
<%= Proclaim.editor_toolbar.to_json.html_safe %>,
|
|
21
|
+
<%= Proclaim.editor_formats.to_json.html_safe %>);
|
|
11
22
|
<% else %>
|
|
12
23
|
new Editor($(document).find("form.edit_post"),
|
|
13
24
|
$(document).find("input#post_title"),
|
|
14
|
-
|
|
25
|
+
$(document).find("form.edit_post h1.editable"),
|
|
26
|
+
'<%= @post.title.html_safe.strip %>',
|
|
15
27
|
$(document).find("input#post_body"),
|
|
16
|
-
|
|
17
|
-
|
|
28
|
+
$(document).find("input#post_quill_body"),
|
|
29
|
+
$(document).find("form.edit_post div.editable"),
|
|
30
|
+
$(document).find("div#scrolling-container"),
|
|
31
|
+
<%= quill_body %>,
|
|
32
|
+
<%= Proclaim.editor_toolbar.to_json.html_safe %>,
|
|
33
|
+
<%= Proclaim.editor_formats.to_json.html_safe %>);
|
|
18
34
|
<% end %>
|
|
19
35
|
});
|
|
20
36
|
</script>
|
|
@@ -36,24 +52,20 @@
|
|
|
36
52
|
<%=
|
|
37
53
|
fake_form_field @post, :title do
|
|
38
54
|
content_tag :h1, @post.title, class: "post_title editable",
|
|
39
|
-
|
|
40
|
-
placeholder: "Post Title",
|
|
41
|
-
disable_return: "true",
|
|
42
|
-
disable_toolbar: "true",
|
|
43
|
-
}
|
|
55
|
+
contenteditable: true, placeholder: "Post Title"
|
|
44
56
|
end
|
|
45
57
|
%>
|
|
46
58
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
59
|
+
<div id="scrolling-container">
|
|
60
|
+
<%=
|
|
61
|
+
fake_form_field @post, :body do
|
|
62
|
+
content_tag :div, '', class: "post_body editable",
|
|
63
|
+
data: {
|
|
64
|
+
placeholder: "Post Body",
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
%>
|
|
68
|
+
</div>
|
|
57
69
|
|
|
58
70
|
<div class = "post_information" style = "margin-bottom: 30px;">
|
|
59
71
|
<% if @post.published? %>
|
|
@@ -68,6 +80,7 @@
|
|
|
68
80
|
|
|
69
81
|
<%= f.hidden_field :title %>
|
|
70
82
|
<%= f.hidden_field :body %>
|
|
83
|
+
<%= f.hidden_field :quill_body %>
|
|
71
84
|
|
|
72
85
|
<% if @post.published? and not @post.new_record? %>
|
|
73
86
|
This post has already been published
|
|
@@ -12,7 +12,19 @@
|
|
|
12
12
|
'a.edit',
|
|
13
13
|
'a.delete',
|
|
14
14
|
'input.subscription_subscribe',
|
|
15
|
-
|
|
15
|
+
'div.subscription_email');
|
|
16
|
+
|
|
17
|
+
<%
|
|
18
|
+
quill_body = @post.quill_body.html_safe
|
|
19
|
+
if quill_body.empty?
|
|
20
|
+
quill_body = '{}'
|
|
21
|
+
end
|
|
22
|
+
%>
|
|
23
|
+
new Quill('div.post_body', {
|
|
24
|
+
scrollingContainer: 'div#scrolling-container',
|
|
25
|
+
theme: 'bubble',
|
|
26
|
+
readOnly: true,
|
|
27
|
+
}).setContents(<%= quill_body %>)
|
|
16
28
|
});
|
|
17
29
|
</script>
|
|
18
30
|
|
|
@@ -32,8 +44,9 @@
|
|
|
32
44
|
<div class = "post">
|
|
33
45
|
<h1 class = "post_title"><%= content_for :proclaim_title %></h1>
|
|
34
46
|
|
|
35
|
-
<div
|
|
36
|
-
|
|
47
|
+
<div id="scrolling-container">
|
|
48
|
+
<div class = "post_body show">
|
|
49
|
+
</div>
|
|
37
50
|
</div>
|
|
38
51
|
|
|
39
52
|
<div class = "post_information">
|
|
@@ -9,15 +9,11 @@
|
|
|
9
9
|
<td class = "post_body">
|
|
10
10
|
<% if @subscription.post %>
|
|
11
11
|
<p>
|
|
12
|
-
You signed up to be notified of any new comments on
|
|
13
|
-
<%= link_to "this post", @subscription.post %>.
|
|
12
|
+
You signed up to be notified of any new comments on <%= link_to "this post", @subscription.post %>.
|
|
14
13
|
</p>
|
|
15
14
|
<% else %>
|
|
16
15
|
<p>
|
|
17
|
-
You signed up to receive a notification each time a new post is
|
|
18
|
-
made at
|
|
19
|
-
<%= link_to root_url.gsub(/\A.*:\/\//, '').gsub(/\A(.*?)\/*\z/, '\1'),
|
|
20
|
-
posts_url %>.
|
|
16
|
+
You signed up to receive a notification each time a new post is made at <%= link_to root_url.gsub(/\A.*:\/\//, '').gsub(/\A(.*?)\/*\z/, '\1'), posts_url %>.
|
|
21
17
|
</p>
|
|
22
18
|
|
|
23
19
|
<p>Thanks for subscribing!</p>
|
|
@@ -18,6 +18,12 @@ FriendlyId.defaults do |config|
|
|
|
18
18
|
|
|
19
19
|
config.reserved_words = %w(new edit index session login logout users admin
|
|
20
20
|
stylesheets assets javascripts images)
|
|
21
|
+
|
|
22
|
+
# This adds an option to treat reserved words as conflicts rather than exceptions.
|
|
23
|
+
# When there is no good candidate, a UUID will be appended, matching the existing
|
|
24
|
+
# conflict behavior.
|
|
25
|
+
|
|
26
|
+
# config.treat_reserved_as_conflict = true
|
|
21
27
|
|
|
22
28
|
# ## Friendly Finders
|
|
23
29
|
#
|
|
@@ -52,6 +58,10 @@ FriendlyId.defaults do |config|
|
|
|
52
58
|
#
|
|
53
59
|
# config.slug_column = 'slug'
|
|
54
60
|
#
|
|
61
|
+
# By default, slug has no size limit, but you can change it if you wish.
|
|
62
|
+
#
|
|
63
|
+
# config.slug_limit = 255
|
|
64
|
+
#
|
|
55
65
|
# When FriendlyId can not generate a unique ID from your base method, it appends
|
|
56
66
|
# a UUID, separated by a single dash. You can configure the character used as the
|
|
57
67
|
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
|
@@ -59,16 +69,25 @@ FriendlyId.defaults do |config|
|
|
|
59
69
|
#
|
|
60
70
|
# config.sequence_separator = '-'
|
|
61
71
|
#
|
|
72
|
+
# Note that you must use the :slugged addon **prior** to the line which
|
|
73
|
+
# configures the sequence separator, or else FriendlyId will raise an undefined
|
|
74
|
+
# method error.
|
|
75
|
+
#
|
|
62
76
|
# ## Tips and Tricks
|
|
63
77
|
#
|
|
64
78
|
# ### Controlling when slugs are generated
|
|
65
79
|
#
|
|
66
80
|
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
|
67
81
|
# nil, but if you're using a column as your base method can change this
|
|
68
|
-
# behavior by overriding the `should_generate_new_friendly_id
|
|
82
|
+
# behavior by overriding the `should_generate_new_friendly_id?` method that
|
|
69
83
|
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
|
70
84
|
# more like 4.0.
|
|
85
|
+
# Note: Use(include) Slugged module in the config if using the anonymous module.
|
|
86
|
+
# If you have `friendly_id :name, use: slugged` in the model, Slugged module
|
|
87
|
+
# is included after the anonymous module defined in the initializer, so it
|
|
88
|
+
# overrides the `should_generate_new_friendly_id?` method from the anonymous module.
|
|
71
89
|
#
|
|
90
|
+
# config.use :slugged
|
|
72
91
|
# config.use Module.new {
|
|
73
92
|
# def should_generate_new_friendly_id?
|
|
74
93
|
# slug.blank? || <your_column_name_here>_changed?
|
data/config/routes.rb
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
Proclaim::Engine.routes.draw do
|
|
2
2
|
resources :posts
|
|
3
|
-
|
|
4
|
-
resources :images, only: [:create, :destroy]
|
|
5
|
-
post 'images/cache' => 'images#cache', as: :cache_image
|
|
6
|
-
post 'images/discard' => 'images#discard', as: :discard_image
|
|
7
|
-
|
|
8
3
|
resources :comments, only: [:create, :update, :destroy]
|
|
9
4
|
|
|
10
5
|
# Subscription administration is authenticated via tokens
|
|
11
6
|
resources :subscriptions, param: :token, except: [:edit, :update]
|
|
12
7
|
|
|
13
8
|
root 'posts#index'
|
|
9
|
+
default_url_options Rails.application.config.action_mailer.default_url_options
|
|
14
10
|
end
|
|
@@ -1,15 +1,22 @@
|
|
|
1
|
-
class CreateProclaimPosts < ActiveRecord::Migration
|
|
1
|
+
class CreateProclaimPosts < ActiveRecord::Migration[5.2]
|
|
2
2
|
def change
|
|
3
3
|
create_table :proclaim_posts do |t|
|
|
4
4
|
t.belongs_to :author, index: true
|
|
5
5
|
|
|
6
6
|
t.string :title, null: false, default: ""
|
|
7
7
|
t.text :body, null: false, default: ""
|
|
8
|
+
t.text :quill_body, null: false, default: ""
|
|
8
9
|
|
|
9
10
|
t.string :state, null: false, default: "draft", index: true
|
|
11
|
+
t.string :slug
|
|
10
12
|
|
|
11
13
|
t.datetime :published_at
|
|
12
14
|
t.timestamps null: false
|
|
13
15
|
end
|
|
16
|
+
|
|
17
|
+
# This ensures that even if two clients try to create the same
|
|
18
|
+
# post slug at exactly the same time, the database won't accept
|
|
19
|
+
# one of them (Rails would have)
|
|
20
|
+
add_index :proclaim_posts, :slug, unique: true
|
|
14
21
|
end
|
|
15
22
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class CreateProclaimCommentHierarchies < ActiveRecord::Migration
|
|
1
|
+
class CreateProclaimCommentHierarchies < ActiveRecord::Migration[5.2]
|
|
2
2
|
def change
|
|
3
3
|
create_table :proclaim_comment_hierarchies, :id => false do |t|
|
|
4
4
|
# ID of the parent/grandparent/great-grandparent/etc. comments
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
class CreateProclaimSubscriptions < ActiveRecord::Migration
|
|
1
|
+
class CreateProclaimSubscriptions < ActiveRecord::Migration[5.2]
|
|
2
2
|
def change
|
|
3
3
|
create_table :proclaim_subscriptions do |t|
|
|
4
|
-
t.belongs_to :
|
|
4
|
+
t.belongs_to :comment, index: true
|
|
5
|
+
t.string :name, null: false, default: ""
|
|
5
6
|
t.string :email
|
|
6
7
|
|
|
7
8
|
t.timestamps null: false
|
|
8
9
|
end
|
|
9
10
|
|
|
10
|
-
add_foreign_key :proclaim_subscriptions, :
|
|
11
|
+
add_foreign_key :proclaim_subscriptions, :proclaim_comments, column: :comment_id
|
|
11
12
|
|
|
12
13
|
# This ensures that even if two clients try to create the same
|
|
13
14
|
# subscription at exactly the same time, the database won't accept
|
|
14
15
|
# one of them (Rails would have)
|
|
15
|
-
add_index :proclaim_subscriptions, [:
|
|
16
|
+
add_index :proclaim_subscriptions, [:comment_id, :email], :unique => true
|
|
16
17
|
end
|
|
17
18
|
end
|
|
@@ -3,58 +3,60 @@ Proclaim.setup do |config|
|
|
|
3
3
|
# `current_author_method` and `authentication_method`. For example, setting
|
|
4
4
|
# `author_class = "Admin"` changes the default `current_author_method` to be
|
|
5
5
|
# `:current_admin`, etc.
|
|
6
|
-
#config.author_class = "User"
|
|
6
|
+
# config.author_class = "User"
|
|
7
7
|
|
|
8
8
|
# Method to obtain the name of the author. This should be a method on the
|
|
9
9
|
# author class.
|
|
10
|
-
#config.author_name_method = :name
|
|
10
|
+
# config.author_name_method = :name
|
|
11
11
|
|
|
12
12
|
# Method to obtain the currently-authenticated user. Should return nil if
|
|
13
13
|
# no user is currently authenticated.
|
|
14
|
-
#config.current_author_method = :current_user
|
|
14
|
+
# config.current_author_method = :current_user
|
|
15
15
|
|
|
16
16
|
# Method to verify that a user is authenticated, and if not, will redirect
|
|
17
17
|
# to some sort of authentication page.
|
|
18
|
-
#config.authentication_method = :authenticate_user!
|
|
18
|
+
# config.authentication_method = :authenticate_user!
|
|
19
19
|
|
|
20
20
|
# Maximum length for the excerpts shown on the posts index.
|
|
21
|
-
#config.excerpt_length = 500
|
|
21
|
+
# config.excerpt_length = 500
|
|
22
22
|
|
|
23
23
|
# Buttons to display on post editor toolbar
|
|
24
|
-
#config.
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
|
|
33
|
-
#
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
24
|
+
# config.editor_toolbar = [
|
|
25
|
+
# ['bold', 'italic', 'underline', 'strike', 'code'],
|
|
26
|
+
# [{ 'header': 1 }, { 'header': 2 }],
|
|
27
|
+
# ['code-block'],
|
|
28
|
+
# [{ 'align': []}],
|
|
29
|
+
# [{ 'list': 'ordered'}, { 'list': 'bullet'}],
|
|
30
|
+
# ['link', 'image', 'video', 'formula']
|
|
31
|
+
# ]
|
|
32
|
+
|
|
33
|
+
# Formats to allow in the editor (can be a superset of the toolbar)
|
|
34
|
+
# config.editor_formats = [
|
|
35
|
+
# 'align', 'blockquote', 'bold', 'code', 'code-block', 'formula', 'header',
|
|
36
|
+
# 'image', 'italic', 'link', 'list', 'strike', 'underline', 'video'
|
|
37
|
+
# ]
|
|
38
38
|
|
|
39
39
|
# Email address to use in the "from" field of all emails
|
|
40
|
-
#config.mailer_sender = '"My Blog" <blog@example.com>'
|
|
40
|
+
# config.mailer_sender = '"My Blog" <blog@example.com>'
|
|
41
41
|
|
|
42
|
-
#
|
|
43
|
-
# any tokens already generated
|
|
44
|
-
#
|
|
42
|
+
# The secret key used by Proclaim for subscription tokens. Changing this will
|
|
43
|
+
# invalidate any tokens already generated, making it impossible to unsubscribe from
|
|
44
|
+
# old links. Proclaim will use the `secret_key_base` as its `secret_key` by default.
|
|
45
|
+
# You can change it below and use your own secret key.
|
|
46
|
+
# config.secret_key = '<%= SecureRandom.hex(64) %>'
|
|
45
47
|
|
|
46
48
|
# Register a callback to be called when a post is published
|
|
47
|
-
#config.after_post_published do |post|
|
|
49
|
+
# config.after_post_published do |post|
|
|
48
50
|
# puts "A post was just published!"
|
|
49
|
-
#end
|
|
51
|
+
# end
|
|
50
52
|
|
|
51
53
|
# Register a callback to be called when a new comment is created
|
|
52
|
-
#config.after_new_comment do |comment|
|
|
54
|
+
# config.after_new_comment do |comment|
|
|
53
55
|
# puts "A new comment was just made!"
|
|
54
|
-
#end
|
|
56
|
+
# end
|
|
55
57
|
|
|
56
58
|
# Register a callback to be called when a new subscription is created
|
|
57
|
-
#config.after_new_subscription do |subscription|
|
|
59
|
+
# config.after_new_subscription do |subscription|
|
|
58
60
|
# puts "A new subscription was just created!"
|
|
59
|
-
#end
|
|
61
|
+
# end
|
|
60
62
|
end
|