decidim-comments 0.29.3 → 0.29.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d3bf31067d9c3f95c93946db7b2069e11f2074a125abd5306c59aa043b0201d
4
- data.tar.gz: 3d15947b6f6a12afe04c218a31e2f4c8f24d28c99eeb72d82355ea1ca001b862
3
+ metadata.gz: a6aff7b51b0967b0ba782fd4c152d7a9200e98cc78a957e60c36e6dfb4d7dd9a
4
+ data.tar.gz: 0e9cbc415c784ed2f6d82cc4c9869a3ed271f0607ffd27c76590bbc9509533ab
5
5
  SHA512:
6
- metadata.gz: 81cad4916eb7e5d0a84918ceaf471f9fe9168666d1dfc823dda644cd9cb26817b039842e5f69b1d50fa415b9442d58b1fa8e831ab62de85b5b33ce7793b512d8
7
- data.tar.gz: d7afb716ed31968beab5c46c0de89c30727f02978c53e55df7020a44593470067acfa162e987459b8d0a856e82a3e2b8ccbdadd2ce0cef4fbaef7a276c56c3a3
6
+ metadata.gz: 291d09da2c4e4315cc3f49e9ff21c64ca3d8a7ac2d9d81c1b896703afd3886a42e4b1d78fee5dfbfd93fe09fa5062334aaa14db2579191dbbb5a1eedfb6a946b
7
+ data.tar.gz: 41c71a289c54c98db7f19b8fcb966a60ce1f867e76cb02b0f54dfdd841c07f5a76d7fefd7aacff5410f74d608d6fc33d565933131c71473beb3a4189f5c56b31
@@ -0,0 +1,28 @@
1
+ <div id="comments">
2
+ <div class="comments">
3
+ <div class="comments__header">
4
+ <h2 class="h4">
5
+ <% if single_comment? %>
6
+ <%= t("decidim.components.comments.comment_details_title") %>
7
+ <% else %>
8
+ <%= icon "chat-1-line", class: "fill-tertiary w-6 h-6 inline-block align-middle" %>
9
+ <span class="comments-count inline-block align-middle">
10
+ <%= t("decidim.components.comments.title", count: comments_count) %>
11
+ </span>
12
+ <% end %>
13
+ </h2>
14
+ <%= render :order_control %>
15
+ </div>
16
+ <%= single_comment_warning %>
17
+ <%= blocked_comments_warning %>
18
+ <div class="comment-threads" id="<%= threads_node_id %>" aria-live="polite">
19
+ <%= comments_loading %>
20
+ <% comments.each do |comment| %>
21
+ <%= cell("decidim/comments/comment_thread", comment, order:) %>
22
+ <% end %>
23
+ </div>
24
+ <%= add_comment %>
25
+ <%= user_comments_blocked_warning %>
26
+ </div>
27
+ <%= cell("decidim/announcement", t("decidim.components.comments.loading"), callout_class: "primary loading-comments hidden") %>
28
+ </div>
@@ -1,30 +1,3 @@
1
1
  <%= content_tag :div, id: node_id, data: { decidim_comments: comments_data } do %>
2
- <div id="comments">
3
- <div class="comments">
4
- <div class="comments__header">
5
- <h2 class="h4">
6
- <% if single_comment? %>
7
- <%= t("decidim.components.comments.comment_details_title") %>
8
- <% else %>
9
- <%= icon "chat-1-line", class: "fill-tertiary w-6 h-6 inline-block align-middle" %>
10
- <span class="comments-count inline-block align-middle">
11
- <%= t("decidim.components.comments.title", count: comments_count) %>
12
- </span>
13
- <% end %>
14
- </h2>
15
- <%= render :order_control %>
16
- </div>
17
- <%= single_comment_warning %>
18
- <%= blocked_comments_warning %>
19
- <div class="comment-threads" id="<%= threads_node_id %>" aria-live="polite">
20
- <%= comments_loading %>
21
- <% comments.each do |comment| %>
22
- <%= cell("decidim/comments/comment_thread", comment, order:) %>
23
- <% end %>
24
- </div>
25
- <%= add_comment %>
26
- <%= user_comments_blocked_warning %>
27
- </div>
28
- <%= cell("decidim/announcement", t("decidim.components.comments.loading"), callout_class: "primary loading-comments hidden") %>
29
- </div>
2
+ <%= render :inline %>
30
3
  <% end %>
@@ -5,6 +5,11 @@ module Decidim
5
5
  # A cell to display a comments section for a commentable object.
6
6
  class CommentsCell < Decidim::ViewModel
7
7
  delegate :user_signed_in?, to: :controller
8
+
9
+ def inline
10
+ render :inline
11
+ end
12
+
8
13
  def add_comment
9
14
  return if single_comment?
10
15
  return if comments_blocked?
@@ -55,6 +55,7 @@ export default class CommentsComponent {
55
55
  if (this.mounted) {
56
56
  this.mounted = false;
57
57
  this._stopPolling();
58
+ this.lastCommentId = null;
58
59
 
59
60
  $(".add-comment [data-opinion-toggle] button", this.$element).off("click.decidim-comments");
60
61
  $(".add-comment textarea", this.$element).off("input.decidim-comments");
@@ -5,6 +5,7 @@
5
5
  var component = $comments.data("comments");
6
6
 
7
7
  $(".loading-comments").addClass("hidden");
8
+
8
9
  var commentsIds = [];
9
10
  <% @comments.each do |comment| %>
10
11
  var commentId = <%= comment.id.to_json %>;
@@ -22,6 +23,8 @@
22
23
  }
23
24
  <% end %>
24
25
  if (commentsIds.length) {
26
+ component.lastCommentId = <%= @comments.last&.id || 0 %>;
27
+
25
28
  Rails.fire(document, "comments:loaded", {
26
29
  commentsIds: commentsIds
27
30
  });
@@ -5,16 +5,12 @@
5
5
  var component = $comments.data("comments");
6
6
  component.unmountComponent();
7
7
 
8
- var commentsHtml = '<%== j(render partial: "comments").strip %>';
8
+ var commentsHtml = '<%== j(inline_comments_for(commentable, order:).inline).strip %>';
9
9
  $(".loading-comments").addClass("hidden");
10
- $comments.replaceWith(commentsHtml);
10
+ $comments.html(commentsHtml);
11
11
 
12
- $comments = $("#" + rootCommentableId);
13
-
14
- // Re-create the component
15
- component = new Decidim.CommentsComponent($comments, $comments.data("decidim-comments"));
12
+ // Re-mount the component
16
13
  component.mountComponent();
17
- $comments.data("comments", component);
18
14
 
19
15
  // Update the comments count
20
16
  $(".comments-count", $comments).text(<%== t("decidim.components.comments.title", count: @comments_count).to_json %>);
@@ -2,8 +2,8 @@ $(() => {
2
2
  var rootCommentableId = <%== "comments-for-#{@commentable.class.name.demodulize}-#{@commentable.id}".to_json %>;
3
3
  var $comments = $("#" + rootCommentableId);
4
4
  var config = $comments.data("decidim-comments");
5
+ var component = $comments.data("comments");
5
6
 
6
- component = new Decidim.CommentsComponent($comments, config);
7
7
  component.unmountComponent();
8
8
 
9
9
  var commentHtml = '<%== j(render partial: "edited_comment", locals: { comment: @comment }).strip %>';
@@ -19,9 +19,7 @@ $(() => {
19
19
  $comment.replaceWith(commentHtml);
20
20
 
21
21
  // Re-create the component
22
- component = new Decidim.CommentsComponent($comments, $comments.data("decidim-comments"));
23
22
  component.mountComponent();
24
- $comments.data("comments", component);
25
23
 
26
24
  Rails.fire(document, "comments:loaded", {
27
25
  commentsIds: [commentId]
@@ -28,6 +28,8 @@ cs:
28
28
  enabled: Komentáře povoleny
29
29
  end_time: Komentáře povoleny do
30
30
  start_time: Komentáře povoleny od
31
+ comment_thread:
32
+ accessibility_label: Komentář začal %{full_name} na %{date}
31
33
  comments:
32
34
  create:
33
35
  error: Při vytváření komentáře došlo k chybě.
@@ -33,7 +33,7 @@ module Decidim
33
33
  single_comment: params.fetch("commentId", nil),
34
34
  order: options[:order],
35
35
  polymorphic: options[:polymorphic]
36
- ).to_s
36
+ )
37
37
  end
38
38
  end
39
39
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-comments version.
5
5
  module Comments
6
6
  def self.version
7
- "0.29.3"
7
+ "0.29.4"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-comments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.3
4
+ version: 0.29.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-04-29 00:00:00.000000000 Z
13
+ date: 2025-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.29.3
21
+ version: 0.29.4
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.29.3
28
+ version: 0.29.4
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: redcarpet
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -52,28 +52,28 @@ dependencies:
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 0.29.3
55
+ version: 0.29.4
56
56
  type: :development
57
57
  prerelease: false
58
58
  version_requirements: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 0.29.3
62
+ version: 0.29.4
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: decidim-dev
65
65
  requirement: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 0.29.3
69
+ version: 0.29.4
70
70
  type: :development
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 0.29.3
76
+ version: 0.29.4
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -106,6 +106,7 @@ files:
106
106
  - app/cells/decidim/comments/comments/add_comment.erb
107
107
  - app/cells/decidim/comments/comments/blocked_comments_warning.erb
108
108
  - app/cells/decidim/comments/comments/comments_loading.erb
109
+ - app/cells/decidim/comments/comments/inline.erb
109
110
  - app/cells/decidim/comments/comments/order_control.erb
110
111
  - app/cells/decidim/comments/comments/show.erb
111
112
  - app/cells/decidim/comments/comments/single_comment_warning.erb
@@ -153,7 +154,6 @@ files:
153
154
  - app/services/decidim/comments/new_comment_notification_creator.rb
154
155
  - app/views/decidim/comments/admin/shared/_availability_fields.html.erb
155
156
  - app/views/decidim/comments/comments/_comment.html.erb
156
- - app/views/decidim/comments/comments/_comments.html.erb
157
157
  - app/views/decidim/comments/comments/_delete.html.erb
158
158
  - app/views/decidim/comments/comments/_edited_comment.html.erb
159
159
  - app/views/decidim/comments/comments/_moderated.html.erb
@@ -1 +0,0 @@
1
- <%= inline_comments_for(commentable, order:) %>