commontator 6.0.1 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/views/commontator/comments/_form.html.erb +15 -7
- data/app/views/commontator/comments/_show.html.erb +9 -1
- data/app/views/commontator/comments/cancel.js.erb +9 -3
- data/app/views/commontator/comments/create.js.erb +9 -4
- data/app/views/commontator/comments/new.js.erb +10 -4
- data/app/views/commontator/comments/show.js.erb +4 -10
- data/app/views/commontator/threads/_hide_show_links.js.erb +8 -2
- data/app/views/commontator/threads/_reply.html.erb +8 -8
- data/config/initializers/commontator.rb +1 -3
- data/lib/commontator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c63a6212f25d57ea206e1cfb23f4c8dff604ce26f6fb1a5d1ddb0088b030a4a5
|
4
|
+
data.tar.gz: 23ecd8f13e5af29e8968882361b2e87506d80ac23a209e4116c638a63514f46e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04c523c45acc09a1062fbeeefbe1e328ee439b7f929f9fdb5d00a7d510d547434d2648cfbb1326d6ad0e7c182d91e2c745839434ac948af297fce964cb2c0724
|
7
|
+
data.tar.gz: 64b8731da68531908d2230936f21d647a5b2567d044490ebdbce8d85aa2dcdddff84ae68f31bd88b282df59f5ca7df19d2bf9d657a644715a0f6324c3e8ae548
|
@@ -1,9 +1,12 @@
|
|
1
1
|
<%
|
2
|
-
# Views that use this partial must provide the following
|
2
|
+
# Views that use this partial must provide the following variable:
|
3
3
|
# comment
|
4
4
|
#
|
5
|
+
|
6
|
+
new_record = comment.new_record?
|
7
|
+
|
5
8
|
# Optionally, they can also supply the following variables:
|
6
|
-
thread ||= nil
|
9
|
+
thread ||= new_record ? comment.thread : nil
|
7
10
|
no_remote ||= false
|
8
11
|
%>
|
9
12
|
|
@@ -11,7 +14,7 @@
|
|
11
14
|
|
12
15
|
<% if comment.errors.any? %>
|
13
16
|
<div class="error-explanation">
|
14
|
-
<h3><%= t "commontator.comment.errors.#{
|
17
|
+
<h3><%= t "commontator.comment.errors.#{new_record ? 'create' : 'update'}" %></h3>
|
15
18
|
|
16
19
|
<ul>
|
17
20
|
<% comment.errors.full_messages.each do |msg| %>
|
@@ -33,15 +36,20 @@
|
|
33
36
|
|
34
37
|
<div class="field">
|
35
38
|
<%=
|
36
|
-
form.text_area :body, rows: '7', id:
|
37
|
-
"commontator-thread-#{@commontator_thread.id}-new-comment-body" :
|
39
|
+
form.text_area :body, rows: '7', id: new_record ?
|
40
|
+
comment.parent.nil? ? "commontator-thread-#{@commontator_thread.id}-new-comment-body" :
|
41
|
+
"commontator-comment-#{comment.parent.id}-reply" :
|
38
42
|
"commontator-comment-#{comment.id}-edit-body"
|
39
43
|
%>
|
40
44
|
<%= javascript_tag('Commontator.initMentions();') if config.mentions_enabled %>
|
41
45
|
</div>
|
42
46
|
|
43
47
|
<div class="submit">
|
44
|
-
<%= form.submit t("commontator.comment.actions.#{
|
45
|
-
<%=
|
48
|
+
<%= form.submit t("commontator.comment.actions.#{new_record ? 'create' : 'update'}") %>
|
49
|
+
<%=
|
50
|
+
form.submit(
|
51
|
+
t('commontator.comment.actions.cancel'), name: 'cancel'
|
52
|
+
) unless config.new_comment_style == :t && new_record && comment.parent.nil?
|
53
|
+
%>
|
46
54
|
</div>
|
47
55
|
<% end %>
|
@@ -62,7 +62,7 @@
|
|
62
62
|
|
63
63
|
<div id="commontator-comment-<%= comment.id %>-section-bottom" class="section bottom">
|
64
64
|
<% unless comment.is_deleted? %>
|
65
|
-
<span id="commontator-comment-<%= comment.id %>-reply" class="reply">
|
65
|
+
<span id="commontator-comment-<%= comment.id %>-reply-link" class="reply">
|
66
66
|
<%=
|
67
67
|
link_to(
|
68
68
|
t('commontator.comment.actions.reply'),
|
@@ -83,8 +83,16 @@
|
|
83
83
|
</div>
|
84
84
|
|
85
85
|
<div id="commontator-comment-<%= comment.id %>-children" class="children">
|
86
|
+
<% if thread.config.comment_order == :l %>
|
87
|
+
<div id="commontator-comment-<%= comment.id %>-reply" class="reply"></div>
|
88
|
+
<% end %>
|
89
|
+
|
86
90
|
<%= render partial: 'commontator/comments/list',
|
87
91
|
locals: { user: user, nested_comments: nested_children } %>
|
92
|
+
|
93
|
+
<% if thread.config.comment_order != :l %>
|
94
|
+
<div id="commontator-comment-<%= comment.id %>-reply" class="reply"></div>
|
95
|
+
<% end %>
|
88
96
|
</div>
|
89
97
|
|
90
98
|
<div id="commontator-comment-<%= comment.id %>-pagination" class="pagination">
|
@@ -1,7 +1,13 @@
|
|
1
|
-
<% if @comment.nil? ||
|
2
|
-
|
1
|
+
<% if @comment.nil? || @comment.new_record? %>
|
2
|
+
<%
|
3
|
+
id = @comment.nil? || @comment.parent.nil? ?
|
4
|
+
"commontator-thread-#{@commontator_thread.id}-new-comment" :
|
5
|
+
"commontator-comment-#{@comment.parent.id}-reply"
|
6
|
+
%>
|
3
7
|
|
4
|
-
$("
|
8
|
+
$("#<%= id %>").hide();
|
9
|
+
|
10
|
+
$("#<%= id %>-link").fadeIn();
|
5
11
|
<% else %>
|
6
12
|
$("#commontator-comment-<%= @comment.id %>-body").html("<%= escape_javascript(
|
7
13
|
render partial: 'body', locals: { comment: @comment }
|
@@ -2,9 +2,11 @@
|
|
2
2
|
if @comment.parent.nil?
|
3
3
|
partial = 'threads'
|
4
4
|
extra_locals = {}
|
5
|
+
id = "commontator-thread-#{@commontator_thread.id}-new-comment"
|
5
6
|
else
|
6
7
|
partial = 'comments'
|
7
8
|
extra_locals = { comment: @comment.parent }
|
9
|
+
id = "commontator-comment-#{@comment.parent.id}-reply"
|
8
10
|
end
|
9
11
|
|
10
12
|
render partial: "commontator/#{partial}/show", locals: extra_locals.merge(
|
@@ -16,17 +18,20 @@
|
|
16
18
|
%>
|
17
19
|
|
18
20
|
<% if @commontator_new_comment.nil? %>
|
19
|
-
$("
|
21
|
+
$("#<%= id %>").hide();
|
20
22
|
|
21
|
-
$("
|
23
|
+
$("#<%= id %>-link").fadeIn();
|
22
24
|
<% else %>
|
23
|
-
$("
|
25
|
+
$("#<%= id %>").html("<%= escape_javascript(
|
24
26
|
render partial: 'form', locals: {
|
25
27
|
comment: @commontator_new_comment, thread: @commontator_thread
|
26
28
|
}
|
27
29
|
) %>");
|
28
30
|
<% end %>
|
29
31
|
|
30
|
-
$("#commontator-comment-<%= @comment.id %>").hide().fadeIn()
|
32
|
+
var commontatorComment = $("#commontator-comment-<%= @comment.id %>").hide().fadeIn();
|
33
|
+
$('html, body').animate(
|
34
|
+
{ scrollTop: commontatorComment.offset().top - window.innerHeight/2 }, 'fast'
|
35
|
+
);
|
31
36
|
|
32
37
|
<%= javascript_proc %>
|
@@ -1,9 +1,15 @@
|
|
1
|
-
|
1
|
+
<%
|
2
|
+
id = @comment.parent.nil? ? "commontator-thread-#{@commontator_thread.id}-new-comment" :
|
3
|
+
"commontator-comment-#{@comment.parent.id}-reply"
|
4
|
+
%>
|
5
|
+
|
6
|
+
var commontatorForm = $("#<%= id %>").html("<%= escape_javascript(
|
2
7
|
render partial: 'form', locals: { comment: @comment, thread: @commontator_thread }
|
3
|
-
) %>").
|
8
|
+
) %>").hide().fadeIn();
|
9
|
+
$('html, body').animate({ scrollTop: commontatorForm.offset().top - window.innerHeight/2 }, 'fast');
|
4
10
|
|
5
|
-
$("
|
11
|
+
$("#<%= id %>-link").hide();
|
6
12
|
|
7
|
-
$('
|
13
|
+
$('#<%= id %>-body').focus();
|
8
14
|
|
9
15
|
<%= javascript_proc %>
|
@@ -14,17 +14,11 @@ var commontatorOldCommentIds = $("#commontator-comment-<%=
|
|
14
14
|
}
|
15
15
|
%>
|
16
16
|
|
17
|
-
var commontatorOldComments = $(commontatorOldCommentIds);
|
18
17
|
var commontatorNewComments = $("#commontator-comment-<%=
|
19
18
|
@comment.id
|
20
|
-
%>-children").children().not(
|
21
|
-
|
22
|
-
commontatorNewComments.
|
23
|
-
|
24
|
-
if (commontatorOldComments.length > 0) {
|
25
|
-
commontatorOldComments[commontatorOldComments.length - 1].scrollIntoView();
|
26
|
-
} else {
|
27
|
-
$("#commontator-comment-<%= @comment.id %>")[0].scrollIntoView();
|
28
|
-
}
|
19
|
+
%>-children").children().not(commontatorOldCommentIds).hide().fadeIn();
|
20
|
+
$('html, body').animate(
|
21
|
+
{ scrollTop: commontatorNewComments.offset().top - window.innerHeight/2 }, 'fast'
|
22
|
+
);
|
29
23
|
|
30
24
|
<%= javascript_proc %>
|
@@ -6,11 +6,17 @@
|
|
6
6
|
$("#commontator-thread-<%= thread.id %>-hide-link").click(function() {
|
7
7
|
$("#commontator-thread-<%= thread.id %>-content").hide();
|
8
8
|
|
9
|
-
$("#commontator-thread-<%= thread.id %>-show").fadeIn()
|
9
|
+
var commontatorLink = $("#commontator-thread-<%= thread.id %>-show").fadeIn();
|
10
|
+
$('html, body').animate(
|
11
|
+
{ scrollTop: commontatorLink.offset().top - window.innerHeight/2 }, 'fast'
|
12
|
+
);
|
10
13
|
});
|
11
14
|
|
12
15
|
$("#commontator-thread-<%= thread.id %>-show-link").click(function() {
|
13
|
-
$("#commontator-thread-<%= thread.id %>-content").fadeIn()
|
16
|
+
var commontatorThread = $("#commontator-thread-<%= thread.id %>-content").fadeIn();
|
17
|
+
$('html, body').animate(
|
18
|
+
{ scrollTop: commontatorThread.offset().top - window.innerHeight/2 }, 'fast'
|
19
|
+
);
|
14
20
|
|
15
21
|
$("#commontator-thread-<%= thread.id %>-show").hide();
|
16
22
|
});
|
@@ -10,6 +10,14 @@
|
|
10
10
|
<% elsif !user %>
|
11
11
|
<p><%= t 'commontator.require_login' %>.</p>
|
12
12
|
<% else %>
|
13
|
+
<% if @commontator_new_comment.nil? %>
|
14
|
+
<div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment">
|
15
|
+
<%= link_to t('commontator.comment.actions.new'),
|
16
|
+
commontator.new_thread_comment_path(thread),
|
17
|
+
remote: true %>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
|
13
21
|
<div id="commontator-thread-<%= thread.id %>-new-comment" class="new-comment<%=
|
14
22
|
@commontator_new_comment.nil? ? ' hidden' : '' %>">
|
15
23
|
<% unless @commontator_new_comment.nil? %>
|
@@ -20,13 +28,5 @@
|
|
20
28
|
%>
|
21
29
|
<% end %>
|
22
30
|
</div>
|
23
|
-
|
24
|
-
<% if @commontator_new_comment.nil? %>
|
25
|
-
<div id="commontator-thread-<%= thread.id %>-new-comment-link" class="new-comment">
|
26
|
-
<%= link_to t('commontator.comment.actions.new'),
|
27
|
-
commontator.new_thread_comment_path(thread),
|
28
|
-
remote: true %>
|
29
|
-
</div>
|
30
|
-
<% end %>
|
31
31
|
<% end %>
|
32
32
|
</div>
|
@@ -210,9 +210,7 @@ Commontator.configure do |config|
|
|
210
210
|
# How to display the "new comment" form
|
211
211
|
# Valid options:
|
212
212
|
# :t (always present in the thread's page)
|
213
|
-
# :l (link to the form
|
214
|
-
# Not yet implemented:
|
215
|
-
# :n (link to the form; opens in a new window)
|
213
|
+
# :l (link to the form, which appears in the same location the new comment will appear)
|
216
214
|
# Default: :l
|
217
215
|
config.new_comment_style = :l
|
218
216
|
|
data/lib/commontator/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
COMMONTATOR_VERSION = '6.0
|
1
|
+
COMMONTATOR_VERSION = '6.1.0'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commontator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|