fix vote buttons.
This commit is contained in:
@@ -48,7 +48,7 @@
|
|||||||
<% if current_user.is_anonymous? %>
|
<% if current_user.is_anonymous? %>
|
||||||
<%= link_to upvote_icon, login_path(url: request.fullpath), class: "comment-upvote-link inactive-link" %>
|
<%= link_to upvote_icon, login_path(url: request.fullpath), class: "comment-upvote-link inactive-link" %>
|
||||||
<% elsif upvoted? %>
|
<% elsif upvoted? %>
|
||||||
<%= link_to upvote_icon, comment_vote_path(current_vote), class: "comment-upvote-link comment-unvote-link active-link", method: :delete, remote: true %>
|
<%= link_to upvote_icon(active: true), comment_vote_path(current_vote), class: "comment-upvote-link comment-unvote-link active-link", method: :delete, remote: true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to upvote_icon, comment_comment_votes_path(comment_id: comment.id, score: "1"), class: "comment-upvote-link inactive-link", method: :post, remote: true %>
|
<%= link_to upvote_icon, comment_comment_votes_path(comment_id: comment.id, score: "1"), class: "comment-upvote-link inactive-link", method: :post, remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
<% if current_user.is_anonymous? %>
|
<% if current_user.is_anonymous? %>
|
||||||
<%= link_to downvote_icon, login_path(url: request.fullpath), class: "comment-downvote-link inactive-link" %>
|
<%= link_to downvote_icon, login_path(url: request.fullpath), class: "comment-downvote-link inactive-link" %>
|
||||||
<% elsif downvoted? %>
|
<% elsif downvoted? %>
|
||||||
<%= link_to downvote_icon, comment_vote_path(current_vote), class: "comment-downvote-link comment-unvote-link active-link", method: :delete, remote: true %>
|
<%= link_to downvote_icon(active: true), comment_vote_path(current_vote), class: "comment-downvote-link comment-unvote-link active-link", method: :delete, remote: true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to downvote_icon, comment_comment_votes_path(comment_id: comment.id, score: "-1"), class: "comment-downvote-link inactive-link", method: :post, remote: true %>
|
<%= link_to downvote_icon, comment_comment_votes_path(comment_id: comment.id, score: "-1"), class: "comment-downvote-link inactive-link", method: :post, remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -48,3 +48,7 @@ article.comment {
|
|||||||
height: 1.5em;
|
height: 1.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.comment-section img {
|
||||||
|
border: none !important;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<span class="post-votes" data-id="<%= post.id %>">
|
<span class="post-votes" data-id="<%= post.id %>">
|
||||||
<% if can_vote? %>
|
<% if can_vote? %>
|
||||||
<% if upvoted? %>
|
<% if upvoted? %>
|
||||||
<%= link_to upvote_icon, post_post_votes_path(post_id: post.id), class: "post-upvote-link post-unvote-link active-link", method: :delete, remote: true %>
|
<%= link_to upvote_icon(active: true, post: post), post_post_votes_path(post_id: post.id), class: "post-upvote-link post-unvote-link active-link", method: :delete, remote: true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to upvote_icon, post_post_votes_path(post_id: post.id, score: 1), class: "post-upvote-link inactive-link", method: :post, remote: true %>
|
<%= link_to upvote_icon, post_post_votes_path(post_id: post.id, score: 1), class: "post-upvote-link inactive-link", method: :post, remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<% if can_vote? %>
|
<% if can_vote? %>
|
||||||
<% if downvoted? %>
|
<% if downvoted? %>
|
||||||
<%= link_to downvote_icon, post_post_votes_path(post_id: post.id), class: "post-downvote-link post-unvote-link active-link", method: :delete, remote: true %>
|
<%= link_to downvote_icon(active: true, post: post), post_post_votes_path(post_id: post.id), class: "post-downvote-link post-unvote-link active-link", method: :delete, remote: true %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to downvote_icon, post_post_votes_path(post_id: post.id, score: -1), class: "post-downvote-link inactive-link", method: :post, remote: true %>
|
<%= link_to downvote_icon, post_post_votes_path(post_id: post.id, score: -1), class: "post-downvote-link inactive-link", method: :post, remote: true %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ module ForumTopicsHelper
|
|||||||
|
|
||||||
def forum_post_vote_icon(vote)
|
def forum_post_vote_icon(vote)
|
||||||
if vote.score == 1
|
if vote.score == 1
|
||||||
upvote_icon
|
tag.img(src: "https://cdn.discordapp.com/emojis/814623669392375809.png?v=1", width: 24, height: 24)
|
||||||
elsif vote.score == -1
|
elsif vote.score == -1
|
||||||
downvote_icon
|
tag.img(src: "https://cdn.discordapp.com/emojis/814335138376056843.png?v=1", width: 24, height: 24)
|
||||||
else
|
else
|
||||||
meh_icon
|
meh_icon
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -17,13 +17,41 @@ module IconHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
# fontawesome.com/icons/arrow-alt-up
|
# fontawesome.com/icons/arrow-alt-up
|
||||||
def upvote_icon(**options)
|
def upvote_icon(active: false, post: nil, **options)
|
||||||
svg_icon_tag("upvote-icon", "M272 480h-96c-13.3 0-24-10.7-24-24V256H48.2c-21.4 0-32.1-25.8-17-41L207 39c9.4-9.4 24.6-9.4 34 0l175.8 176c15.1 15.1 4.4 41-17 41H296v200c0 13.3-10.7 24-24 24z", **options)
|
if !active
|
||||||
|
svg_icon_tag("upvote-icon", "M272 480h-96c-13.3 0-24-10.7-24-24V256H48.2c-21.4 0-32.1-25.8-17-41L207 39c9.4-9.4 24.6-9.4 34 0l175.8 176c15.1 15.1 4.4 41-17 41H296v200c0 13.3-10.7 24-24 24z", **options)
|
||||||
|
elsif post&.has_tag?("fate/grand_order")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/653748516224761908.gif?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("touhou")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/827033081197101066.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("kantai_collection")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/733153966917156866.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("azur_lane") && post.rating != "s"
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/801657092439277569.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("hololive") && post.rating == "s"
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/772303879051149312.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("hololive") && post.rating != "s"
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/759597982176903212.gif?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("arknights")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/701113445713445004.gif?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("fire_emblem")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/625999795882033163.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("foot_focus")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/795007213919928361.png?v=1", height: 24)
|
||||||
|
elsif post&.has_tag?("albert_yi")
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/380454608096722956.png?v=1", height: 24)
|
||||||
|
else
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/688562186930618391.png?v=1", class: "prov", height: 20)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# fontawesome.com/icons/arrow-alt-down
|
# fontawesome.com/icons/arrow-alt-down
|
||||||
def downvote_icon(**options)
|
def downvote_icon(active: false, post: nil, **options)
|
||||||
svg_icon_tag("downvote-icon", "M176 32h96c13.3 0 24 10.7 24 24v200h103.8c21.4 0 32.1 25.8 17 41L241 473c-9.4 9.4-24.6 9.4-34 0L31.3 297c-15.1-15.1-4.4-41 17-41H152V56c0-13.3 10.7-24 24-24z", **options)
|
if !active
|
||||||
|
svg_icon_tag("downvote-icon", "M176 32h96c13.3 0 24 10.7 24 24v200h103.8c21.4 0 32.1 25.8 17 41L241 473c-9.4 9.4-24.6 9.4-34 0L31.3 297c-15.1-15.1-4.4-41 17-41H152V56c0-13.3 10.7-24 24-24z", **options)
|
||||||
|
else
|
||||||
|
tag.img(src: "https://cdn.discordapp.com/emojis/769954192050618439.png?v=1", class: "prov", height: 20)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def sticky_icon(**options)
|
def sticky_icon(**options)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'tippy.js/dist/tippy.css';
|
|||||||
|
|
||||||
let PostTooltip = {};
|
let PostTooltip = {};
|
||||||
|
|
||||||
PostTooltip.POST_SELECTOR = "*:not(.ui-sortable-handle) > .post-preview img, .dtext-post-id-link";
|
PostTooltip.POST_SELECTOR = "*:not(.ui-sortable-handle) > .post-preview img:not(.prov), .dtext-post-id-link";
|
||||||
PostTooltip.SHOW_DELAY = 500;
|
PostTooltip.SHOW_DELAY = 500;
|
||||||
PostTooltip.HIDE_DELAY = 125;
|
PostTooltip.HIDE_DELAY = 125;
|
||||||
PostTooltip.DURATION = 250;
|
PostTooltip.DURATION = 250;
|
||||||
|
|||||||
Reference in New Issue
Block a user