Unify annotations comment icon to new structure

Apply new structure in the section that shows the comments icon together
with the number of comments so that it is easier to unify them into one
component.

Please note that we updated the comment-number class to comments-count
in order to simplify the css in the new component in the next commit.
This commit is contained in:
taitus
2022-07-22 10:52:53 +02:00
parent e6f2c5474d
commit aec317e5e6
6 changed files with 19 additions and 22 deletions

View File

@@ -2080,6 +2080,18 @@ table {
}
}
.comment-header {
.comments-count {
@include has-fa-icon(comment, solid);
&::before {
margin-right: 0.3rem;
color: #838383;
}
}
}
// 16. Flags
// ---------

View File

@@ -603,20 +603,10 @@
}
.comment-header {
color: #838383;
padding-bottom: rem-calc(8);
margin-bottom: rem-calc(16);
border-bottom: 1px solid $border;
.comment-number {
color: $text;
display: inline-block;
}
.icon-comment {
margin-right: rem-calc(8);
}
a .icon-expand {
color: #838383;
font-size: $small-font-size;

View File

@@ -1,9 +1,6 @@
<span class="icon-comment" aria-hidden="true"></span>
<div class="comment-number">
<%= t("legislation.annotations.comments.comments_count",
count: annotation.comments.roots.count) %>
</div>
<span class="comments-count">
<%= t("legislation.annotations.comments.comments_count", count: annotation.comments.roots.count) %>
</span>
<span id="annotation-link" data-sub-annotation-ids="8">
<%= render "annotation_link", annotation: annotation %>

View File

@@ -1,7 +1,6 @@
<div class="comment-box">
<div class="comment-header">
<span class="icon-comment" aria-hidden="true"></span>
<div class="comment-number"><%= t("legislation.annotations.comments.comments_count", count: 0) %></div>
<span class="comments-count"><%= t("legislation.annotations.comments.comments_count", count: 0) %></span>
</div>
<div class="comments-wrapper">

View File

@@ -14,11 +14,11 @@ if ($(".comment").length == 0) {
$("#annotation-link a").attr("href", new_annotation_link)
var current_comment_text = $(".comment-number").text()
var current_comment_text = $(".comments-count").text()
var current_comment_count = current_comment_text.match(/\d+/)[0]
var new_comment_count = parseInt(current_comment_count) + parseInt(<%= @annotation.comments.roots.count %>)
var new_comment_count_text = current_comment_text.replace(/(\d+)/, new_comment_count);
$(".comment-number").text(new_comment_count_text)
$(".comments-count").text(new_comment_count_text)
}
<%= render "comments_box_form", comment: @comment, annotation: @annotation %>

View File

@@ -7,8 +7,7 @@
<div id="comments-box" class="comments-box-container" style="display: none;">
<div class="comment-box">
<div class="comment-header">
<span class="icon-comment" aria-hidden="true"></span>
<div class="comment-number"><%= t("legislation.draft_versions.show.loading_comments") %></div>
<span class="comments-count"><%= t("legislation.draft_versions.show.loading_comments") %></span>
</div>
</div>
</div>