[Misc] Update to fontawesome 6

It seems to be mostly backwards compatible, these changes are just what
fontawesome suggests.
This commit is contained in:
Earlopain 2023-01-27 19:01:35 +01:00
parent f956349592
commit 29c7b80f3a
No known key found for this signature in database
GPG Key ID: 6CFB948E15246897
19 changed files with 43 additions and 44 deletions

View File

@ -29,9 +29,9 @@ module PaginationHelper
window = 4
if records.current_page >= 2
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fas fa-chevron-left"), nav_params_for(records.current_page - 1), rel: "prev", id: "paginator-prev", "data-shortcut": "a left") + "</li>"
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fa-solid fa-chevron-left"), nav_params_for(records.current_page - 1), rel: "prev", id: "paginator-prev", "data-shortcut": "a left") + "</li>"
else
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fas fa-chevron-left") + "</span></li>"
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fa-solid fa-chevron-left") + "</span></li>"
end
if records.total_pages <= (window * 2) + 5
@ -69,9 +69,9 @@ module PaginationHelper
end
if records.current_page < records.total_pages && records.size > 0
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fas fa-chevron-right"), nav_params_for(records.current_page + 1), rel: "next", id: "paginator-next", "data-shortcut": "d right") + "</li>"
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fa-solid fa-chevron-right"), nav_params_for(records.current_page + 1), rel: "next", id: "paginator-next", "data-shortcut": "d right") + "</li>"
else
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fas fa-chevron-right") + "</span></li>"
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fa-solid fa-chevron-right") + "</span></li>"
end
html << "</menu></div>"
@ -92,7 +92,7 @@ module PaginationHelper
html = []
if page == "..."
html << "<li class='more'>"
html << content_tag(:i, nil, class: "fas fa-ellipsis-h")
html << content_tag(:i, nil, class: "fa-solid fa-ellipsis")
html << "</li>"
elsif page == records.current_page
html << "<li class='current-page'>"

View File

@ -46,12 +46,15 @@ ForumPost.reinitialize_all = function() {
ForumPost.vote = function(evt, score) {
evt.preventDefault();
const create_post = function(new_vote) {
const score_map = {'1': 'fa-thumbs-up', '0': 'fa-meh', '-1': 'fa-thumbs-down' };
const score_map_2 = {'1': 'up', '0': 'meh', '-1': 'down'};
const link1 = $('<a>').attr('href', '#').attr('data-forum-id', new_vote.forum_post_id).addClass('forum-vote-remove').append($('<i>').addClass('far').addClass(score_map[new_vote.score.toString()]));
const link2 = $('<a>').attr('href', `/users/${new_vote.creator_id}`).text(new_vote.creator_name);
const container = $('<li>').addClass(`vote-score-${score_map_2[new_vote.score]}`).addClass('own-forum-vote');
container.append(link1).append(' ').append(link2);
const score_map = {
"1": { fa_class: "fa-thumbs-up", e6_class: "up" },
"0": { fa_class: "fa-face-meh", e6_class: "meh" },
"-1": { fa_class: "fa-thumbs-down", e6_class: "down" },
}
const icon = $('<a>').attr('href', '#').attr('data-forum-id', new_vote.forum_post_id).addClass('forum-vote-remove').append($('<i>').addClass('fa-regular').addClass(score_map[new_vote.score.toString()].fa_class));
const username = $('<a>').attr('href', `/users/${new_vote.creator_id}`).text(new_vote.creator_name);
const container = $('<li>').addClass(`vote-score-${score_map[new_vote.score].e6_class}`).addClass('own-forum-vote');
container.append(icon).append(' ').append(username);
$(`#forum-post-votes-for-${new_vote.forum_post_id}`).prepend(container);
};
const id = $(evt.target.parentNode).data('forum-id');

View File

@ -936,7 +936,7 @@ Post.update_tag_count = function(event) {
} else if (count < 25) {
klass = "meh";
}
$("#tags-container .options #face").removeClass().addClass(`far fa-${klass}`);
$("#tags-container .options #face").removeClass().addClass(`fa-regular fa-face-${klass}`);
}
Post.vote_up = function (e) {

View File

@ -13,6 +13,6 @@ $fa-font-path: "@fortawesome/fontawesome-free/webfonts";
font-variant: normal;
text-rendering: auto;
font-family: "Font Awesome 5 Free", "Font Awesome 5 Pro";
font-family: "Font Awesome 6 Free";
font-weight: 900;
}

View File

@ -85,10 +85,6 @@ div#page {
border-radius: 0 $border-radius-half $border-radius-half 0;
}
}
#options-box i.fa-bookmark {
margin-right: 0.25em;
}
}
aside#sidebar > section {

View File

@ -43,15 +43,15 @@ div#c-tags {
font-size: 11pt;
}
.fa-frown {
.fa-face-frown {
color: $tags-vote-down-color;
}
.fa-meh {
.fa-face-meh {
color: $tags-vote-meh-color;
}
.fa-smile {
.fa-face-smile {
color: $tags-vote-up-color;
}
}

View File

@ -43,11 +43,11 @@ class ForumPostVote < ApplicationRecord
def fa_class
if score == 1
return "fa-thumbs-up"
"fa-thumbs-up"
elsif score == -1
return "fa-thumbs-down"
"fa-thumbs-down"
else
return "fa-meh"
"fa-face-meh"
end
end

View File

@ -144,7 +144,7 @@ class TagSetPresenter < Presenter
end
html << tag_link(tag, name.tr("_", " "))
html << %(<i title="Uploaded by the artist" class="highlight far fa-check-circle"></i>) if highlight
html << %(<i title="Uploaded by the artist" class="highlight fa-regular fa-circle-check"></i>) if highlight
if count >= 10_000
post_count = "#{count / 1_000}k"

View File

@ -3,9 +3,9 @@
%>
<li class="forum-post-vote-block">
<%= link_to content_tag(:i, nil, class: "far fa-thumbs-up"), "#", title: "Vote up", class: "forum-vote-up", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "fa-regular fa-thumbs-up"), "#", title: "Vote up", class: "forum-vote-up", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "far fa-meh"), "#", title: "Vote meh", class: "forum-vote-meh", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "fa-regular fa-face-meh"), "#", title: "Vote meh", class: "forum-vote-meh", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "far fa-thumbs-down"), "#", title: "Vote down", class: "forum-vote-down", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "fa-regular fa-thumbs-down"), "#", title: "Vote down", class: "forum-vote-down", 'data-forum-id': forum_post.id %>
</li>

View File

@ -5,10 +5,10 @@
<li class="vote-score-<%= vote.vote_type %> <%= 'own-forum-vote' if vote.creator_id == CurrentUser.id %>">
<% if forum_post.tag_change_request&.is_pending? && vote.creator_id == CurrentUser.id %>
<%= link_to content_tag(:i, nil, class: "far #{vote.fa_class}"), "#", class: "forum-vote-remove", 'data-forum-id': forum_post.id %>
<%= link_to content_tag(:i, nil, class: "fa-regular #{vote.fa_class}"), "#", class: "forum-vote-remove", 'data-forum-id': forum_post.id %>
<%= link_to_user vote.creator %>
<% else %>
<%= content_tag(:i, nil, class: "far #{vote.fa_class}") %>
<%= content_tag(:i, nil, class: "fa-regular #{vote.fa_class}") %>
<%= link_to_user vote.creator %>
<% end %>
</li>

View File

@ -18,8 +18,8 @@
<header id="top">
<div id="maintoggle">
<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="#"><i id="maintoggle-on" class="fa-solid fa-bars"></i></a>
<a href="#"><i id="maintoggle-off" class="fa-solid fa-xmark" style="display: none;"></i></a>
</div>
<nav id="nav">

View File

@ -69,7 +69,7 @@
<dd><div class="replacement-status">
<%= post_replacement.status %>
<% if post_replacement.status == "pending" && (post_replacement.post.tag_array & PostReplacement::HIGHLIGHTED_TAGS).any? %>
<%= tag.i class: "fas fa-exclamation-circle", title: (post_replacement.post.tag_array & PostReplacement::HIGHLIGHTED_TAGS).join(", ") %>
<%= tag.i class: "fa-solid fa-circle-exclamation", title: (post_replacement.post.tag_array & PostReplacement::HIGHLIGHTED_TAGS).join(", ") %>
<% end %>
</div></dd>
<dt>Reason</dt>

View File

@ -31,7 +31,7 @@
<%= hidden_field_tag :random, params[:random] %>
<% end %>
<div class="search-input"><%= text_field_tag("tags", params[:tags], :id => "mobile-search-input", :"data-autocomplete" => "tag-query") %></div>
<div class="search-button"><%= content_tag "button", content_tag("i", nil, class: "fas fa-search"), type: "submit" %></div>
<div class="search-button"><%= content_tag "button", content_tag("i", nil, class: "fa-solid fa-magnifying-glass"), type: "submit" %></div>
<% end %>
</div>
</div>

View File

@ -6,6 +6,6 @@
<% if params[:random] %>
<%= hidden_field_tag :random, params[:random] %>
<% end %>
<%= text_field_tag("tags", tags, :id => tags_dom_id, :"data-shortcut" => "q", :"data-autocomplete" => "tag-query") %><%= content_tag "button", content_tag("i", nil, class: "fas fa-search"), type: "submit" %>
<%= text_field_tag("tags", tags, :id => tags_dom_id, :"data-shortcut" => "q", :"data-autocomplete" => "tag-query") %><%= content_tag "button", content_tag("i", nil, class: "fa-solid fa-magnifying-glass"), type: "submit" %>
<% end %>
</section>

View File

@ -18,9 +18,9 @@
<%= f.label :tag_string, "Tags" %>
<span class="options">
<i id="face" class="fas"></i>
<i id="face"></i>
<span class="count"></span>
<a href="javascript:void(0)"><i id="open-edit-dialog" class="fas fa-arrows-alt" title="detach" data-shortcut="shift+e"></i></a>
<a href="javascript:void(0)"><i id="open-edit-dialog" class="fa-solid fa-up-down-left-right" title="detach" data-shortcut="shift+e"></i></a>
</span>
</div>

View File

@ -17,7 +17,7 @@
<li>
Uploader: <%= link_to_user(post.uploader) %> <%= user_record_meta(post.uploader) %>
<% if post.uploader_linked_artists.any? %>
<i class="uploader-is-artist far fa-check-circle" title="The uploader is linked to one of the artist tags"></i>
<i class="uploader-is-artist fa-regular fa-circle-check" title="The uploader is linked to one of the artist tags"></i>
<% end %>
</li>
<% end %>

View File

@ -101,8 +101,8 @@
<%= post_vote_block(@post, @post.own_vote, buttons: true) %>
</div>
<%= content_tag(:div, class: "fav-buttons fav-buttons-#{@post.is_favorited?}") do %>
<%= button_tag "+Favorite", id: 'add-fav-button', class: "button btn-success", "data-disable-with": tag.i(class: "fas fa-spinner fa-spin"), 'data-pid': @post.id %>
<%= button_tag "-Favorite", id: 'remove-fav-button', class: "button btn-danger", "data-disable-with": tag.i(class: "fas fa-spinner fa-spin"), 'data-pid': @post.id %>
<%= button_tag "+Favorite", id: 'add-fav-button', class: "button btn-success", 'data-pid': @post.id %>
<%= button_tag "-Favorite", id: 'remove-fav-button', class: "button btn-danger", 'data-pid': @post.id %>
<% end %>
<% end %>
<% if @post.visible? %>

View File

@ -3,7 +3,7 @@
"packageManager": "yarn@1.22.19",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@fortawesome/fontawesome-free": "^6.2.1",
"@rails/ujs": "^7.0.4",
"@rails/webpacker": "^6.0.0-rc.5",
"babel-plugin-macros": "^3.1.0",

View File

@ -917,10 +917,10 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
"@fortawesome/fontawesome-free@^5.15.4":
version "5.15.4"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.4.tgz#ecda5712b61ac852c760d8b3c79c96adca5554e5"
integrity sha512-eYm8vijH/hpzr/6/1CJ/V/Eb1xQFW2nnUKArb3z+yUWv7HTwj6M7SP957oMjfZjAHU6qpoNc2wQvIxBLWYa/Jg==
"@fortawesome/fontawesome-free@^6.2.1":
version "6.2.1"
resolved "https://registry.yarnpkg.com/@fortawesome/fontawesome-free/-/fontawesome-free-6.2.1.tgz#344baf6ff9eaad7a73cff067d8c56bfc11ae5304"
integrity sha512-viouXhegu/TjkvYQoiRZK3aax69dGXxgEjpvZW81wIJdxm5Fnvp3VVIP4VHKqX4SvFw6qpmkILkD4RJWAdrt7A==
"@jridgewell/gen-mapping@^0.1.0":
version "0.1.1"