Cleanup single reaction template (#15207)
* Cleanup single reaction template extract the title: link_to() target conditional outside the call to translate add missing closing paren for t() remove comment (probably could stay if it's useful - explains why we have a conditional at all) * Fix indentation and ensure link has correct class * Fix indentation and ensure links have a path * Remove class from translate template This was left from shuffling arguments to function calls
This commit is contained in:
parent
2395693809
commit
10832a426f
1 changed files with 15 additions and 9 deletions
|
|
@ -4,20 +4,26 @@
|
|||
<% end %>
|
||||
<div class="notification__content">
|
||||
<% category = notification.json_data["reaction"]["category"] %>
|
||||
<% if notification.json_data["reaction"]["reactable"]["title"].blank? %>
|
||||
<% title_link = link_to(
|
||||
t("views.notifications.reacted.your.#{notification.json_data['reaction']['reactable_type'].downcase}"),
|
||||
notification.json_data["reaction"]["reactable"]["path"],
|
||||
class: "crayons-link fw-bold",
|
||||
) %>
|
||||
<% else %>
|
||||
<% title_link = link_to(
|
||||
sanitize(notification.json_data["reaction"]["reactable"]["title"]),
|
||||
notification.json_data["reaction"]["reactable"]["path"],
|
||||
class: "crayons-link fw-bold",
|
||||
) %>
|
||||
<% end %>
|
||||
<%= t("views.notifications.reacted.verb_html",
|
||||
count: 1,
|
||||
start: "",
|
||||
actors: link_to(notification.json_data["user"]["name"], notification.json_data["user"]["path"], class: "crayons-link fw-bold"),
|
||||
# title is blank when it's a comment with only an image, for example
|
||||
title: link_to(
|
||||
if notification.json_data["reaction"]["reactable"]["title"].blank?
|
||||
t("views.notifications.reacted.your.#{notification.json_data["reaction"]["reactable_type"].downcase}")
|
||||
else
|
||||
sanitize(notification.json_data["reaction"]["reactable"]["title"]), notification.json_data["reaction"]["reactable"]["path"]
|
||||
end,
|
||||
class: "crayons-link fw-bold",
|
||||
),
|
||||
title: title_link,
|
||||
end: "",
|
||||
reactions: tag.span(inline_svg_tag(reaction_image(category), class: "crayons-icon reaction-image mx-1 reaction-icon--#{category}", title: t("views.reactions.category.#{category.to_s}"))) %>
|
||||
reactions: tag.span(inline_svg_tag(reaction_image(category), class: "crayons-icon reaction-image mx-1 reaction-icon--#{category}", title: t("views.reactions.category.#{category}")))) %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue