decidim-comments 0.30.0 → 0.30.1

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: f3f261fa44f97aa2c81eb727232883bc118b141436e33765e92bb68df3ae626e
4
- data.tar.gz: 68d45a2470e05a27b727bb738cb1df4f6b5158d0aa3b814e3efe4b0cb0ebf3fb
3
+ metadata.gz: 9e6746750957ec0abd1071747249f9950e9e05230a27a6a88d3cabfbd65a71ae
4
+ data.tar.gz: 9d4719e73c257aa75357d5829eaad1436a144f8f25a1002307a99726596880a3
5
5
  SHA512:
6
- metadata.gz: e043a900d4ee07f7a5115cfd14c2281a6720e1570d31632a62fbfb3c90de6e2f63edb47e69caf40a90473bc8707cdbca3ec4da270c1d93ae14af0d0c6de2b191
7
- data.tar.gz: 18de4378a63e323757bb36bd3a6299ef39a76941ba1e127745e86600cbe47273fd8c09b635199a168a09f865ad1cf8b82a71988a8bb9d390be22c851bcc66ad7
6
+ metadata.gz: dbd914f9f24ff0a9a9ab9161d83bb66ecffe1f6e4b4369f6eda8d5d005424462ae6961b0adc4ac80e17fe73f9494e478367fa00eb37d13b1fcb2b6abc0f5df7b
7
+ data.tar.gz: a01577c7c2a8a288f1b9835fbc0fd988ba6d9aa7ec1cad7b54f1b78d8008e6be44d207f09a7c569d6eef1d47c9135fb00cc7719d5f4211d5ad7c05ea5864ea48
@@ -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 unless two_columns_layout? %>
15
+ </div>
16
+ <%= single_comment_warning %>
17
+ <%= blocked_comments_warning %>
18
+ <%= render_comments %>
19
+ <% if user_signed_in? %>
20
+ <button class="button button__lg button__secondary flex md:hidden w-full h-9 text-sm add-comment-mobile">
21
+ <%= t("add_comment", scope: "decidim.components.add_comment_form") %>
22
+ </button>
23
+ <% end %>
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 unless two_columns_layout? %>
16
- </div>
17
- <%= single_comment_warning %>
18
- <%= blocked_comments_warning %>
19
- <%= render_comments %>
20
- <% if user_signed_in? %>
21
- <button class="button button__lg button__secondary flex md:hidden w-full h-9 text-sm add-comment-mobile">
22
- <%= t("add_comment", scope: "decidim.components.add_comment_form") %>
23
- </button>
24
- <% end %>
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 %>
@@ -13,6 +13,10 @@ module Decidim
13
13
  two_columns_layout? ? render_comments_in_two_columns : render(:comments_in_single_column)
14
14
  end
15
15
 
16
+ def inline
17
+ render :inline
18
+ end
19
+
16
20
  def add_comment
17
21
  render :add_comment if can_add_comments?
18
22
  end
@@ -61,6 +61,7 @@ export default class CommentsComponent {
61
61
  if (this.mounted) {
62
62
  this.mounted = false;
63
63
  this._stopPolling();
64
+ this.lastCommentId = null;
64
65
 
65
66
  $(".add-comment [data-opinion-toggle] button", this.$element).off("click.decidim-comments");
66
67
  $(".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]
@@ -32,6 +32,8 @@ cs:
32
32
  enabled: Komentáře povoleny
33
33
  end_time: Komentáře povoleny do
34
34
  start_time: Komentáře povoleny od
35
+ comment_thread:
36
+ accessibility_label: Komentář začal %{full_name} na %{date}
35
37
  comments:
36
38
  create:
37
39
  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.30.0"
7
+ "0.30.1"
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.30.0
4
+ version: 0.30.1
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-17 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.30.0
21
+ version: 0.30.1
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.30.0
28
+ version: 0.30.1
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.30.0
55
+ version: 0.30.1
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.30.0
62
+ version: 0.30.1
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.30.0
69
+ version: 0.30.1
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.30.0
76
+ version: 0.30.1
77
77
  description: Pluggable comments system for some components.
78
78
  email:
79
79
  - josepjaume@gmail.com
@@ -107,6 +107,7 @@ files:
107
107
  - app/cells/decidim/comments/comments/blocked_comments_warning.erb
108
108
  - app/cells/decidim/comments/comments/comments_in_single_column.erb
109
109
  - app/cells/decidim/comments/comments/comments_loading.erb
110
+ - app/cells/decidim/comments/comments/inline.erb
110
111
  - app/cells/decidim/comments/comments/order_control.erb
111
112
  - app/cells/decidim/comments/comments/show.erb
112
113
  - app/cells/decidim/comments/comments/single_comment_warning.erb
@@ -159,7 +160,6 @@ files:
159
160
  - app/services/decidim/comments/new_comment_notification_creator.rb
160
161
  - app/views/decidim/comments/admin/shared/_availability_fields.html.erb
161
162
  - app/views/decidim/comments/comments/_comment.html.erb
162
- - app/views/decidim/comments/comments/_comments.html.erb
163
163
  - app/views/decidim/comments/comments/_delete.html.erb
164
164
  - app/views/decidim/comments/comments/_edited_comment.html.erb
165
165
  - app/views/decidim/comments/comments/_moderated.html.erb
@@ -1 +0,0 @@
1
- <%= inline_comments_for(commentable, order:) %>