From 139f7646a7e3af491d5d6c6a99e82d46f9551400 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin Date: Fri, 10 Jan 2020 07:10:17 +0700 Subject: Rename page_heading_actions variable (#12799) Current name - page_heading_actions is long and hard to remember, this commit shortens it to just heading_actions, which is way more easier to remember and write, it's logical too. --- app/views/admin/reports/show.html.haml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views/admin') diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index 7f3ec35a4..af8fce2a7 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -4,7 +4,7 @@ - content_for :page_title do = t('admin.reports.report', id: @report.id) -- content_for :page_heading_actions do +- content_for :heading_actions do - if @report.unresolved? = link_to t('admin.reports.mark_as_resolved'), resolve_admin_report_path(@report), method: :post, class: 'button' - else -- cgit From 36426ed4ad450320f4a4e598c41355a6d8faad66 Mon Sep 17 00:00:00 2001 From: Sasha Sorokin Date: Sat, 11 Jan 2020 08:14:45 +0700 Subject: Use heading actions and placeholders in settings (#12801) This commit: - Refactors centered text blocks currently used for placeholders for empty tables and puts styles for it in separate class - .centered-text, simply aliasing text-align: center. Which is furtherly used in this commit. - Improves applications settings page to use heading actions, moving "New application" button there, and displaying placeholder "You have no applications" in place of empty table. - Improves custom emoji settings page to use heading action for "Upload" button, making it more easily accessible without need to scroll through all of the emojis. - Improves email domain blocks settings page, moving "Add new" to the heading actions and using placeholder "No e-mail domains currently blacklisted" instead of showing empty table. --- app/javascript/styles/mastodon/admin.scss | 4 +++ app/views/admin/custom_emojis/index.html.haml | 6 ++-- .../admin/email_domain_blocks/index.html.haml | 23 +++++++++------ app/views/filters/index.html.haml | 3 +- app/views/settings/applications/index.html.haml | 33 +++++++++++++--------- config/locales/doorkeeper.en.yml | 1 + config/locales/en.yml | 1 + 7 files changed, 43 insertions(+), 28 deletions(-) (limited to 'app/views/admin') diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 203365f5e..9bd030964 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -878,3 +878,7 @@ a.name-tag, color: $primary-text-color; } } + +.center-text { + text-align: center; +} diff --git a/app/views/admin/custom_emojis/index.html.haml b/app/views/admin/custom_emojis/index.html.haml index 7320ce1bb..389e9dd71 100644 --- a/app/views/admin/custom_emojis/index.html.haml +++ b/app/views/admin/custom_emojis/index.html.haml @@ -4,6 +4,9 @@ - content_for :header_tags do = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous' +- content_for :heading_actions do + = link_to t('admin.custom_emojis.upload'), new_admin_custom_emoji_path, class: 'button' + .filters .filter-subset %strong= t('admin.accounts.location.title') @@ -81,6 +84,3 @@ = paginate @custom_emojis -%hr.spacer/ - -= link_to t('admin.custom_emojis.upload'), new_admin_custom_emoji_path, class: 'button' diff --git a/app/views/admin/email_domain_blocks/index.html.haml b/app/views/admin/email_domain_blocks/index.html.haml index 7bb204e52..c1cc470b6 100644 --- a/app/views/admin/email_domain_blocks/index.html.haml +++ b/app/views/admin/email_domain_blocks/index.html.haml @@ -1,14 +1,19 @@ - content_for :page_title do = t('admin.email_domain_blocks.title') -.table-wrapper - %table.table - %thead - %tr - %th= t('admin.email_domain_blocks.domain') - %th - %tbody - = render @email_domain_blocks +- content_for :heading_actions do + = link_to t('admin.email_domain_blocks.add_new'), new_admin_email_domain_block_path, class: 'button' + +- if @email_domain_blocks.count == 0 + %div.muted-hint.center-text=t 'admin.email_domain_blocks.empty' +- else + .table-wrapper + %table.table + %thead + %tr + %th= t('admin.email_domain_blocks.domain') + %th + %tbody + = render @email_domain_blocks = paginate @email_domain_blocks -= link_to t('admin.email_domain_blocks.add_new'), new_admin_email_domain_block_path, class: 'button' diff --git a/app/views/filters/index.html.haml b/app/views/filters/index.html.haml index 2f7d96f96..8ace638ca 100644 --- a/app/views/filters/index.html.haml +++ b/app/views/filters/index.html.haml @@ -5,8 +5,7 @@ = link_to t('filters.new.title'), new_filter_path, class: 'button' - if @filters.count == 0 - %div{ style: 'display: flex; justify-content: center' } - %div.muted-hint= t 'filters.index.empty' + %div.muted-hint.center-text= t 'filters.index.empty' - else .table-wrapper %table.table diff --git a/app/views/settings/applications/index.html.haml b/app/views/settings/applications/index.html.haml index 919472c2e..1cb94760f 100644 --- a/app/views/settings/applications/index.html.haml +++ b/app/views/settings/applications/index.html.haml @@ -1,20 +1,25 @@ - content_for :page_title do = t('doorkeeper.applications.index.title') -.table-wrapper - %table.table - %thead - %tr - %th= t('doorkeeper.applications.index.application') - %th= t('doorkeeper.applications.index.scopes') - %th - %tbody - - @applications.each do |application| +- content_for :heading_actions do + = link_to t('doorkeeper.applications.index.new'), new_settings_application_path, class: 'button' + +- if @applications.count == 0 + %div.muted-hint.center-text=t 'doorkeeper.applications.index.empty' +- else + .table-wrapper + %table.table + %thead %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') } + %th= t('doorkeeper.applications.index.application') + %th= t('doorkeeper.applications.index.scopes') + %th + %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 -= link_to t('doorkeeper.applications.index.new'), new_settings_application_path, class: 'button' diff --git a/config/locales/doorkeeper.en.yml b/config/locales/doorkeeper.en.yml index 4e9c83a8f..2be2ef036 100644 --- a/config/locales/doorkeeper.en.yml +++ b/config/locales/doorkeeper.en.yml @@ -38,6 +38,7 @@ en: application: Application callback_url: Callback URL delete: Delete + empty: You have no applications. name: Name new: New application scopes: Scopes diff --git a/config/locales/en.yml b/config/locales/en.yml index 6b52f4cad..660d0a4e1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -339,6 +339,7 @@ en: delete: Delete destroyed_msg: Successfully deleted e-mail domain from blacklist domain: Domain + empty: No e-mail domains currenly blacklisted. new: create: Add domain title: New e-mail blacklist entry -- cgit