views: factor out FontAwesome icons.
Factor out FontAwesome icons into a set of helpers. This is so that it's easier to keep track of which icons we're using and easier to change icons globally.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
<span>
|
||||
<span id="score-for-post-<%= post.id %>"><%= post.score %></span>
|
||||
<% if policy(PostVote).create? %>
|
||||
(vote <%= link_to(content_tag("i", nil, class: "far fa-thumbs-up"), post_post_votes_path(:score => "up", :post_id => post.id), :remote => true, :method => :post) %>/<%= link_to(content_tag("i", nil, class: "far fa-thumbs-down"), post_post_votes_path(:score => "down", :post_id => post.id), :remote => true, :method => :post) %>)
|
||||
(vote <%= link_to upvote_icon, post_post_votes_path(score: "up", post_id: post.id), remote: true, method: :post %>/<%= link_to downvote_icon, post_post_votes_path(score: "down", post_id: post.id), remote: true, method: :post %>)
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
%>
|
||||
|
||||
<li>
|
||||
<%= link_to content_tag(:i, nil, class: "far fa-thumbs-up"), forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=1"}, title: "Vote up" %>
|
||||
<%= link_to upvote_icon, forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=1"}, title: "Vote up" %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, class: "far fa-meh"), forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=0"}, title: "Vote meh" %>
|
||||
<%= link_to meh_icon, forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=0"}, title: "Vote meh" %>
|
||||
|
||||
<%= link_to content_tag(:i, nil, class: "far fa-thumbs-down"), forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=-1"}, title: "Vote down" %>
|
||||
<%= link_to downvote_icon, forum_post_votes_path(forum_post_id: forum_post.id, format: "js"), remote: true, method: :post, data: {params: "forum_post_vote[score]=-1"}, title: "Vote down" %>
|
||||
</li>
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
<li class="vote-score-<%= vote.vote_type %>">
|
||||
<% if policy(forum_post).votable? && vote.creator_id == CurrentUser.id %>
|
||||
<%= link_to content_tag(:i, nil, class: "far #{vote.fa_class}"), forum_post_vote_path(vote, format: "js"), remote: true, method: :delete %>
|
||||
<%= link_to forum_post_vote_icon(vote), forum_post_vote_path(vote, format: "js"), remote: true, method: :delete %>
|
||||
<%= link_to_user vote.creator %>
|
||||
<% else %>
|
||||
<%= content_tag(:i, nil, class: "far #{vote.fa_class}") %>
|
||||
<%= forum_post_vote_icon(vote) %>
|
||||
<%= link_to_user vote.creator %>
|
||||
<% end %>
|
||||
</li>
|
||||
|
||||
@@ -8,25 +8,25 @@
|
||||
|
||||
<% if topic.is_sticky? %>
|
||||
<%= link_to forum_topics_path(search: { is_sticky: true }) do %>
|
||||
<i class="topic-status icon stickied fas fa-thumbtack" title="Stickied"></i>
|
||||
<%= sticky_icon(class: "topic-status stickied", title: "Stickied") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_locked? %>
|
||||
<%= link_to forum_topics_path(search: { is_locked: true }) do %>
|
||||
<i class="topic-status icon locked fas fa-lock" title="Locked"></i>
|
||||
<%= lock_icon(class: "topic-status locked", title: "Locked") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_deleted? %>
|
||||
<%= link_to forum_topics_path(search: { is_deleted: true }) do %>
|
||||
<i class="topic-status icon deleted fas fa-trash-alt" title="Deleted"></i>
|
||||
<%= delete_icon(class: "topic-status deleted", title: "Deleted") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if topic.is_private? %>
|
||||
<%= link_to forum_topics_path(search: { is_private: true }) do %>
|
||||
<i class="topic-status icon private fas fa-hand-paper" title="<%= User.level_string(topic.min_level) %> only"></i>
|
||||
<%= private_icon(class: "topic-status private", title: "#{User.level_string(topic.min_level)} only") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
<%= link_to Danbooru.config.app_name, root_path, id: "app-name-header", class: "heading" %>
|
||||
|
||||
<div id="maintoggle" class="mobile-only">
|
||||
<a href="#"><i id="maintoggle-on" class="fas fa-bars"></i></a>
|
||||
<a href="#"><i id="maintoggle-off" class="fas fa-times" style="display: none;"></i></a>
|
||||
<a href="#"><%= menu_icon(id: "maintoggle-on") %></a>
|
||||
<a href="#"><%= close_icon(id: "maintoggle-off", style: "display: none;") %></a>
|
||||
</div>
|
||||
|
||||
<nav id="nav">
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<span>
|
||||
<span id="score-for-post-<%= post.id %>"><%= post.score %></span>
|
||||
<% if policy(PostVote).create? %>
|
||||
(vote <%= link_to tag.i(class: "far fa-thumbs-up"), post_post_votes_path(score: "up", post_id: post.id), remote: true, method: :post %>/<%= link_to tag.i(class: "far fa-thumbs-down"), post_post_votes_path(score: "down", post_id: post.id), remote: true, method: :post %>)
|
||||
(vote <%= link_to upvote_icon, post_post_votes_path(score: "up", post_id: post.id), remote: true, method: :post %>/<%= link_to downvote_icon, post_post_votes_path(score: "down", post_id: post.id), remote: true, method: :post %>)
|
||||
<% end %>
|
||||
</span>
|
||||
</span>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<%= f.input :tags, label: false, input_html: { placeholder: "Tags", value: params.dig(:search, :tags), "data-autocomplete": "tag-query" } %>
|
||||
<%= f.input :order, label: false, collection: [["Newest", "modqueue"], ["Oldest", "modqueue_asc"], ["Score (Highest)", "score"], ["Score (Lowest)", "score_asc"]], selected: params[:search][:order] %>
|
||||
<%= f.button :button, name: nil, id: "search-box-submit" do %>
|
||||
<i class="fas fa-search"></i>
|
||||
<%= search_icon %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -7,6 +7,6 @@
|
||||
<%= hidden_field_tag :random, params[:random] %>
|
||||
<% end %>
|
||||
<%= text_field_tag("tags", tags, :id => tags_dom_id, :"data-shortcut" => "q", :"data-autocomplete" => "tag-query") %>
|
||||
<button id="search-box-submit" type="submit"><i class="fas fa-search"></i></button>
|
||||
<button id="search-box-submit" type="submit"><%= search_icon %></button>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<h2>Options</h2>
|
||||
<ul>
|
||||
<% if policy(SavedSearch).create? %>
|
||||
<li><%= button_tag(tag.i(class: "fas fa-bookmark") + " Save search", id: "save-search", class: "ui-button ui-widget ui-corner-all sub") %></li>
|
||||
<li><%= button_tag(bookmark_icon + " Save search", id: "save-search", class: "ui-button ui-widget ui-corner-all sub") %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
@@ -50,7 +50,9 @@
|
||||
<%= f.label :tag_string, "Tags" %>
|
||||
|
||||
<span data-tag-counter data-for="#post_tag_string"></span>
|
||||
<a href="javascript:void(0)"><i id="open-edit-dialog" class="fas fa-external-link-alt" title="detach" data-shortcut="shift+e"></i></a>
|
||||
<a href="javascript:void(0)">
|
||||
<%= external_link_icon(id: "open-edit-dialog", "data-shortcut": "shift+e") %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
<% if policy(PostVote).create? %>
|
||||
<%= tag.span id: "vote-links-for-post-#{post.id}", style: ("display: none;" if !@post.can_be_voted_by?(CurrentUser.user)) do %>
|
||||
(vote
|
||||
<%= link_to tag.i(class: "far fa-thumbs-up"), post_post_votes_path(post_id: post.id, score: "up"), remote: true, method: :post %>
|
||||
<%= link_to tag.i(class: "far fa-thumbs-down"), post_post_votes_path(post_id: post.id, score: "down"), remote: true, method: :post %>)
|
||||
<%= link_to upvote_icon, post_post_votes_path(post_id: post.id, score: "up"), remote: true, method: :post %>
|
||||
<%= link_to downvote_icon, post_post_votes_path(post_id: post.id, score: "down"), remote: true, method: :post %>)
|
||||
<% end %>
|
||||
<%= tag.span id: "unvote-link-for-post-#{post.id}", style: ("display: none;" if @post.can_be_voted_by?(CurrentUser.user)) do %>
|
||||
(<%= link_to "undo vote", post_post_votes_path(post), remote: true, method: :delete, class: "unvote-post-link" %>)
|
||||
|
||||
@@ -3,18 +3,18 @@
|
||||
|
||||
<span class="post-tooltip-favorites post-tooltip-info">
|
||||
<span><%= @post.fav_count %></span>
|
||||
<i class="far fa-heart fa-xs"></i>
|
||||
<%= favorite_icon(class: "fa-xs") %>
|
||||
</span>
|
||||
|
||||
<span class="post-tooltip-score post-tooltip-info">
|
||||
<span><%= @post.score %></span>
|
||||
<i class="far fa-thumbs-up fa-xs"></i>
|
||||
<%= upvote_icon(class: "fa-xs") %>
|
||||
</span>
|
||||
|
||||
<% if @post.last_commented_at.present? %>
|
||||
<span class="post-tooltip-comments post-tooltip-info">
|
||||
<span><%= @post.comments.count %></span>
|
||||
<i class="far fa-comments fa-xs"></i>
|
||||
<%= comments_icon(class: "fa-xs") %>
|
||||
</span>
|
||||
<% end %>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<%= link_to "#{@post.image_width}x#{@post.image_height}", @post.file_url, class: "post-tooltip-dimensions post-tooltip-info" %>
|
||||
|
||||
<%= link_to "#", class: "post-tooltip-disable", title: "Disable enhanced tooltips" do %>
|
||||
<i class="fas fa-times-circle"></i>
|
||||
<%= close_icon %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
<% if policy(Favorite).create? %>
|
||||
<%= content_tag(:div, class: "fav-buttons fav-buttons-#{@post.favorited_by?(CurrentUser.user)}") do %>
|
||||
<%= form_tag(favorites_path(post_id: @post.id), method: "post", id: "add-fav-button", "data-remote": true) do %>
|
||||
<%= button_tag tag.i(class: "far fa-heart"), class: "ui-button ui-widget ui-corner-all", "data-disable-with": tag.i(class: "fas fa-spinner fa-spin") %>
|
||||
<%= button_tag favorite_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
|
||||
<% end %>
|
||||
|
||||
<%= form_tag(favorite_path(@post.id), method: "delete", id: "remove-fav-button", "data-remote": true) do %>
|
||||
<%= button_tag tag.i(class: "fas fa-heart"), class: "ui-button ui-widget ui-corner-all", "data-disable-with": tag.i(class: "fas fa-spinner fa-spin") %>
|
||||
<%= button_tag favorite_icon, class: "ui-button ui-widget ui-corner-all", "data-disable-with": spinner_icon %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<div id="source-info">
|
||||
<%= link_to "Fetch source data", source_path, id: "fetch-data-manual" %>
|
||||
<i id="source-info-loading" class="fas fa-spinner fa-spin"></i>
|
||||
<%= spinner_icon(id: "source-info-loading") %>
|
||||
|
||||
<% if @source.present? %>
|
||||
<dl id="source-info-content">
|
||||
|
||||
@@ -66,7 +66,9 @@
|
||||
<%= f.label :tag_string, "Tags" %>
|
||||
|
||||
<span data-tag-counter data-for="#upload_tag_string"></span>
|
||||
<a href="javascript:void(0)"><i id="open-edit-dialog" class="fas fa-external-link-alt" title="detach" data-shortcut="shift+e"></i></a>
|
||||
<a href="javascript:void(0)">
|
||||
<%= external_link_icon(id: "open-edit-dialog", "data-shortcut": "shift+e") %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<%= f.input :tag_string, label: false, hint: "Ctrl+Enter to submit", input_html: { size: "60x5", "data-autocomplete": "tag-edit", "data-shortcut": "e", value: params[:tag_string] } %>
|
||||
|
||||
@@ -47,13 +47,13 @@
|
||||
<% end %>
|
||||
|
||||
<% if user.email_address.is_verified? %>
|
||||
<i class="fas fa-check-circle user-verified-email-icon" title="Verified email"></i>
|
||||
<%= checkmark_icon(class: "user-verified-email-icon", title: "Verified email") %>
|
||||
<% elsif user == CurrentUser.user %>
|
||||
<%= link_to verify_user_email_path(user) do %>
|
||||
<i class="fas fa-exclamation-triangle user-unverified-email-icon" title="Unverified email. Click here to verify your email."></i>
|
||||
<%= exclamation_icon(class: "user-unverified-email-icon", title: "Unverified email. Click here to verify your email.") %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<i class="fas fa-exclamation-triangle user-email-unverified" title="Unverified email."></i>
|
||||
<%= exclamation_icon(class: "user-email-unverified", title: "Unverified email") %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<em>none</em>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<div class="user-tooltip">
|
||||
<div class="user-tooltip-header">
|
||||
<i class="fas fa-user-circle user-tooltip-avatar"></i>
|
||||
<%= avatar_icon(class: "user-tooltip-avatar") %>
|
||||
|
||||
<div class="user-tooltip-header-top">
|
||||
<span class="user-tooltip-name"><%= link_to_user @user %></span>
|
||||
|
||||
@@ -20,12 +21,12 @@
|
||||
|
||||
<% if @user.positive_feedback_count > 0 %>
|
||||
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-positive-feedback" do %>
|
||||
<i class="fas fa-medal"></i>
|
||||
<%= medal_icon %>
|
||||
<span><%= @user.positive_feedback_count %>
|
||||
<% end %>
|
||||
<% elsif @user.negative_feedback_count > 0 %>
|
||||
<%= link_to user_feedbacks_path(search: { user_id: @user.id }), class: "link-plain user-tooltip-badge user-tooltip-badge-negative-feedback" do %>
|
||||
<i class="fas fa-times-circle"></i>
|
||||
<%= negative_icon %>
|
||||
<span><%= @user.negative_feedback_count %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -47,14 +48,14 @@
|
||||
<%= render PopupMenuComponent.new do |menu| %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to new_dmail_path(dmail: { to_id: @user.id }) do %>
|
||||
<i class="icon far fa-envelope"></i> Send Message
|
||||
<%= message_icon %> Send Message
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<% if !@user.is_platinum? %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to new_user_upgrade_path(user_id: @user.id) do %>
|
||||
<i class="icon fas fa-gift"></i> Gift Upgrade
|
||||
<%= gift_icon %> Gift Upgrade
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -62,7 +63,7 @@
|
||||
<% if policy(UserFeedback.new(user: @user)).create? %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to new_user_feedback_path(user_feedback: { user_id: @user.id }) do %>
|
||||
<i class="icon fas fa-file-signature"></i> Give Feedback
|
||||
<%= feedback_icon %> Give Feedback
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -70,7 +71,7 @@
|
||||
<% if policy(CurrentUser.user).promote? %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to edit_admin_user_path(@user.id) do %>
|
||||
<i class="icon fas fa-user-plus"></i> Promote User
|
||||
<%= promotion_icon %> Promote User
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
@@ -78,7 +79,7 @@
|
||||
<% if policy(Ban.new(user: @user)).create? %>
|
||||
<%= menu.item do %>
|
||||
<%= link_to new_ban_path(ban: { user_id: @user.id }) do %>
|
||||
<i class="icon fas fa-user-slash"></i> Ban User
|
||||
<%= ban_icon %> Ban User
|
||||
<% end %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user