Scrollable tables in settings pages (#4857)

* Scrollable tables in settings pages

* Add space before curly brace
This commit is contained in:
Lynx Kotoura 2017-09-09 09:26:58 +09:00 committed by Eugen Rochko
parent baa8b82179
commit 3c45d3963a
15 changed files with 262 additions and 249 deletions

View file

@ -190,11 +190,15 @@
.filters { .filters {
display: flex; display: flex;
margin-bottom: 20px; flex-wrap: wrap;
.filter-subset { .filter-subset {
flex: 0 0 auto; flex: 0 0 auto;
margin-right: 40px; margin: 0 40px 10px 0;
&:last-child {
margin-bottom: 20px;
}
ul { ul {
margin-top: 5px; margin-top: 5px;

View file

@ -3,7 +3,6 @@
max-width: 100%; max-width: 100%;
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
margin-bottom: 20px;
th, th,
td { td {
@ -43,19 +42,17 @@
font-weight: 500; font-weight: 500;
} }
&.inline-table { &.inline-table > tbody > tr:nth-child(odd) > td,
td, &.inline-table > tbody > tr:nth-child(odd) > th {
th { background: transparent;
padding: 8px 2px;
}
& > tbody > tr:nth-child(odd) > td,
& > tbody > tr:nth-child(odd) > th {
background: transparent;
}
} }
} }
.table-wrapper {
overflow: auto;
margin-bottom: 20px;
}
samp { samp {
font-family: 'mastodon-font-monospace', monospace; font-family: 'mastodon-font-monospace', monospace;
} }

View file

@ -1,16 +1,17 @@
%table.table .table-wrapper
%tbody %table.table
%tr %tbody
%td= t('admin.accounts.show.created_reports')
%td= link_to pluralize(account.reports.count, t('admin.accounts.show.report')), admin_reports_path(account_id: account.id)
%tr
%td= t('admin.accounts.show.targeted_reports')
%td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id)
- if account.silenced? || account.suspended?
%tr %tr
%td= t('admin.accounts.moderation.title') %td= t('admin.accounts.show.created_reports')
%td %td= link_to pluralize(account.reports.count, t('admin.accounts.show.report')), admin_reports_path(account_id: account.id)
- if account.silenced? %tr
%p= t('admin.accounts.moderation.silenced') %td= t('admin.accounts.show.targeted_reports')
- if account.suspended? %td= link_to pluralize(account.targeted_reports.count, t('admin.accounts.show.report')), admin_reports_path(target_account_id: account.id)
%p= t('admin.accounts.moderation.suspended') - if account.silenced? || account.suspended?
%tr
%td= t('admin.accounts.moderation.title')
%td
- if account.silenced?
%p= t('admin.accounts.moderation.silenced')
- if account.suspended?
%p= t('admin.accounts.moderation.suspended')

View file

@ -50,16 +50,17 @@
%button= t('admin.accounts.search') %button= t('admin.accounts.search')
= link_to t('admin.accounts.reset'), admin_accounts_path, class: 'button negative' = link_to t('admin.accounts.reset'), admin_accounts_path, class: 'button negative'
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('admin.accounts.username') %tr
%th= t('admin.accounts.domain') %th= t('admin.accounts.username')
%th= t('admin.accounts.protocol') %th= t('admin.accounts.domain')
%th= t('admin.accounts.confirmed') %th= t('admin.accounts.protocol')
%th= fa_icon 'paper-plane-o' %th= t('admin.accounts.confirmed')
%th %th= fa_icon 'paper-plane-o'
%tbody %th
= render @accounts %tbody
= render @accounts
= paginate @accounts = paginate @accounts

View file

@ -1,86 +1,86 @@
- content_for :page_title do - content_for :page_title do
= @account.acct = @account.acct
%table.table .table-wrapper
%tbody %table.table
%tr %tbody
%th= t('admin.accounts.username') %tr
%td= @account.username %th= t('admin.accounts.username')
%tr %td= @account.username
%th= t('admin.accounts.domain') %tr
%td= @account.domain %th= t('admin.accounts.domain')
%tr %td= @account.domain
%th= t('admin.accounts.display_name') %tr
%td= @account.display_name %th= t('admin.accounts.display_name')
%td= @account.display_name
- if @account.local? - if @account.local?
%tr
%th= t('admin.accounts.email')
%td= @account.user_email
%tr
%th= t('admin.accounts.most_recent_ip')
%td= @account.user_current_sign_in_ip
%tr
%th= t('admin.accounts.most_recent_activity')
%td
- if @account.user_current_sign_in_at
%time.formatted{ datetime: @account.user_current_sign_in_at.iso8601, title: l(@account.user_current_sign_in_at) }
= l @account.user_current_sign_in_at
- else
Never
- else
%tr
%th= t('admin.accounts.profile_url')
%td= link_to @account.url, @account.url
%tr
%th= t('admin.accounts.protocol')
%td= @account.protocol.humanize
- if @account.ostatus?
%tr %tr
%th= t('admin.accounts.feed_url') %th= t('admin.accounts.email')
%td= link_to @account.remote_url, @account.remote_url %td= @account.user_email
%tr %tr
%th= t('admin.accounts.push_subscription_expires') %th= t('admin.accounts.most_recent_ip')
%td= @account.user_current_sign_in_ip
%tr
%th= t('admin.accounts.most_recent_activity')
%td %td
- if @account.subscribed? - if @account.user_current_sign_in_at
%time.formatted{ datetime: @account.subscription_expires_at.iso8601, title: l(@account.subscription_expires_at) } %time.formatted{ datetime: @account.user_current_sign_in_at.iso8601, title: l(@account.user_current_sign_in_at) }
= l @account.subscription_expires_at = l @account.user_current_sign_in_at
- else - else
= t('admin.accounts.not_subscribed') Never
- else
%tr %tr
%th= t('admin.accounts.salmon_url') %th= t('admin.accounts.profile_url')
%td= link_to @account.salmon_url, @account.salmon_url %td= link_to @account.url, @account.url
- elsif @account.activitypub?
%tr %tr
%th= t('admin.accounts.inbox_url') %th= t('admin.accounts.protocol')
%td= link_to @account.inbox_url, @account.inbox_url %td= @account.protocol.humanize
%tr
%th= t('admin.accounts.outbox_url')
%td= link_to @account.outbox_url, @account.outbox_url
%tr - if @account.ostatus?
%th= t('admin.accounts.follows') %tr
%td= @account.following_count %th= t('admin.accounts.feed_url')
%tr %td= link_to @account.remote_url, @account.remote_url
%th= t('admin.accounts.followers') %tr
%td= @account.followers_count %th= t('admin.accounts.push_subscription_expires')
%tr %td
%th= t('admin.accounts.statuses') - if @account.subscribed?
%td= link_to @account.statuses_count, admin_account_statuses_path(@account.id) %time.formatted{ datetime: @account.subscription_expires_at.iso8601, title: l(@account.subscription_expires_at) }
%tr = l @account.subscription_expires_at
%th= t('admin.accounts.media_attachments') - else
%td = t('admin.accounts.not_subscribed')
= link_to @account.media_attachments.count, admin_account_statuses_path(@account.id, { media: true }) %tr
= surround '(', ')' do %th= t('admin.accounts.salmon_url')
= number_to_human_size @account.media_attachments.sum('file_file_size') %td= link_to @account.salmon_url, @account.salmon_url
%tr - elsif @account.activitypub?
%th= t('.created_reports') %tr
%td= link_to pluralize(@account.reports.count, t('.report')), admin_reports_path(account_id: @account.id) %th= t('admin.accounts.inbox_url')
%tr %td= link_to @account.inbox_url, @account.inbox_url
%th= t('.targeted_reports') %tr
%td= link_to pluralize(@account.targeted_reports.count, t('.report')), admin_reports_path(target_account_id: @account.id) %th= t('admin.accounts.outbox_url')
%td= link_to @account.outbox_url, @account.outbox_url
%tr
%th= t('admin.accounts.follows')
%td= @account.following_count
%tr
%th= t('admin.accounts.followers')
%td= @account.followers_count
%tr
%th= t('admin.accounts.statuses')
%td= link_to @account.statuses_count, admin_account_statuses_path(@account.id)
%tr
%th= t('admin.accounts.media_attachments')
%td
= link_to @account.media_attachments.count, admin_account_statuses_path(@account.id, { media: true })
= surround '(', ')' do
= number_to_human_size @account.media_attachments.sum('file_file_size')
%tr
%th= t('.created_reports')
%td= link_to pluralize(@account.reports.count, t('.report')), admin_reports_path(account_id: @account.id)
%tr
%th= t('.targeted_reports')
%td= link_to pluralize(@account.targeted_reports.count, t('.report')), admin_reports_path(target_account_id: @account.id)
%div{ style: 'float: right' } %div{ style: 'float: right' }
- if @account.local? - if @account.local?

View file

@ -1,15 +1,16 @@
- content_for :page_title do - content_for :page_title do
= t('admin.domain_blocks.title') = t('admin.domain_blocks.title')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('admin.domain_blocks.domain') %tr
%th= t('admin.domain_blocks.severity') %th= t('admin.domain_blocks.domain')
%th= t('admin.domain_blocks.reject_media') %th= t('admin.domain_blocks.severity')
%th %th= t('admin.domain_blocks.reject_media')
%tbody %th
= render @domain_blocks %tbody
= render @domain_blocks
= paginate @domain_blocks = paginate @domain_blocks
= link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button' = link_to t('admin.domain_blocks.add_new'), new_admin_domain_block_path, class: 'button'

View file

@ -1,12 +1,13 @@
- content_for :page_title do - content_for :page_title do
= t('admin.instances.title') = t('admin.instances.title')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('admin.instances.domain_name') %tr
%th= t('admin.instances.account_count') %th= t('admin.instances.domain_name')
%tbody %th= t('admin.instances.account_count')
= render @instances %tbody
= render @instances
= paginate paginated_instances = paginate paginated_instances

View file

@ -10,17 +10,18 @@
= form_tag do = form_tag do
%table.table .table-wrapper
%thead %table.table
%tr %thead
-# %th %tr
%th= t('admin.reports.id') -# %th
%th= t('admin.reports.target') %th= t('admin.reports.id')
%th= t('admin.reports.reported_by') %th= t('admin.reports.target')
%th= t('admin.reports.comment.label') %th= t('admin.reports.reported_by')
%th= t('admin.reports.report_contents') %th= t('admin.reports.comment.label')
%th %th= t('admin.reports.report_contents')
%tbody %th
= render @reports %tbody
= render @reports
= paginate @reports = paginate @reports

View file

@ -1,15 +1,16 @@
- content_for :page_title do - content_for :page_title do
= t('admin.subscriptions.title') = t('admin.subscriptions.title')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('admin.subscriptions.topic') %tr
%th= t('admin.subscriptions.callback_url') %th= t('admin.subscriptions.topic')
%th= t('admin.subscriptions.confirmed') %th= t('admin.subscriptions.callback_url')
%th= t('admin.subscriptions.expires_in') %th= t('admin.subscriptions.confirmed')
%th= t('admin.subscriptions.last_delivery') %th= t('admin.subscriptions.expires_in')
%tbody %th= t('admin.subscriptions.last_delivery')
= render @subscriptions %tbody
= render @subscriptions
= paginate @subscriptions = paginate @subscriptions

View file

@ -1,28 +1,29 @@
%h6= t 'sessions.title' %h6= t 'sessions.title'
%p.muted-hint= t 'sessions.explanation' %p.muted-hint= t 'sessions.explanation'
%table.table.inline-table .table-wrapper
%thead %table.table.inline-table
%tr %thead
%th= t 'sessions.browser'
%th= t 'sessions.ip'
%th= t 'sessions.activity'
%td
%tbody
- @sessions.each do |session|
%tr %tr
%th= t 'sessions.browser'
%th= t 'sessions.ip'
%th= t 'sessions.activity'
%td %td
%span{ title: session.user_agent }< %tbody
= fa_icon "#{session_device_icon(session)} fw", 'aria-label' => session_device_icon(session) - @sessions.each do |session|
= ' ' %tr
= t 'sessions.description', browser: t("sessions.browsers.#{session.browser}"), platform: t("sessions.platforms.#{session.platform}") %td
%td %span{ title: session.user_agent }<
%samp= session.ip = fa_icon "#{session_device_icon(session)} fw", 'aria-label' => session_device_icon(session)
%td = ' '
- if current_session.session_id == session.session_id = t 'sessions.description', browser: t("sessions.browsers.#{session.browser}"), platform: t("sessions.platforms.#{session.platform}")
= t 'sessions.current_session' %td
- else %samp= session.ip
%time.time-ago{ datetime: session.updated_at.iso8601, title: l(session.updated_at) }= l(session.updated_at) %td
%td - if current_session.session_id == session.session_id
- if current_session.session_id != session.session_id = t 'sessions.current_session'
= table_link_to 'times', t('sessions.revoke'), settings_session_path(session), method: :delete - else
%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
= table_link_to 'times', t('sessions.revoke'), settings_session_path(session), method: :delete

View file

@ -1,23 +1,24 @@
- content_for :page_title do - content_for :page_title do
= t('doorkeeper.authorized_applications.index.title') = t('doorkeeper.authorized_applications.index.title')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('doorkeeper.authorized_applications.index.application')
%th= t('doorkeeper.authorized_applications.index.scopes')
%th= t('doorkeeper.authorized_applications.index.created_at')
%th
%tbody
- @applications.each do |application|
%tr %tr
%td %th= t('doorkeeper.authorized_applications.index.application')
- if application.website.blank? %th= t('doorkeeper.authorized_applications.index.scopes')
= application.name %th= t('doorkeeper.authorized_applications.index.created_at')
- else %th
= link_to application.name, application.website, target: '_blank', rel: 'noopener' %tbody
%th!= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />') - @applications.each do |application|
%td= l application.created_at %tr
%td %td
- unless application.superapp? - if application.website.blank?
= 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') } = application.name
- else
= link_to application.name, application.website, target: '_blank', rel: 'noopener'
%th!= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />')
%td= l application.created_at
%td
- unless application.superapp?
= 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') }

View file

@ -1,19 +1,20 @@
- content_for :page_title do - content_for :page_title do
= t('doorkeeper.applications.index.title') = t('doorkeeper.applications.index.title')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th= t('doorkeeper.applications.index.application')
%th= t('doorkeeper.applications.index.scopes')
%th
%tbody
- @applications.each do |application|
%tr %tr
%td= link_to application.name, settings_application_path(application) %th= t('doorkeeper.applications.index.application')
%th= application.scopes %th= t('doorkeeper.applications.index.scopes')
%td %th
= table_link_to 'times', t('doorkeeper.applications.index.delete'), settings_application_path(application), method: :delete, data: { confirm: t('doorkeeper.applications.confirmations.destroy') } %tbody
- @applications.each do |application|
%tr
%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') }
= paginate @applications = paginate @applications
= link_to t('doorkeeper.applications.index.new'), new_settings_application_path, class: 'button' = link_to t('doorkeeper.applications.index.new'), new_settings_application_path, class: 'button'

View file

@ -3,22 +3,23 @@
%p.hint= t('applications.warning') %p.hint= t('applications.warning')
%table.table .table-wrapper
%tbody %table.table
%tr %tbody
%th= t('doorkeeper.applications.show.application_id') %tr
%td %th= t('doorkeeper.applications.show.application_id')
%code= @application.uid %td
%tr %code= @application.uid
%th= t('doorkeeper.applications.show.secret') %tr
%td %th= t('doorkeeper.applications.show.secret')
%code= @application.secret %td
%tr %code= @application.secret
%th{ rowspan: 2}= t('applications.your_token') %tr
%td %th{ rowspan: 2}= t('applications.your_token')
%code= current_user.token_for_app(@application).token %td
%tr %code= current_user.token_for_app(@application).token
%td= table_link_to 'refresh', t('applications.regenerate_token'), regenerate_settings_application_path(@application), method: :post %tr
%td= table_link_to 'refresh', t('applications.regenerate_token'), regenerate_settings_application_path(@application), method: :post
%hr/ %hr/

View file

@ -1,21 +1,22 @@
- content_for :page_title do - content_for :page_title do
= t('settings.export') = t('settings.export')
%table.table .table-wrapper
%tbody %table.table
%tr %tbody
%th= t('exports.storage') %tr
%td= number_to_human_size @export.total_storage %th= t('exports.storage')
%td %td= number_to_human_size @export.total_storage
%tr %td
%th= t('exports.follows') %tr
%td= @export.total_follows %th= t('exports.follows')
%td= table_link_to 'download', t('exports.csv'), settings_exports_follows_path(format: :csv) %td= @export.total_follows
%tr %td= table_link_to 'download', t('exports.csv'), settings_exports_follows_path(format: :csv)
%th= t('exports.blocks') %tr
%td= @export.total_blocks %th= t('exports.blocks')
%td= table_link_to 'download', t('exports.csv'), settings_exports_blocks_path(format: :csv) %td= @export.total_blocks
%tr %td= table_link_to 'download', t('exports.csv'), settings_exports_blocks_path(format: :csv)
%th= t('exports.mutes') %tr
%td= @export.total_mutes %th= t('exports.mutes')
%td= table_link_to 'download', t('exports.csv'), settings_exports_mutes_path(format: :csv) %td= @export.total_mutes
%td= table_link_to 'download', t('exports.csv'), settings_exports_mutes_path(format: :csv)

View file

@ -12,20 +12,21 @@
%p= t('followers.explanation_html') %p= t('followers.explanation_html')
%p= t('followers.true_privacy_html') %p= t('followers.true_privacy_html')
%table.table .table-wrapper
%thead %table.table
%tr %thead
%th
%th= t('followers.domain')
%th= t('followers.followers_count')
%tbody
- @domains.each do |domain|
%tr %tr
%td %th
= check_box_tag 'select[]', domain.domain, false, disabled: !@account.locked? unless domain.domain.nil? %th= t('followers.domain')
%td %th= t('followers.followers_count')
%samp= domain.domain.presence || Rails.configuration.x.local_domain %tbody
%td= number_with_delimiter domain.accounts_from_domain - @domains.each do |domain|
%tr
%td
= check_box_tag 'select[]', domain.domain, false, disabled: !@account.locked? unless domain.domain.nil?
%td
%samp= domain.domain.presence || Rails.configuration.x.local_domain
%td= number_with_delimiter domain.accounts_from_domain
.action-pagination .action-pagination
.actions .actions