Replace more `font-awesome` icons in `app/helpers` (#30962)
parent
e4092cc73a
commit
52a626f39b
|
@ -116,7 +116,7 @@ module ApplicationHelper
|
||||||
def material_symbol(icon, attributes = {})
|
def material_symbol(icon, attributes = {})
|
||||||
inline_svg_tag(
|
inline_svg_tag(
|
||||||
"400-24px/#{icon}.svg",
|
"400-24px/#{icon}.svg",
|
||||||
class: %w(icon).concat(attributes[:class].to_s.split),
|
class: ['icon', "material-#{icon}"].concat(attributes[:class].to_s.split),
|
||||||
role: :img
|
role: :img
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -127,23 +127,23 @@ module ApplicationHelper
|
||||||
|
|
||||||
def visibility_icon(status)
|
def visibility_icon(status)
|
||||||
if status.public_visibility?
|
if status.public_visibility?
|
||||||
fa_icon('globe', title: I18n.t('statuses.visibilities.public'))
|
material_symbol('globe', title: I18n.t('statuses.visibilities.public'))
|
||||||
elsif status.unlisted_visibility?
|
elsif status.unlisted_visibility?
|
||||||
fa_icon('unlock', title: I18n.t('statuses.visibilities.unlisted'))
|
material_symbol('lock_open', title: I18n.t('statuses.visibilities.unlisted'))
|
||||||
elsif status.private_visibility? || status.limited_visibility?
|
elsif status.private_visibility? || status.limited_visibility?
|
||||||
fa_icon('lock', title: I18n.t('statuses.visibilities.private'))
|
material_symbol('lock', title: I18n.t('statuses.visibilities.private'))
|
||||||
elsif status.direct_visibility?
|
elsif status.direct_visibility?
|
||||||
fa_icon('at', title: I18n.t('statuses.visibilities.direct'))
|
material_symbol('alternate_email', title: I18n.t('statuses.visibilities.direct'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def interrelationships_icon(relationships, account_id)
|
def interrelationships_icon(relationships, account_id)
|
||||||
if relationships.following[account_id] && relationships.followed_by[account_id]
|
if relationships.following[account_id] && relationships.followed_by[account_id]
|
||||||
fa_icon('exchange', title: I18n.t('relationships.mutual'), class: 'fa-fw active passive')
|
material_symbol('sync_alt', title: I18n.t('relationships.mutual'), class: 'active passive')
|
||||||
elsif relationships.following[account_id]
|
elsif relationships.following[account_id]
|
||||||
fa_icon(locale_direction == 'ltr' ? 'arrow-right' : 'arrow-left', title: I18n.t('relationships.following'), class: 'fa-fw active')
|
material_symbol(locale_direction == 'ltr' ? 'arrow_right_alt' : 'arrow_left_alt', title: I18n.t('relationships.following'), class: 'active')
|
||||||
elsif relationships.followed_by[account_id]
|
elsif relationships.followed_by[account_id]
|
||||||
fa_icon(locale_direction == 'ltr' ? 'arrow-left' : 'arrow-right', title: I18n.t('relationships.followers'), class: 'fa-fw passive')
|
material_symbol(locale_direction == 'ltr' ? 'arrow_left_alt' : 'arrow_right_alt', title: I18n.t('relationships.followers'), class: 'passive')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -60,13 +60,13 @@ module StatusesHelper
|
||||||
def fa_visibility_icon(status)
|
def fa_visibility_icon(status)
|
||||||
case status.visibility
|
case status.visibility
|
||||||
when 'public'
|
when 'public'
|
||||||
fa_icon 'globe fw'
|
material_symbol 'globe'
|
||||||
when 'unlisted'
|
when 'unlisted'
|
||||||
fa_icon 'unlock fw'
|
material_symbol 'lock_open'
|
||||||
when 'private'
|
when 'private'
|
||||||
fa_icon 'lock fw'
|
material_symbol 'lock'
|
||||||
when 'direct'
|
when 'direct'
|
||||||
fa_icon 'at fw'
|
material_symbol 'alternate_email'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M400-240 160-480l240-240 56 58-142 142h486v80H314l142 142-56 58Z"/></svg>
|
After Width: | Height: | Size: 189 B |
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#5f6368"><path d="M280-120 80-320l200-200 57 56-104 104h607v80H233l104 104-57 56Zm400-320-57-56 104-104H120v-80h607L623-784l57-56 200 200-200 200Z"/></svg>
|
After Width: | Height: | Size: 253 B |
|
@ -223,7 +223,7 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
it 'returns an unlock icon for a unlisted visible status' do
|
it 'returns an unlock icon for a unlisted visible status' do
|
||||||
result = helper.visibility_icon Status.new(visibility: 'unlisted')
|
result = helper.visibility_icon Status.new(visibility: 'unlisted')
|
||||||
expect(result).to match(/unlock/)
|
expect(result).to match(/lock_open/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns a lock icon for a private visible status' do
|
it 'returns a lock icon for a private visible status' do
|
||||||
|
@ -233,7 +233,7 @@ describe ApplicationHelper do
|
||||||
|
|
||||||
it 'returns an at icon for a direct visible status' do
|
it 'returns an at icon for a direct visible status' do
|
||||||
result = helper.visibility_icon Status.new(visibility: 'direct')
|
result = helper.visibility_icon Status.new(visibility: 'direct')
|
||||||
expect(result).to match(/at/)
|
expect(result).to match(/alternate_email/)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ describe StatusesHelper do
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.fa_visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('fa-globe')
|
expect(result).to match('material-globe')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ describe StatusesHelper do
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.fa_visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('fa-unlock')
|
expect(result).to match('material-lock_open')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ describe StatusesHelper do
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.fa_visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('fa-lock')
|
expect(result).to match('material-lock')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ describe StatusesHelper do
|
||||||
it 'returns the correct fa icon' do
|
it 'returns the correct fa icon' do
|
||||||
result = helper.fa_visibility_icon(status)
|
result = helper.fa_visibility_icon(status)
|
||||||
|
|
||||||
expect(result).to match('fa-at')
|
expect(result).to match('material-alternate_email')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue