From e1642af94a44b4c6b6e19a1c04fffd694539d72b Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Fri, 9 Aug 2024 12:40:26 -0400 Subject: [PATCH] Use material symbols in table link helper --- app/helpers/admin/filter_helper.rb | 2 +- app/javascript/material-icons/400-24px/key.svg | 1 + app/javascript/material-icons/400-24px/toggle_off.svg | 5 +++++ app/javascript/material-icons/400-24px/toggle_on.svg | 5 +++++ app/views/admin/accounts/_local_account.html.haml | 10 +++++----- app/views/admin/accounts/_remote_account.html.haml | 2 +- app/views/admin/announcements/_announcement.html.haml | 6 +++--- app/views/admin/invites/_invite.html.haml | 2 +- app/views/admin/relays/_relay.html.haml | 6 +++--- app/views/admin/report_notes/_report_note.html.haml | 4 ++-- app/views/admin/reports/_header_details.html.haml | 4 ++-- app/views/admin/roles/_role.html.haml | 2 +- app/views/admin/rules/_rule.html.haml | 2 +- .../admin/warning_presets/_warning_preset.html.haml | 2 +- app/views/admin/webhooks/_webhook.html.haml | 4 ++-- app/views/admin/webhooks/show.html.haml | 4 ++-- app/views/auth/registrations/_session.html.haml | 2 +- app/views/filters/_filter.html.haml | 4 ++-- app/views/invites/_invite.html.haml | 2 +- .../oauth/authorized_applications/index.html.haml | 2 +- app/views/settings/aliases/index.html.haml | 2 +- app/views/settings/applications/index.html.haml | 2 +- app/views/settings/featured_tags/index.html.haml | 2 +- .../webauthn_credentials/index.html.haml | 2 +- .../two_factor_authentication_methods/index.html.haml | 4 ++-- 25 files changed, 47 insertions(+), 36 deletions(-) create mode 100644 app/javascript/material-icons/400-24px/key.svg create mode 100644 app/javascript/material-icons/400-24px/toggle_off.svg create mode 100644 app/javascript/material-icons/400-24px/toggle_on.svg diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 140fc73ede4..40806a45158 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -25,7 +25,7 @@ module Admin::FilterHelper end def table_link_to(icon, text, path, **options) - link_to safe_join([fa_icon(icon), text]), path, options.merge(class: 'table-action-link') + link_to safe_join([material_symbol(icon), text]), path, options.merge(class: 'table-action-link') end def selected?(more_params) diff --git a/app/javascript/material-icons/400-24px/key.svg b/app/javascript/material-icons/400-24px/key.svg new file mode 100644 index 00000000000..bba7f1de9d5 --- /dev/null +++ b/app/javascript/material-icons/400-24px/key.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/app/javascript/material-icons/400-24px/toggle_off.svg b/app/javascript/material-icons/400-24px/toggle_off.svg new file mode 100644 index 00000000000..dcef49f69c1 --- /dev/null +++ b/app/javascript/material-icons/400-24px/toggle_off.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/javascript/material-icons/400-24px/toggle_on.svg b/app/javascript/material-icons/400-24px/toggle_on.svg new file mode 100644 index 00000000000..943b6e6d332 --- /dev/null +++ b/app/javascript/material-icons/400-24px/toggle_on.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/app/views/admin/accounts/_local_account.html.haml b/app/views/admin/accounts/_local_account.html.haml index 3ed392cd1a5..3ad47d8dfb8 100644 --- a/app/views/admin/accounts/_local_account.html.haml +++ b/app/views/admin/accounts/_local_account.html.haml @@ -1,12 +1,12 @@ - if account.avatar? %tr %th= t('admin.accounts.avatar') - %td= table_link_to 'trash', t('admin.accounts.remove_avatar'), remove_avatar_admin_account_path(account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_avatar, account) + %td= table_link_to 'delete', t('admin.accounts.remove_avatar'), remove_avatar_admin_account_path(account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_avatar, account) %td - if account.header? %tr %th= t('admin.accounts.header') - %td= table_link_to 'trash', t('admin.accounts.remove_header'), remove_header_admin_account_path(account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_header, account) + %td= table_link_to 'delete', t('admin.accounts.remove_header'), remove_header_admin_account_path(account.id), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:remove_header, account) %td %tr %th= t('admin.accounts.role') @@ -16,7 +16,7 @@ - else = account.user_role&.name %td - = table_link_to 'vcard', t('admin.accounts.change_role.label'), admin_user_role_path(account.user) if can?(:change_role, account.user) + = table_link_to 'contact_mail', t('admin.accounts.change_role.label'), admin_user_role_path(account.user) if can?(:change_role, account.user) %tr %th{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= t('admin.accounts.email') %td{ rowspan: can?(:create, :email_domain_block) ? 3 : 2 }= account.user_email @@ -25,7 +25,7 @@ %td= table_link_to 'search', t('admin.accounts.search_same_email_domain'), admin_accounts_path(email: "%@#{account.user_email.split('@').last}") - if can?(:create, :email_domain_block) %tr - %td= table_link_to 'ban', t('admin.accounts.add_email_domain_block'), new_admin_email_domain_block_path(_domain: account.user_email.split('@').last) + %td= table_link_to 'hide_source', t('admin.accounts.add_email_domain_block'), new_admin_email_domain_block_path(_domain: account.user_email.split('@').last) - if account.user_unconfirmed_email.present? %tr %th= t('admin.accounts.unconfirmed_email') @@ -48,7 +48,7 @@ = t 'admin.accounts.security_measures.only_password' %td - if account.user&.two_factor_enabled? && can?(:disable_2fa, account.user) - = table_link_to 'unlock', t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(account.user.id), method: :delete + = table_link_to 'lock_open', t('admin.accounts.disable_two_factor_authentication'), admin_user_two_factor_authentication_path(account.user.id), method: :delete - if can?(:reset_password, account.user) %tr %td diff --git a/app/views/admin/accounts/_remote_account.html.haml b/app/views/admin/accounts/_remote_account.html.haml index 6755af2496c..a052e877f43 100644 --- a/app/views/admin/accounts/_remote_account.html.haml +++ b/app/views/admin/accounts/_remote_account.html.haml @@ -12,4 +12,4 @@ = material_symbol DeliveryFailureTracker.available?(account.shared_inbox_url) ? 'check' : 'close' %td - if domain_block.nil? - = table_link_to 'ban', t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: account.domain) + = table_link_to 'hide_source', t('admin.domain_blocks.add_new'), new_admin_domain_block_path(_domain: account.domain) diff --git a/app/views/admin/announcements/_announcement.html.haml b/app/views/admin/announcements/_announcement.html.haml index 1c7f89ef21a..eac78efb288 100644 --- a/app/views/admin/announcements/_announcement.html.haml +++ b/app/views/admin/announcements/_announcement.html.haml @@ -12,8 +12,8 @@ %div - if can?(:update, announcement) - if announcement.published? - = table_link_to 'toggle-off', t('admin.announcements.unpublish'), unpublish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'toggle_off', t('admin.announcements.unpublish'), unpublish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } - else - = table_link_to 'toggle-on', t('admin.announcements.publish'), publish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'toggle_on', t('admin.announcements.publish'), publish_admin_announcement_path(announcement), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } - = table_link_to 'trash', t('generic.delete'), admin_announcement_path(announcement), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, announcement) + = table_link_to 'delete', t('generic.delete'), admin_announcement_path(announcement), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, announcement) diff --git a/app/views/admin/invites/_invite.html.haml b/app/views/admin/invites/_invite.html.haml index f9cd6003f3d..8bd5f10feef 100644 --- a/app/views/admin/invites/_invite.html.haml +++ b/app/views/admin/invites/_invite.html.haml @@ -27,4 +27,4 @@ %td - if invite.valid_for_use? && policy(invite).destroy? - = table_link_to 'times', t('invites.delete'), admin_invite_path(invite), method: :delete + = table_link_to 'close', t('invites.delete'), admin_invite_path(invite), method: :delete diff --git a/app/views/admin/relays/_relay.html.haml b/app/views/admin/relays/_relay.html.haml index 2e76f543083..9e9f629eee1 100644 --- a/app/views/admin/relays/_relay.html.haml +++ b/app/views/admin/relays/_relay.html.haml @@ -18,8 +18,8 @@ = t 'admin.relays.disabled' %td - if relay.accepted? - = table_link_to 'power-off', t('admin.relays.disable'), disable_admin_relay_path(relay), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'power_off', t('admin.relays.disable'), disable_admin_relay_path(relay), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } - elsif !relay.pending? - = table_link_to 'power-off', t('admin.relays.enable'), enable_admin_relay_path(relay), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'power_off', t('admin.relays.enable'), enable_admin_relay_path(relay), method: :post, data: { confirm: t('admin.accounts.are_you_sure') } - = table_link_to 'times', t('admin.relays.delete'), admin_relay_path(relay), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'close', t('admin.relays.delete'), admin_relay_path(relay), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/admin/report_notes/_report_note.html.haml b/app/views/admin/report_notes/_report_note.html.haml index 64628989a6a..dd60f7eabd0 100644 --- a/app/views/admin/report_notes/_report_note.html.haml +++ b/app/views/admin/report_notes/_report_note.html.haml @@ -13,6 +13,6 @@ - if can?(:destroy, report_note) .report-notes__item__actions - if report_note.is_a?(AccountModerationNote) - = table_link_to 'trash', t('admin.reports.notes.delete'), admin_account_moderation_note_path(report_note), method: :delete + = table_link_to 'delete', t('admin.reports.notes.delete'), admin_account_moderation_note_path(report_note), method: :delete - else - = table_link_to 'trash', t('admin.reports.notes.delete'), admin_report_note_path(report_note), method: :delete + = table_link_to 'delete', t('admin.reports.notes.delete'), admin_report_note_path(report_note), method: :delete diff --git a/app/views/admin/reports/_header_details.html.haml b/app/views/admin/reports/_header_details.html.haml index 434231f7333..cf81670845f 100644 --- a/app/views/admin/reports/_header_details.html.haml +++ b/app/views/admin/reports/_header_details.html.haml @@ -54,6 +54,6 @@ = admin_account_link_to report.assigned_account — - if report.assigned_account != current_user.account - = table_link_to 'user', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(report), method: :post + = table_link_to 'person', t('admin.reports.assign_to_self'), assign_to_self_admin_report_path(report), method: :post - elsif !report.assigned_account.nil? - = table_link_to 'trash', t('admin.reports.unassign'), unassign_admin_report_path(report), method: :post + = table_link_to 'delete', t('admin.reports.unassign'), unassign_admin_report_path(report), method: :post diff --git a/app/views/admin/roles/_role.html.haml b/app/views/admin/roles/_role.html.haml index fd37644c835..636127354b0 100644 --- a/app/views/admin/roles/_role.html.haml +++ b/app/views/admin/roles/_role.html.haml @@ -27,4 +27,4 @@ · %abbr{ title: role.permissions_as_keys.map { |privilege| I18n.t("admin.roles.privileges.#{privilege}") }.join(', ') }= t('admin.roles.permissions_count', count: role.permissions_as_keys.size) %div - = table_link_to 'pencil', t('admin.accounts.edit'), edit_admin_role_path(role) if can?(:update, role) + = table_link_to 'edit', t('admin.accounts.edit'), edit_admin_role_path(role) if can?(:update, role) diff --git a/app/views/admin/rules/_rule.html.haml b/app/views/admin/rules/_rule.html.haml index 5f37f693543..eb97eefb3c7 100644 --- a/app/views/admin/rules/_rule.html.haml +++ b/app/views/admin/rules/_rule.html.haml @@ -8,4 +8,4 @@ = rule.hint %div - = table_link_to 'trash', t('admin.rules.delete'), admin_rule_path(rule), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, rule) + = table_link_to 'delete', t('admin.rules.delete'), admin_rule_path(rule), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, rule) diff --git a/app/views/admin/warning_presets/_warning_preset.html.haml b/app/views/admin/warning_presets/_warning_preset.html.haml index a58199c8046..2cc056420f4 100644 --- a/app/views/admin/warning_presets/_warning_preset.html.haml +++ b/app/views/admin/warning_presets/_warning_preset.html.haml @@ -7,4 +7,4 @@ = truncate(warning_preset.text) %div - = table_link_to 'trash', t('admin.warning_presets.delete'), admin_warning_preset_path(warning_preset), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, warning_preset) + = table_link_to 'delete', t('admin.warning_presets.delete'), admin_warning_preset_path(warning_preset), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, warning_preset) diff --git a/app/views/admin/webhooks/_webhook.html.haml b/app/views/admin/webhooks/_webhook.html.haml index 39abb7dd2c7..dca5abeb777 100644 --- a/app/views/admin/webhooks/_webhook.html.haml +++ b/app/views/admin/webhooks/_webhook.html.haml @@ -15,5 +15,5 @@ %abbr{ title: webhook.events.join(', ') }= t('admin.webhooks.enabled_events', count: webhook.events.size) %div - = table_link_to 'pencil', t('admin.webhooks.edit'), edit_admin_webhook_path(webhook) if can?(:update, webhook) - = table_link_to 'trash', t('admin.webhooks.delete'), admin_webhook_path(webhook), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, webhook) + = table_link_to 'edit', t('admin.webhooks.edit'), edit_admin_webhook_path(webhook) if can?(:update, webhook) + = table_link_to 'delete', t('admin.webhooks.delete'), admin_webhook_path(webhook), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } if can?(:destroy, webhook) diff --git a/app/views/admin/webhooks/show.html.haml b/app/views/admin/webhooks/show.html.haml index c2c4f55788e..a389e611029 100644 --- a/app/views/admin/webhooks/show.html.haml +++ b/app/views/admin/webhooks/show.html.haml @@ -19,10 +19,10 @@ %td - if @webhook.enabled? %span.positive-hint= t('admin.webhooks.enabled') - = table_link_to 'power-off', t('admin.webhooks.disable'), disable_admin_webhook_path(@webhook), method: :post if can?(:disable, @webhook) + = table_link_to 'power_off', t('admin.webhooks.disable'), disable_admin_webhook_path(@webhook), method: :post if can?(:disable, @webhook) - else %span.negative-hint= t('admin.webhooks.disabled') - = table_link_to 'power-off', t('admin.webhooks.enable'), enable_admin_webhook_path(@webhook), method: :post if can?(:enable, @webhook) + = table_link_to 'power_off', t('admin.webhooks.enable'), enable_admin_webhook_path(@webhook), method: :post if can?(:enable, @webhook) %tr %th= t('admin.webhooks.events') %td diff --git a/app/views/auth/registrations/_session.html.haml b/app/views/auth/registrations/_session.html.haml index 2fa7db70c7b..631ae046016 100644 --- a/app/views/auth/registrations/_session.html.haml +++ b/app/views/auth/registrations/_session.html.haml @@ -15,4 +15,4 @@ %time.time-ago{ datetime: session.updated_at.iso8601, title: l(session.updated_at) }= l(session.updated_at) %td - if current_session.session_id != session.session_id && !current_account.suspended? - = table_link_to 'times', t('sessions.revoke'), settings_session_path(session), method: :delete + = table_link_to 'close', t('sessions.revoke'), settings_session_path(session), method: :delete diff --git a/app/views/filters/_filter.html.haml b/app/views/filters/_filter.html.haml index 9993ad2ee8e..9d82a979fef 100644 --- a/app/views/filters/_filter.html.haml +++ b/app/views/filters/_filter.html.haml @@ -37,5 +37,5 @@ = t('filters.index.contexts', contexts: filter.context.map { |context| I18n.t("filters.contexts.#{context}") }.join(', ')) %div - = table_link_to 'pencil', t('filters.edit.title'), edit_filter_path(filter) - = table_link_to 'times', t('filters.index.delete'), filter_path(filter), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'edit', t('filters.edit.title'), edit_filter_path(filter) + = table_link_to 'close', t('filters.index.delete'), filter_path(filter), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/invites/_invite.html.haml b/app/views/invites/_invite.html.haml index 62799ca5be2..d332dc5a4d5 100644 --- a/app/views/invites/_invite.html.haml +++ b/app/views/invites/_invite.html.haml @@ -22,4 +22,4 @@ %td - if invite.valid_for_use? && policy(invite).destroy? - = table_link_to 'times', t('invites.delete'), invite_path(invite), method: :delete + = table_link_to 'close', t('invites.delete'), invite_path(invite), method: :delete diff --git a/app/views/oauth/authorized_applications/index.html.haml b/app/views/oauth/authorized_applications/index.html.haml index 92e24d30c85..009bbf8d85c 100644 --- a/app/views/oauth/authorized_applications/index.html.haml +++ b/app/views/oauth/authorized_applications/index.html.haml @@ -29,7 +29,7 @@ - unless application.superapp? || current_account.unavailable? %div - = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } + = table_link_to 'close', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } .announcements-list__item__permissions %ul.permissions-list diff --git a/app/views/settings/aliases/index.html.haml b/app/views/settings/aliases/index.html.haml index c618a82f1dd..81c49c82031 100644 --- a/app/views/settings/aliases/index.html.haml +++ b/app/views/settings/aliases/index.html.haml @@ -30,4 +30,4 @@ - @aliases.each do |account_alias| %tr %td= account_alias.pretty_acct - %td= table_link_to 'trash', t('aliases.remove'), settings_alias_path(account_alias), data: { method: :delete } + %td= table_link_to 'delete', t('aliases.remove'), settings_alias_path(account_alias), data: { method: :delete } diff --git a/app/views/settings/applications/index.html.haml b/app/views/settings/applications/index.html.haml index 5c31d56bca5..80eaed5c399 100644 --- a/app/views/settings/applications/index.html.haml +++ b/app/views/settings/applications/index.html.haml @@ -20,6 +20,6 @@ %td= link_to application.name, settings_application_path(application) %th= application.scopes %td - = table_link_to 'times', t('doorkeeper.applications.index.delete'), settings_application_path(application), method: :delete, data: { confirm: t('doorkeeper.applications.confirmations.destroy') } + = table_link_to 'close', t('doorkeeper.applications.index.delete'), settings_application_path(application), method: :delete, data: { confirm: t('doorkeeper.applications.confirmations.destroy') } = paginate @applications diff --git a/app/views/settings/featured_tags/index.html.haml b/app/views/settings/featured_tags/index.html.haml index 4b6c019e69b..088a93bc595 100644 --- a/app/views/settings/featured_tags/index.html.haml +++ b/app/views/settings/featured_tags/index.html.haml @@ -31,5 +31,5 @@ = t('accounts.nothing_here') - else %time.formatted{ datetime: featured_tag.last_status_at.iso8601, title: l(featured_tag.last_status_at) }= l featured_tag.last_status_at - = table_link_to 'trash', t('filters.index.delete'), settings_featured_tag_path(featured_tag), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + = table_link_to 'delete', t('filters.index.delete'), settings_featured_tag_path(featured_tag), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } .trends__item__current= friendly_number_to_human featured_tag.statuses_count diff --git a/app/views/settings/two_factor_authentication/webauthn_credentials/index.html.haml b/app/views/settings/two_factor_authentication/webauthn_credentials/index.html.haml index 0dfd94ab9dc..3ea5810207f 100644 --- a/app/views/settings/two_factor_authentication/webauthn_credentials/index.html.haml +++ b/app/views/settings/two_factor_authentication/webauthn_credentials/index.html.haml @@ -9,7 +9,7 @@ %td= credential.nickname %td= t('webauthn_credentials.registered_on', date: l(credential.created_at.to_date, format: :with_month_name)) %td - = table_link_to 'trash', t('webauthn_credentials.delete'), settings_webauthn_credential_path(credential.id), method: :delete, data: { confirm: t('webauthn_credentials.delete_confirmation') } + = table_link_to 'delete', t('webauthn_credentials.delete'), settings_webauthn_credential_path(credential.id), method: :delete, data: { confirm: t('webauthn_credentials.delete_confirmation') } %hr.spacer/ diff --git a/app/views/settings/two_factor_authentication_methods/index.html.haml b/app/views/settings/two_factor_authentication_methods/index.html.haml index 2e4ff4091c7..8b670283b9e 100644 --- a/app/views/settings/two_factor_authentication_methods/index.html.haml +++ b/app/views/settings/two_factor_authentication_methods/index.html.haml @@ -20,12 +20,12 @@ %tr %td= t('two_factor_authentication.otp') %td - = table_link_to 'pencil', t('two_factor_authentication.edit'), settings_otp_authentication_path, method: :post + = table_link_to 'edit', t('two_factor_authentication.edit'), settings_otp_authentication_path, method: :post %tr %td= t('two_factor_authentication.webauthn') - if current_user.webauthn_enabled? %td - = table_link_to 'pencil', t('two_factor_authentication.edit'), settings_webauthn_credentials_path, method: :get + = table_link_to 'edit', t('two_factor_authentication.edit'), settings_webauthn_credentials_path, method: :get - else %td = table_link_to 'key', t('two_factor_authentication.add'), new_settings_webauthn_credential_path, method: :get