views/comments i18n (#15059)

* views/comments etc i18n

* comments PR fixes

* PR sync with main

* remove ja.yml

* Update _comment_header.html.erb

* Update index.html.erb

* Update _comment_header.html.erb

* Update en.yml

* Update fr.yml

* Update config/locales/views/comments/en.yml

Co-authored-by: Michael Kohl <citizen428@forem.com>

* Update _comment_date.erb

* Update en.yml

* Update fr.yml

Co-authored-by: Michael Kohl <citizen428@forem.com>
This commit is contained in:
yheuhtozr 2021-10-28 01:13:43 +09:00 committed by GitHub
parent 824397b93f
commit f762acca86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 426 additions and 139 deletions

View file

@ -2,14 +2,14 @@
<% if @comments_to_show_count && @article.comments_count > @comments_to_show_count %>
<div class="mb-4">
<a class="crayons-btn crayons-btn--secondary w-100" href="<%= @article.path %>/comments">
<%= t("core.view") %> <%= t("core.full") %> <%= t("core.discussion") %> (<%= @article.comments_count %> comments)
<%= t("views.comments.parent.view_full", count: @article.comments_count) %>
</a>
</div>
<% end %>
<% if @article.any_comments_hidden %>
<p class="fs-s color-base-60 mb-4">
Some comments have been hidden by the post's author - <a href="/faq">find out more</a>
<%= t("views.comments.hidden.text_html", info: link_to(t("views.comments.hidden.info"), "/faq")) %>
</p>
<% end %>

View file

@ -127,14 +127,16 @@
<% end %>
<% if story.comments_count > 0 %>
<a href="<%= story.path %>#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left" aria-label="Comments for post <%= story.title %> (<%= story.public_reactions_count %>)">
<%= inline_svg_tag("small-comment.svg", aria: true, width: 24, height: 24, class: "crayons-icon", title: "Comments") %>
<%= story.comments_count %>
<span class="hidden s:inline">&nbsp;<%= story.comments_count == 1 ? t("core.comment").downcase : t("core.comment").downcase.pluralize %></span>
<%= inline_svg_tag("small-comment.svg", aria: true, width: 24, height: 24, class: "crayons-icon", title: t("views.comments.summary.title")) %>
<%= t("views.comments.summary.count_html",
count: story.comments_count,
start: tag("span", { class: %w[hidden s:inline] }, true),
end: "</span>".html_safe) %>
</a>
<% else %>
<a href="<%= story.path %>#comments" class="crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon-left" aria-label="Comments for post <%= story.title %> (<%= story.public_reactions_count %>)">
<%= inline_svg_tag("small-comment.svg", aria: true, width: 24, height: 24, class: "crayons-icon", title: "Comments") %>
<span class="hidden s:inline">Add&nbsp;<%= t("core.comment") %></span>
<%= inline_svg_tag("small-comment.svg", aria: true, width: 24, height: 24, class: "crayons-icon", title: t("views.comments.summary.title")) %>
<span class="hidden s:inline"><%= t("views.comments.add") %></span>
</a>
<% end %>
</div>

View file

@ -3,9 +3,9 @@
<% if show_comment_count %>
<div class="crayons-link__secondary">
<% if plucked_article[2] > 0 %>
<%= pluralize(plucked_article[2], "comment") %>
<%= t("views.comments.count", count: plucked_article[2]) %>
<% else %>
<span class="crayons-indicator crayons-indicator--accent">New</span>
<span class="crayons-indicator crayons-indicator--accent"><%= t("views.comments.empty") %></span>
<% end %>
</div>
<% end %>

View file

@ -3,8 +3,8 @@
<details class="comment-wrapper js-comment-wrapper comment-wrapper--deep-<%= comment.depth %> <%= comment_class(comment, is_view_root: is_view_root) %>" open>
<summary>
<span class="<% if comment.depth > 0 %>mx-0<% else %>m:mx-1<% end %> inline-block align-middle">
<%= inline_svg_tag("collapse.svg", aria: true, class: "crayons-icon expanded", title: "Collapse") %>
<%= inline_svg_tag("expand.svg", aria: true, class: "crayons-icon collapsed", title: "Expand") %>
<%= inline_svg_tag("collapse.svg", aria: true, class: "crayons-icon expanded", title: t("views.comments.collapse")) %>
<%= inline_svg_tag("expand.svg", aria: true, class: "crayons-icon collapsed", title: t("views.comments.expand")) %>
</span>
<span class="js-collapse-comment-content inline-block align-middle"></span>
</summary>

View file

@ -6,10 +6,8 @@
</time>
<% if decorated_comment.edited_at.present? %>
&bull; Edited
<span class="hidden m:inline-block">
on <time datetime="<%= decorated_comment.edited_timestamp %>">
<%= decorated_comment.edited_at.strftime('%b %-d') %></time>
</span>
<%= t("views.comments.edited.text_html",
on: tag.span(t("views.comments.edited.on_html", date: tag.time(decorated_comment.edited_at.strftime(t("time.formats.short")), datetime: decorated_comment.edited_timestamp), class: %w[hidden m:inline-block]))
) %>
<% end %>
</a>

View file

@ -7,14 +7,9 @@
<%= inline_svg_tag("small-heart.svg",
aria: true,
class: "crayons-icon reaction-icon not-reacted",
title: "Like comment:") %>
<%= inline_svg_tag("small-heart-filled.svg", aria: true, class: "crayons-icon reaction-icon--like reaction-icon reacted", title: "Like comment: ") %>
<span class="reactions-count">
<%= comment.public_reactions_count if comment.public_reactions_count.positive? %>
</span>
<span class="reactions-label hidden m:inline-block">
<%= like_button_text(comment).html_safe %>
</span>
title: t("views.comments.footer.heart.icon")) %>
<%= inline_svg_tag("small-heart-filled.svg", aria: true, class: "crayons-icon reaction-icon--like reaction-icon reacted", title: t("views.comments.footer.heart.icon")) %>
<%= t("views.comments.footer.heart.count_html", num: tag.span((comment.public_reactions_count if comment.public_reactions_count.positive?), class: "reactions-count"), likes: tag.span(like_button_text(comment).html_safe, class: "reactions-label hidden m:inline-block")) %>
</button>
<% unless @discussion_lock %>
@ -25,13 +20,13 @@
data-comment-id="<%= comment.id %>"
data-path="<%= commentable.path %>/comments/<%= comment.id_code_generated %>"
rel="nofollow">
<%= inline_svg_tag("small-comment.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: "Comment button") %>
<span class="hidden m:inline-block"><%= t("core.reply") %></span>
<%= inline_svg_tag("small-comment.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: t("views.comments.footer.reply.icon")) %>
<span class="hidden m:inline-block"><%= t("views.comments.footer.reply.text") %></span>
</a>
<% else %>
<span class="fs-s inline-flex items-center fs-italic color-base-50 pl-1">
<%= inline_svg_tag("small-thread.svg", aria: true, class: "crayons-icon", title: "Thread") %>
Thread
<%= inline_svg_tag("small-thread.svg", aria: true, class: "crayons-icon", title: t("views.comments.footer.thread.icon")) %>
<%= t("views.comments.footer.thread.text") %>
</span>
<% end %>
<% end %>

View file

@ -22,21 +22,22 @@
<%= render "comments/comment_date", decorated_comment: decorated_comment %>
<div class="comment__dropdown">
<button id="comment-dropdown-trigger-<%= comment.id %>" aria-controls="comment-dropdown-<%= comment.id %>" aria-expanded="false" class="dropbtn comment__dropdown-trigger crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon" aria-label="Toggle dropdown menu" aria-haspopup="true">
<%= inline_svg_tag("small-overflow-horizontal.svg", aria: true, class: "crayons-icon pointer-events-none", title: "Dropdown menu") %>
<button id="comment-dropdown-trigger-<%= comment.id %>" aria-controls="comment-dropdown-<%= comment.id %>" aria-expanded="false" class="dropbtn comment__dropdown-trigger crayons-btn crayons-btn--s crayons-btn--ghost crayons-btn--icon"
aria-label="<%= t("views.comments.menu.aria_label") %>" aria-haspopup="true">
<%= inline_svg_tag("small-overflow-horizontal.svg", aria: true, class: "crayons-icon pointer-events-none", title: t("views.comments.menu.icon")) %>
</button>
<div id="comment-dropdown-<%= comment.id %>" class="crayons-dropdown right-1 s:right-0 s:left-auto fs-base dropdown">
<ul class="m-0">
<li><a href="<%= URL.comment(comment) %>" class="crayons-link crayons-link--block permalink-copybtn" aria-label="Copy link to <%= comment.user.name %>'s comment" data-no-instant><%= t("core.copy_link") %></a></li>
<li class="comment-actions hidden" data-user-id="<%= comment.user_id %>" data-action="settings-button" data-path="<%= URL.comment(comment) %>/settings" aria-label="Go to <%= comment.user.name %>'s comment settings"></li>
<% action = comment.hidden_by_commentable_user ? "Unhide" : "Hide" %>
<li><a href="<%= URL.comment(comment) %>" class="crayons-link crayons-link--block permalink-copybtn" aria-label="<%= t("views.comments.menu.copy.aria_label", user: comment.user.name) %>" data-no-instant><%= t("views.comments.menu.copy.text") %></a></li>
<li class="comment-actions hidden" data-user-id="<%= comment.user_id %>" data-action="settings-button" data-path="<%= URL.comment(comment) %>/settings" aria-label="<%= t("views.comments.menu.settings.aria_label", user: comment.user.name) %>"></li>
<% action = comment.hidden_by_commentable_user ? 'unhide' : 'hide' %>
<li class="comment-actions hidden" data-action="hide-button" data-commentable-user-id="<%= commentable&.user_id %>" data-user-id="<%= comment.user_id %>">
<a href="#" class="crayons-link crayons-link--block hide-comment" data-hide-type="<%= action.downcase %>" data-comment-id="<%= comment.id %>" aria-label="<%= action %> <%= comment.user.name %>'s comment">
<%= action %>
<a href="#" class="crayons-link crayons-link--block hide-comment" data-hide-type="<%= action %>" data-comment-id="<%= comment.id %>" aria-label="<%= t("views.comments.menu.action.aria_label", action: t("views.comments.menu.action.#{action}"), user: comment.user.name) %>">
<%= t("views.comments.menu.action.#{action}_text") %>
</a>
</li>
<li class="mod-actions hidden mod-actions-comment-button" data-path="<%= URL.comment(comment) %>/mod" aria-label="Moderate <%= comment.user.name %>'s comment"></li>
<li class="report-abuse-link-wrapper" data-path="/report-abuse?url=<%= URL.comment(comment) %>" aria-label="Report <%= comment.user.name %>'s comment as abusive or violating our code of conduct and/or terms and conditions"></li>
<li class="mod-actions hidden mod-actions-comment-button" data-path="<%= URL.comment(comment) %>/mod" aria-label="<%= t("views.comments.menu.moderate.aria_label", user: comment.user.name) %>"></li>
<li class="report-abuse-link-wrapper" data-path="/report-abuse?url=<%= URL.comment(comment) %>" aria-label="<%= t("views.comments.menu.report.aria_label", user: comment.user.name) %>"></li>
<li class="current-user-actions"></li>
</ul>
</div>

View file

@ -1,12 +1,12 @@
<% if decorated_comment.low_quality %>
<div class="crayons-notice crayons-notice--warning low-quality-comment-marker">
Comment marked as low quality/non-constructive by the community. <a href="/code-of-conduct"><strong>View Code of Conduct</strong></a>
<%= t("views.comments.quality.low") %> <a href="/code-of-conduct"><strong><%= t("views.comments.quality.conduct") %></strong></a>
</div>
<% end %>
<% if comment.hidden_by_commentable_user %>
<div class="low-quality-comment-marker comment__quality-marker">
<%= inline_svg_tag("info.svg", aria: true, class: "crayons-icon mr-2", title: "Info") %>
Comment hidden by post author - thread only visible in this permalink
<%= inline_svg_tag("info.svg", aria: true, class: "crayons-icon mr-2", title: t("views.comments.quality.hidden.icon")) %>
<%= t("views.comments.quality.hidden.text") %>
</div>
<% end %>

View file

@ -1,5 +1,5 @@
<div id="discussion-lock" class="crayons-notice crayons-notice--warning mb-5" aria-live="polite">
The discussion has been locked. New comments can't be added.
<%= t("views.comments.locked") %>
<% if @discussion_lock&.reason %>
<div>
<em>

View file

@ -3,7 +3,7 @@
<% if @comment.errors.any? %>
<div class="crayons-notice crayons-notice--danger" role="alert">
<h2><%= pluralize(@comment.errors.count, "error") %> prohibited this comment from being saved:</h2>
<h2><%= t("views.comments.write.errors", count: @comment.errors.count) %></h2>
<ul>
<% @comment.errors.full_messages.each do |message| %>
<li><%= message %></li>
@ -15,7 +15,7 @@
<%= form_for(@comment, authenticity_token: false, html: { class: "comment-form print-hidden" }) do |f| %>
<% if @article&.comment_template.present? && @comment.new_record? %>
<div class="article-comment-form-preamble">
This post comes with a comment template
<%= t("views.comments.write.template.article") %>
</div>
<% end %>
@ -34,7 +34,7 @@
<div class="comment-form__inner">
<div class="comment-form__field">
<%= f.text_area :body_markdown,
placeholder: "Add to the discussion",
placeholder: t("views.comments.write.field.placeholder"),
onfocus: "handleFocus(event)",
onkeyup: "handleKeyUp(event)",
onkeydown: "handleKeyDown(event)",
@ -42,34 +42,34 @@
id: "text-area",
required: true,
class: "crayons-textfield comment-textarea crayons-textfield--ghost",
"aria-label": "Add a comment to the discussion" %>
"aria-label": t("views.comments.write.field.aria_label") %>
<div class="comment-form__toolbar">
<div class="editor-image-upload">
<input type="file" id="image-upload-main" name="file" accept="image/*" style="display:none">
<button type="button" class="crayons-btn crayons-btn--s crayons-btn--icon-left crayons-btn--ghost-dimmed" onclick="handleImageUpload(event,'main')">
<%= inline_svg_tag("image.svg", aria: true, class: "crayons-icon") %>
<span class="hidden s:inline-block" aria-hidden="false">Upload image</span>
<span class="hidden s:inline-block" aria-hidden="false"><%= t("views.comments.write.field.upload") %></span>
</button>
<label class="image-upload-file-label" id="image-upload-file-label-main"></label>
<input type="submit" id='image-upload-submit-main' value="Upload" style="display:none">
<input type="submit" id='image-upload-submit-main' value="<%= t("views.comments.write.field.submit") %>" style="display:none">
<input class="hidden" id="uploaded-image-main" />
</div>
<button type="button" class="crayons-btn crayons-btn--s crayons-btn--icon-left crayons-btn--ghost-dimmed response-templates-button" title="Use a response template" data-has-listener="false" data-form-id="new_comment">
<button type="button" class="crayons-btn crayons-btn--s crayons-btn--icon-left crayons-btn--ghost-dimmed response-templates-button" title="<%= t("views.comments.write.field.use") %>" data-has-listener="false" data-form-id="new_comment">
<%= inline_svg_tag("templates.svg", aria: true, class: "crayons-icon") %>
<span class="hidden s:inline-block" aria-hidden="false">Templates</span>
<span class="hidden s:inline-block" aria-hidden="false"><%= t("views.comments.write.field.templates") %></span>
</button>
<a href="/p/editor_guide" class="crayons-btn crayons-btn--ghost-dimmed crayons-btn--icon crayons-btn--s ml-auto" target="_blank" rel="noopener" title="Markdown Guide">
<%= inline_svg_tag("info.svg", aria: true, class: "crayons-icon", title: "Editor guide") %>
<a href="/p/editor_guide" class="crayons-btn crayons-btn--ghost-dimmed crayons-btn--icon crayons-btn--s ml-auto" target="_blank" rel="noopener" title="<%= t("views.comments.write.field.guide.title") %>">
<%= inline_svg_tag("info.svg", aria: true, class: "crayons-icon", title: t("views.comments.write.field.guide.icon")) %>
</a>
</div>
</div>
<div class="response-templates-container crayons-card crayons-card--secondary p-4 mb-4 comment-form__templates fs-base hidden">
<header class="mb-3">
<button type="button" class="crayons-btn personal-template-button active" data-target-type="personal" data-form-id="new_comment">Personal</button>
<button type="button" class="crayons-btn moderator-template-button hidden" data-target-type="moderator" data-form-id="new_comment">Moderator</button>
<button type="button" class="crayons-btn personal-template-button active" data-target-type="personal" data-form-id="new_comment"><%= t("views.comments.write.template.personal") %></button>
<button type="button" class="crayons-btn moderator-template-button hidden" data-target-type="moderator" data-form-id="new_comment"><%= t("views.comments.write.template.moderator") %></button>
</header>
<img class="loading-img hidden" src="<%= asset_path("loading-ellipsis.svg") %>" alt="loading" loading="lazy" />
@ -82,17 +82,17 @@
</div>
<a target="_blank" rel="noopener nofollow" href="<%= user_settings_path(tab: "response-templates") %>">
Create template
<%= t("views.comments.write.template.create.subtitle") %>
</a>
<p>Templates let you quickly answer FAQs or store snippets for re-use.</p>
<p><%= t("views.comments.write.template.create.desc") %></p>
</div>
<div class="comment-form__preview text-styles text-styles--secondary" id="preview-div"></div>
<div class="comment-form__buttons mb-4">
<button type="submit" class="crayons-btn mr-2 js-btn-enable" onclick="validateField(event)" disabled>Submit</button>
<button type="button" class="preview-toggle crayons-btn crayons-btn--secondary comment-action-preview js-btn-enable mr-2" disabled>Preview</button>
<a href="<%= @comment.path %>" class="dismiss-edit-comment crayons-btn crayons-btn--ghost js-btn-dismiss hidden">Dismiss</a>
<button type="submit" class="crayons-btn mr-2 js-btn-enable" onclick="validateField(event)" disabled><%= t("views.comments.write.submit") %></button>
<button type="button" class="preview-toggle crayons-btn crayons-btn--secondary comment-action-preview js-btn-enable mr-2" disabled><%= t("views.comments.write.preview") %></button>
<a href="<%= @comment.path %>" class="dismiss-edit-comment crayons-btn crayons-btn--ghost js-btn-dismiss hidden"><%= t("views.comments.write.cancel") %></a>
</div>
</div>

View file

@ -3,16 +3,15 @@
<%= truncate(sanitize(@comment.processed_html, tags: []), length: 200) %>
</div>
<div class="crayons-card text-padding">
<h1 class="crayons-subtitle-1 mb-2">Are you sure you want to delete this comment?</h1>
<h1 class="crayons-subtitle-1 mb-2"><%= t("views.comments.delete.heading") %></h1>
<p class="fs-l mb-4">
You cannot undo this action, perhaps you just want to
<a data-no-instant href="<%= @comment.path %>/edit">Edit</a> instead?
<%= t("views.comments.delete.desc_html", action: link_to(t("views.comments.delete.action"), "#{@comment.path}/edit", data: { no_instant: "" })) %>
</p>
<%= form_tag "/comments/#{@comment.id}", method: :delete do %>
<button class="crayons-btn crayons-btn--danger">Delete</button>
<a data-no-instant href="<%= @comment.path %>/edit" class="crayons-btn crayons-btn--secondary">Edit</a>
<a data-no-instant href="<%= @comment.path %>" class="crayons-btn crayons-btn--ghost">Dismiss</a>
<button class="crayons-btn crayons-btn--danger"><%= t("views.comments.delete.submit") %></button>
<a data-no-instant href="<%= @comment.path %>/edit" class="crayons-btn crayons-btn--secondary"><%= t("views.comments.delete.edit") %></a>
<a data-no-instant href="<%= @comment.path %>" class="crayons-btn crayons-btn--ghost"><%= t("views.comments.delete.cancel") %></a>
<% end %>
</div>
</div>

View file

@ -6,7 +6,7 @@
id="comments-container"
data-commentable-id="<%= @comment.commentable_id %>"
data-commentable-type="<%= @comment.commentable_type %>">
<h1 class="crayons-title mb-6">Editing comment</h1>
<h1 class="crayons-title mb-6"><%= t("views.comments.edit") %></h1>
<%= render "form",
commentable: @commentable,
commentable_type: @comment.commentable_type %>

View file

@ -2,47 +2,47 @@
<% if @root_comment.present? %>
<% title(@root_comment.title.to_s) %>
<% else %>
<% title("Discussion of #{@commentable.title}") %>
<% title(t("views.comments.meta.title_root", title: @commentable.title)) %>
<% end %>
<% if @commentable %>
<%= content_for :page_meta do %>
<meta name="description" content="<%= @commentable.description || "An article from the community" %>">
<%= meta_keywords_article %>
<%= content_for :page_meta do %>
<meta name="description" content="<%= @commentable.description || t("views.comments.meta.description") %>">
<%= meta_keywords_article %>
<meta property="og:type" content="article" />
<meta property="og:title" content="Discussion of <%= @commentable.title %>" />
<meta property="og:description" content="<%= @commentable.description || "#{community_name} Comment" %>" />
<meta property="og:site_name" content="<%= community_name %>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@<%= Settings::General.social_media_handles["twitter"] %>">
<meta name="twitter:creator" content="@<%= @user.twitter_username %>">
<meta name="twitter:title" content="<%= @commentable.title %>">
<meta name="twitter:description" content="<%= @commentable.description || "#{community_name} Comment" %>">
<meta property="og:type" content="article" />
<meta property="og:title" content="<%= t("views.comments.meta.og.title", title: @commentable.title) %>" />
<meta property="og:description" content="<%= @commentable.description || t("views.comments.meta.og.description", site: community_name) %>" />
<meta property="og:site_name" content="<%= community_name %>" />
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@<%= Settings::General.social_media_handles["twitter"] %>">
<meta name="twitter:creator" content="@<%= @user.twitter_username %>">
<meta name="twitter:title" content="<%= @commentable.title %>">
<meta name="twitter:description" content="<%= @commentable.description || t("views.comments.meta.og.description", site: community_name) %>">
<% if @root_comment.present? %>
<link rel="canonical" href="<%= app_url(@root_comment.path) %>" />
<meta property="og:url" content="<%= app_url(@root_comment.path) %>" />
<meta property="og:title" content="<%= truncate(strip_tags(@root_comment.processed_html), length: 50) %> — <%= community_name %>" />
<meta name="twitter:title" content="<%= truncate(strip_tags(@root_comment.processed_html), length: 50) %> — <%= community_name %>">
<meta property="og:image" content="<%= comment_social_image_url(@root_comment) %>" />
<meta name="twitter:image" content="<%= comment_social_image_url(@root_comment) %>">
<% if @root_comment.score < 0 || @commentable.score < 0 %>
<meta name="googlebot" content="noindex">
<meta name="googlebot" content="nofollow">
<% end %>
<% else %>
<link rel="canonical" href="<%= app_url("#{@commentable.path}/comments") %>" />
<meta property="og:url" content="<%= app_url("#{@commentable.path}/comments") %>" />
<meta property="og:title" content="[Discussion] <%= @commentable.title %> — <%= community_name %>" />
<meta name="twitter:title" content="[Discussion] <%= @commentable.title %> — <%= community_name %>">
<% if @commentable.class.name == "Article" && @commentable.published %>
<meta property="og:image" content="<%= article_social_image_url(@commentable) %>" />
<meta name="twitter:image" content="<%= article_social_image_url(@commentable) %>">
<% end %>
<% if @root_comment.present? %>
<link rel="canonical" href="<%= app_url(@root_comment.path) %>" />
<meta property="og:url" content="<%= app_url(@root_comment.path) %>" />
<meta property="og:title" content="<%= t("views.comments.meta.og.title_rel", root: truncate(strip_tags(@root_comment.processed_html), length: 50), site: community_name) %>" />
<meta name="twitter:title" content="<%= t("views.comments.meta.og.title_rel", root: truncate(strip_tags(@root_comment.processed_html), length: 50), site: community_name) %>">
<meta property="og:image" content="<%= comment_social_image_url(@root_comment) %>" />
<meta name="twitter:image" content="<%= comment_social_image_url(@root_comment) %>">
<% if @root_comment.score < 0 || @commentable.score < 0 %>
<meta name="googlebot" content="noindex">
<meta name="googlebot" content="nofollow">
<% end %>
<% else %>
<link rel="canonical" href="<%= app_url("#{@commentable.path}/comments") %>" />
<meta property="og:url" content="<%= app_url("#{@commentable.path}/comments") %>" />
<meta property="og:title" content="<%= t("views.comments.meta.og.title_root", title: @commentable.title, site: community_name) %>" />
<meta name="twitter:title" content="<%= t("views.comments.meta.og.title_root", title: @commentable.title, site: community_name) %>">
<% if @commentable.class.name == "Article" && @commentable.published %>
<meta property="og:image" content="<%= article_social_image_url(@commentable) %>" />
<meta name="twitter:image" content="<%= article_social_image_url(@commentable) %>">
<% end %>
<% end %>
<% end %>
<% end %>
<%= javascript_packs_with_chunks_tag "commentDropdowns", "followButtons", defer: true %>
@ -66,8 +66,9 @@
<%= @commentable.title %>
</h1>
<p class="color-base-60">
<%= @commentable.is_a?(PodcastEpisode) ? @commentable.podcast.name : @commentable.user.name %>
<%= "on #{@commentable.published_at.strftime('%B %d, %Y')}" if @commentable.published_at %></span>
<%= t("views.comments.parent.metadata_html",
name: @commentable.is_a?(PodcastEpisode) ? @commentable.podcast.name : @commentable.user.name,
on: tag.span(@commentable.published_at ? t("views.comments.parent.date", date: @commentable.published_at.strftime(t("time.formats.comment"))) : "", class: %w[published-at])) %>
</p>
</div>
</header>
@ -80,8 +81,7 @@
<% else %>
<%= truncate(sanitize(@commentable.processed_html, tags: []), length: 150) %>
<div class="pt-6">
<a class="crayons-btn crayons-btn--outlined" href="<%= @commentable.path %>">Read full post</a>
</div>
<a class="crayons-btn crayons-btn--outlined" href="<%= @commentable.path %>"><%= t("views.comments.parent.read") %></a>
<% end %>
</div>
</div>
@ -92,15 +92,17 @@
<%= javascript_packs_with_chunks_tag "responseTemplates", "commentsDisplay", defer: true %>
<header class="p-2 pb-4 m:p-6 m:pb-6 crayons-card crayons-card--secondary s:mx-2 m:mx-4 -mb-1 z-0">
<% if @commentable %>
<h1 class="crayons-subtitle-1 mb-4">
<span class="fw-normal color-base-60">Discussion on: </span>
<%= @commentable.title %>
</h1>
<div class="flex">
<a class="crayons-btn crayons-btn--outlined mr-2" href="<%= @commentable.path %>"><%= t("core.view") %> <%= t("core.post").downcase %></a>
</div>
<h1 class="crayons-subtitle-1 mb-4">
<%= t("views.comments.parent.subtitle_html",
start: tag("span", { class: %w[fw-normal color-base-60] }, true),
end: "</span>".html_safe,
title: tag.span(@commentable.title)) %>
</h1>
<div class="flex">
<a class="crayons-btn crayons-btn--outlined mr-2" href="<%= @commentable.path %>"><%= t("views.comments.parent.view") %></a>
</div>
<% else %>
[Comment from a deleted post]
<%= t("views.comments.orphan.deleted") %>
<% end %>
</header>
<% end %>
@ -109,7 +111,10 @@
<div class="p-2 pb-4 m:p-6 m:pb-6 crayons-card crayons-card--secondary s:mx-1 m:mx-2 -mb-2 z-0">
<h2 class="crayons-subtitle-2 pb-2">
<a href="<%= parent.path %>" class="crayons-link">
<span class="fw-normal opacity-75">Replies for:</span> <%= parent.title(150) %>
<%= t("views.comments.parent.reply_html",
start: tag("span", { class: %w[fw-normal opacity-75] }, true),
end: "</span>".html_safe,
title: tag.span(parent.title(150))) %>
</a>
</h2>
</div>
@ -143,7 +148,7 @@
<% if @commentable&.any_comments_hidden %>
<p class="mb-2 pt-6 fs-s align-center color-base-60">
Some comments have been hidden by the post's author - <a href="/faq#what-does-comment-hidden-by-post-author-mean">find out more</a>
<%= t("views.comments.hidden.text_html", info: link_to(t("views.comments.hidden.info"), "/faq#what-does-comment-hidden-by-post-author-mean")) %>
</p>
<% end %>
</section>

View file

@ -1,30 +1,30 @@
<% title "Comment Settings" %>
<% title t("views.comments.settings.meta.title") %>
<div class="crayons-layout crayons-layout--limited-m gap-0">
<div class="crayons-card text-padding">
<h1 class="crayons-title mb-4">Comment Settings</h1>
<h1 class="crayons-title mb-4"><%= t("views.comments.settings.heading") %></h1>
<div class="flex">
<div class="pr-4 m:pr-8 flex-1">
<% if @notification_subscription.persisted? %>
<p class="fw-bold">Showing thread notifications</p>
<p class="fs-s color-base-60">You will receive all notifications for this comment and any of your comments in this chain.</p>
<p class="fw-bold"><%= t("views.comments.settings.state.show.subtitle") %></p>
<p class="fs-s color-base-60"><%= t("views.comments.settings.state.show.desc") %></p>
<% else %>
<p class="fw-bold">Muting thread notifications</p>
<p class="fs-s color-base-60">All notifications for this comment and any of your comments in the thread are currently muted.</p>
<p class="fw-bold"><%= t("views.comments.settings.state.mute.subtitle") %></p>
<p class="fs-s color-base-60"><%= t("views.comments.settings.state.mute.desc") %></p>
<% end %>
</div>
<%= form_for(@notification_subscription, url: "/notification_subscriptions/Comment/#{@comment.id}", method: "post", html: { class: "mute-form shrink-0" }) do |f| %>
<input type="hidden" name="config" value="<%= @notification_subscription.persisted? ? "not_subscribed" : "all_comments" %>">
<%= f.submit @notification_subscription.persisted? ? "Mute notifications" : "Unmute notifications", class: "crayons-btn crayons-btn--secondary #{@notification_subscription.persisted? ? 'mute' : 'unmute'}" %>
<%= f.submit t("views.comments.settings.subscribe.#{@notification_subscription.persisted? ? 'mute' : 'unmute'}"), class: "crayons-btn crayons-btn--secondary #{@notification_subscription.persisted? ? 'mute' : 'unmute'}" %>
<% end %>
</div>
<% if NotificationSubscription.where(user_id: current_user, notifiable_type: "Article", notifiable_id: @comment.commentable_id, config: "all_comments").any? %>
<div class="flex pt-6">
<div class="pr-4 m:pr-8 flex-1">
<p class="fw-bold">Subscription</p>
<p class="fs-s color-base-60">You are still subscribed to all comments in the broader thread, which will mean you will still receive notifications for replies to this comment.</p>
<p class="fw-bold"><%= t("views.comments.settings.subscribe.subtitle") %></p>
<p class="fs-s color-base-60"><%= t("views.comments.settings.subscribe.desc") %></p>
</div>
<%= form_for(@notification_subscription, url: "/notification_subscriptions/Article/#{@comment.commentable_id}", method: "post", html: { class: "mute-form" }) do |f| %>
<input type="hidden" name="config" value="not_subscribed">

View file

@ -3,7 +3,7 @@
<% if json_data["comment"]["depth"] && json_data["comment"]["depth"] > 0 %>
<h3>
<a href="<%= json_data["comment"]["ancestors"].last["path"] %>" class="crayons-link notification__reply-title">
<span class="fw-normal opacity-50">Re: </span><%= json_data["comment"]["ancestors"].last["title"] %>
<%= t("views.comments.re.text_html", re: tag.span(t("views.comments.re.re"), class: "fw-normal opacity-50"), title: json_data["comment"]["ancestors"].last["title"]) %>
</a>
</h3>
<% end %>
@ -41,28 +41,28 @@
data-category="like"
data-reactable-type="Comment"
title="heart">
<%= inline_svg_tag("small-heart.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: "Favorite heart outline button") %>
<%= inline_svg_tag("small-heart-filled.svg", aria: true, class: "crayons-icon reaction-icon--like reaction-icon reacted", title: "Favorite heart outline button") %>
<span class="hidden m:inline-block">Like</span>
<%= inline_svg_tag("small-heart.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: t("views.comments.footer.heart.icon")) %>
<%= inline_svg_tag("small-heart-filled.svg", aria: true, class: "crayons-icon reaction-icon--like reaction-icon reacted", title: t("views.comments.footer.heart.icon")) %>
<span class="hidden m:inline-block"><%= t("views.comments.footer.heart.text") %></span>
</button>
<% cache "comment-box-comment-reply-#{@last_user_comment}-#{json_data['comment']['updated_at']}-#{json_data['comment']['id']}" do %>
<% reply = Comment.select(:id, :user_id, :ancestry).find_by(id: json_data["comment"]["id"])&.children&.find_by(user_id: current_user.id) %>
<% if reply %>
<a class="crayons-btn crayons-btn--ghost crayons-btn--s crayons-btn--icon-left mr-1 inline-flex reaction-comment reacted" href="<%= reply.path %>">
<%= inline_svg_tag("small-comment-filled.svg", aria: true, class: "crayons-icon reaction-icon--comment reaction-icon reacted", title: "Comment button") %>
<span class="hidden m:inline-block">Replied</span>
<%= inline_svg_tag("small-comment-filled.svg", aria: true, class: "crayons-icon reaction-icon--comment reaction-icon reacted", title: t("views.comments.footer.reply.icon")) %>
<span class="hidden m:inline-block"><%= t("views.comments.footer.reply.done") %></span>
</a>
<% else %>
<a class="crayons-btn crayons-btn--ghost crayons-btn--s crayons-btn--icon-left toggle-reply-form mr-1 inline-flex" data-reactable-id="<%= json_data["comment"]["id"] %>" href="#<%= json_data["comment"]["path"] %>">
<%= inline_svg_tag("small-comment.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: "Comment button") %>
<%= inline_svg_tag("small-comment-filled.svg", aria: true, class: "crayons-icon reaction-icon--comment reaction-icon reacted", title: "Comment button") %>
<span class="hidden m:inline-block">Reply</span>
<%= inline_svg_tag("small-comment.svg", aria: true, class: "crayons-icon reaction-icon not-reacted", title: t("views.comments.footer.reply.icon")) %>
<%= inline_svg_tag("small-comment-filled.svg", aria: true, class: "crayons-icon reaction-icon--comment reaction-icon reacted", title: t("views.comments.footer.reply.icon")) %>
<span class="hidden m:inline-block"><%= t("views.comments.footer.reply.text") %></span>
</a>
<% end %>
<% end %>
<a href="<%= json_data["comment"]["path"] %>" class="crayons-btn crayons-btn--ghost crayons-btn--icon-left crayons-btn--s inline-flex">
<%= inline_svg_tag("small-link.svg", aria: true, class: "crayons-icon", title: "View button") %><span class="hidden m:inline-block">View</span>
<%= inline_svg_tag("small-link.svg", aria: true, class: "crayons-icon", title: t("views.comments.footer.view.icon")) %><span class="hidden m:inline-block"><%= t("views.comments.footer.view.text") %></span>
</a>
</div>
@ -74,9 +74,9 @@
<%= f.hidden_field :commentable_type, value: json_data["comment"]["commentable"]["class"]["name"] %>
<%= f.hidden_field :parent_id, value: json_data["comment"]["id"] %>
<%= f.text_area :body_markdown, id: "comment-textarea-for-#{json_data['comment']['id']}", class: "crayons-textfield mb-2 resize-y", placeholder: "Reply...", "aria-label": "Reply to a comment...", onfocus: "handleFocus(event)" %>
<%= f.text_area :body_markdown, id: "comment-textarea-for-#{json_data['comment']['id']}", class: "crayons-textfield mb-2 resize-y", placeholder: t("views.comments.footer.reply.placeholder"), "aria-label": t("views.comments.footer.reply.aria_label"), onfocus: "handleFocus(event)" %>
<div class="actions">
<button type="submit" class="crayons-btn comment-action-button" onclick="validateField(event)">Submit</button>
<button type="submit" class="crayons-btn comment-action-button" onclick="validateField(event)"><%= t("views.comments.write.submit") %></button>
</div>
<% end %>
</footer>

View file

@ -14,7 +14,6 @@ en:
create_account: Create account
create_post: Create Post
dashboard: Dashboard
discussion: Discussion
edit_profile: Edit profile
feed: Feed
follow: Follow
@ -22,7 +21,6 @@ en:
follower: Follower
followers: Followers
following: Following
full: Full
home: Home
infinity: Infinity
joined: Joined
@ -59,7 +57,6 @@ en:
settings: Settings
sign_out: Sign Out
trending_on: Trending on
view: View
week: Week
year: Year
dashboard:
@ -230,6 +227,7 @@ en:
profile: Profile
time:
formats:
comment: "%B %d, %Y"
short: "%b %-e"
short_with_year: "%b %-e, %Y"
stackexchange: "%b %e '%y"

View file

@ -14,7 +14,6 @@ fr:
create_account: Créer un profil
create_post: Créer une publication
dashboard: Tableau de bord
discussion: Discussion
edit_profile: Editer le profil
feed: Fil
follow: Suivre
@ -22,7 +21,6 @@ fr:
follower: Suiveur
followers: Suiveurs
following: Abonné
full: Complet
home: Page D'Accueil
infinity: Infini
joined: Rejoint
@ -59,7 +57,6 @@ fr:
settings: Paramètres
sign_out: Se déconnecter
trending_on: Populaire sur
view: Vue
week: Semaine
year: Année
dashboard:
@ -253,6 +250,7 @@ fr:
profile: Profil
time:
formats:
comment: "%B %d, %Y"
short: "%-e %b"
short_with_year: "%-e %b, %Y"
stackexchange: "%b %e '%y"

View file

@ -0,0 +1,146 @@
---
en:
views:
comments:
meta:
title_root: Discussion of %{title}
description: An article from the community
og:
title: Discussion of %{title}
title_rel: "%{root} — %{site}"
title_root: "[Discussion] %{title} — %{site}"
description: "%{site} Comment"
messages:
create:
success: created
failure: comment already exists
markdown: 'There was an error in your markdown: %{error}'
markdown_html: "<p>😔 There was an error in your markdown</p><hr><p>%{error}</p>"
parent:
subtitle_html: "%{start}Discussion on: %{end}%{title}"
metadata_html: "%{name}%{on}"
date: " on %{date}"
full: Full discussion
read: Read full post
view: View post
view_full:
one: View full discussion (%{count} comment)
other: View full discussion (%{count} comments)
reply_html: "%{start}Replies for:%{end} %{title}"
delete:
heading: Are you sure you want to delete this comment?
desc_html: You cannot undo this action, perhaps you just want to %{action} instead?
action: Edit
error: Something went wrong; Comment NOT deleted.
notice: Comment was successfully deleted.
submit: Delete
edit: Edit
cancel: Dismiss
collapse: Collapse
edit: Editing comment
edited:
text_html: "&bull; Edited %{on}"
on_html: on %{date}
expand: Expand
hidden:
text_html: Some comments have been hidden by the post's author - %{info}
info: find out more
locked: The discussion has been locked. New comments can't be added.
orphan:
deleted: "[Comment from a deleted post]"
re:
text_html: "%{re}%{title}"
re: 'Re: '
settings:
meta:
title: Comment Settings
heading: Comment Settings
state:
show:
subtitle: Showing thread notifications
desc: You will receive all notifications for this comment and any of your comments in this chain.
mute:
subtitle: Muting thread notifications
desc: All notifications for this comment and any of your comments in the thread are currently muted.
subscribe:
subtitle: Subscription
desc: You are still subscribed to all comments in the broader thread, which will mean you will still receive notifications for replies to this comment.
mute: Mute notifications
unmute: Unmute notifications
quality:
low: Comment marked as low quality/non-constructive by the community.
conduct: View Code of Conduct
hidden:
icon: Info
text: Comment hidden by post author - thread only visible in this permalink
write:
errors:
one: '1 error prohibited this comment from being saved:'
other: "%{count} errors prohibited this comment from being saved:"
field:
aria_label: Add a comment to the discussion
placeholder: Add to the discussion
submit: Upload
templates: Templates
upload: Upload image
use: Use a response template
guide:
title: Markdown Guide
icon: Editor guide
template:
article: This post comes with a comment template
create:
subtitle: Create template
desc: Templates let you quickly answer FAQs or store snippets for re-use.
moderator: Moderator
personal: Personal
submit: Submit
preview: Preview
cancel: Dismiss
menu:
aria_label: Toggle dropdown menu
icon: Dropdown menu
copy:
aria_label: Copy link to %{user}'s comment
text: Copy link
settings:
aria_label: Go to %{user}'s comment settings
action:
aria_label: "%{action} %{user}'s comment"
hide: Hide
unhide: Unhide
hide_text: Hide
unhide_text: Unhide
moderate:
aria_label: Moderate %{user}'s comment
report:
aria_label: Report %{user}'s comment as abusive or violating our code of conduct and/or terms and conditions
footer:
heart:
title: heart
icon: 'Like comment: '
count_html: "%{num}%{likes}"
text: Like
reply:
aria_label: Reply to a comment...
icon: Comment button
done: Replied
text: Reply
placeholder: Reply...
thread:
icon: Thread
text: Thread
view:
icon: View button
text: View
count:
one: "%{count} comment"
other: "%{count} comments"
empty: New
add: "Add\_Comment"
summary:
count_html:
one: "%{count}%{start}\_comment%{end}"
other: "%{count}%{start}\_comments%{end}"
title: Comments

View file

@ -0,0 +1,145 @@
---
fr:
views:
comments:
meta:
title_root: Discussion of %{title}
description: An article from the community
og:
title: Discussion of %{title}
title_rel: "%{root} — %{site}"
title_root: "[Discussion] %{title} — %{site}"
description: "%{site} Comment"
messages:
create:
success: created
failure: comment already exists
markdown: 'There was an error in your markdown: %{error}'
markdown_html: "<p>😔 There was an error in your markdown</p><hr><p>%{error}</p>"
parent:
subtitle_html: "%{start}Discussion on: %{end}%{title}"
metadata_html: "%{name}%{on}"
date: " on %{date}"
full: Full discussion
read: Read full post
view: Voir la publication
view_full:
one: Voir la discussion complète (%{count} commentaires)
other: Voir la discussion complète (%{count} commentaires)
reply_html: "%{start}Replies for:%{end} %{title}"
delete:
heading: Are you sure you want to delete this comment?
desc_html: You cannot undo this action, perhaps you just want to %{action} instead?
action: Edit
error: Something went wrong; Comment NOT deleted.
notice: Comment was successfully deleted.
submit: Delete
edit: Edit
cancel: Dismiss
collapse: Collapse
edit: Editing comment
edited:
text_html: "&bull; Edited %{on}"
on_html: on %{date}
expand: Expand
hidden:
text_html: Some comments have been hidden by the post's author - %{info}
info: find out more
locked: The discussion has been locked. New comments can't be added.
orphan:
deleted: "[Comment from a deleted post]"
re:
text_html: "%{re}%{title}"
re: 'Re: '
settings:
meta:
title: Comment Settings
heading: Comment Settings
state:
show:
subtitle: Showing thread notifications
desc: You will receive all notifications for this comment and any of your comments in this chain.
mute:
subtitle: Muting thread notifications
desc: All notifications for this comment and any of your comments in the thread are currently muted.
subscribe:
subtitle: Subscription
desc: You are still subscribed to all comments in the broader thread, which will mean you will still receive notifications for replies to this comment.
mute: Mute notifications
unmute: Unmute notifications
quality:
low: Comment marked as low quality/non-constructive by the community.
conduct: View Code of Conduct
hidden:
icon: Info
text: Comment hidden by post author - thread only visible in this permalink
write:
errors:
one: '1 error prohibited this comment from being saved:'
other: "%{count} errors prohibited this comment from being saved:"
field:
aria_label: Add a comment to the discussion
placeholder: Add to the discussion
submit: Upload
templates: Templates
upload: Upload image
use: Use a response template
guide:
title: Markdown Guide
icon: Editor guide
template:
article: This post comes with a comment template
create:
subtitle: Create template
desc: Templates let you quickly answer FAQs or store snippets for re-use.
moderator: Moderator
personal: Personal
submit: Submit
preview: Preview
cancel: Dismiss
menu:
aria_label: Toggle dropdown menu
icon: Dropdown menu
copy:
aria_label: Copy link to %{user}'s comment
text: Copier le lien
settings:
aria_label: Go to %{user}'s comment settings
action:
aria_label: "%{action} %{user}'s comment"
hide: Hide
unhide: Unhide
hide_text: Hide
unhide_text: Unhide
moderate:
aria_label: Moderate %{user}'s comment
report:
aria_label: Report %{user}'s comment as abusive or violating our code of conduct and/or terms and conditions
footer:
heart:
title: heart
icon: 'Like comment: '
count_html: "%{num}%{likes}"
text: Like
reply:
aria_label: Reply to a comment...
icon: Comment button
done: Replied
text: Répondre
placeholder: Reply...
thread:
icon: Thread
text: Thread
view:
icon: View button
text: View
count:
one: "%{count} comment"
other: "%{count} comments"
empty: New
add: "Ajouter un commentaire"
summary:
count_html:
one: "%{count}%{start}\_commentaire%{end}"
other: "%{count}%{start}\_commentaires%{end}"
title: Comments