From 9720a83867981e06ae2d28cd74227448b794bc2c Mon Sep 17 00:00:00 2001 From: noellabo Date: Sat, 14 Nov 2020 10:05:24 +0900 Subject: [PATCH] Add avatar images and paging to subscribe settings --- .../settings/account_subscribes_controller.rb | 2 +- .../settings/domain_subscribes_controller.rb | 2 +- .../settings/follow_tags_controller.rb | 2 +- .../settings/keyword_subscribes_controller.rb | 2 +- app/javascript/styles/mastodon/tables.scss | 5 ++ app/javascript/styles/mastodon/widgets.scss | 6 +- .../_account_subscribe.html.haml | 16 ++++ .../account_subscribes/index.html.haml | 42 ++++------- .../_domain_subscribe.html.haml | 16 ++++ .../domain_subscribes/index.html.haml | 41 ++++------ .../follow_tags/_follow_tag.html.haml | 14 ++++ .../settings/follow_tags/index.html.haml | 37 ++++------ .../_keyword_subscribe.html.haml | 41 ++++++++++ .../keyword_subscribes/index.html.haml | 74 +++++-------------- 14 files changed, 158 insertions(+), 142 deletions(-) create mode 100644 app/views/settings/account_subscribes/_account_subscribe.html.haml create mode 100644 app/views/settings/domain_subscribes/_domain_subscribe.html.haml create mode 100644 app/views/settings/follow_tags/_follow_tag.html.haml create mode 100644 app/views/settings/keyword_subscribes/_keyword_subscribe.html.haml diff --git a/app/controllers/settings/account_subscribes_controller.rb b/app/controllers/settings/account_subscribes_controller.rb index f5212af1a..594cd4a0d 100644 --- a/app/controllers/settings/account_subscribes_controller.rb +++ b/app/controllers/settings/account_subscribes_controller.rb @@ -50,7 +50,7 @@ class Settings::AccountSubscribesController < Settings::BaseController end def set_account_subscribings - @account_subscribings = current_account.active_subscribes.order('list_id NULLS FIRST', :updated_at).reject(&:new_record?) + @account_subscribings = current_account.active_subscribes.eager_load(:target_account).order('list_id NULLS FIRST', :updated_at).page(params[:page]).per(40) end def set_lists diff --git a/app/controllers/settings/domain_subscribes_controller.rb b/app/controllers/settings/domain_subscribes_controller.rb index 42fcbc6e4..95c459323 100644 --- a/app/controllers/settings/domain_subscribes_controller.rb +++ b/app/controllers/settings/domain_subscribes_controller.rb @@ -49,7 +49,7 @@ class Settings::DomainSubscribesController < Settings::BaseController end def set_domain_subscribes - @domain_subscribes = current_account.domain_subscribes.includes(:list).order('list_id NULLS FIRST', :domain).reject(&:new_record?) + @domain_subscribes = current_account.domain_subscribes.includes(:list).order('list_id NULLS FIRST', :domain).page(params[:page]).per(40) end def set_lists diff --git a/app/controllers/settings/follow_tags_controller.rb b/app/controllers/settings/follow_tags_controller.rb index dc49f62fd..99aa057e9 100644 --- a/app/controllers/settings/follow_tags_controller.rb +++ b/app/controllers/settings/follow_tags_controller.rb @@ -50,7 +50,7 @@ class Settings::FollowTagsController < Settings::BaseController end def set_follow_tags - @follow_tags = current_account.follow_tags.order('list_id NULLS FIRST', :updated_at).reject(&:new_record?) + @follow_tags = current_account.follow_tags.order('list_id NULLS FIRST', :updated_at).page(params[:page]).per(40) end def set_lists diff --git a/app/controllers/settings/keyword_subscribes_controller.rb b/app/controllers/settings/keyword_subscribes_controller.rb index fd38581d9..466861f6b 100644 --- a/app/controllers/settings/keyword_subscribes_controller.rb +++ b/app/controllers/settings/keyword_subscribes_controller.rb @@ -50,7 +50,7 @@ class Settings::KeywordSubscribesController < ApplicationController end def set_keyword_subscribes - @keyword_subscribes = current_account.keyword_subscribes.includes(:list).order('list_id NULLS FIRST', :name).reject(&:new_record?) + @keyword_subscribes = current_account.keyword_subscribes.includes(:list).order('list_id NULLS FIRST', :name).page(params[:page]).per(40) end def set_lists diff --git a/app/javascript/styles/mastodon/tables.scss b/app/javascript/styles/mastodon/tables.scss index eb070e0d8..1016d3d61 100644 --- a/app/javascript/styles/mastodon/tables.scss +++ b/app/javascript/styles/mastodon/tables.scss @@ -54,6 +54,11 @@ white-space: nowrap; } + th.symbol, + td.symbol { + text-align: center; + } + &.inline-table { & > tbody > tr:nth-child(odd) { & > td, diff --git a/app/javascript/styles/mastodon/widgets.scss b/app/javascript/styles/mastodon/widgets.scss index 4e03868a6..c7f719467 100644 --- a/app/javascript/styles/mastodon/widgets.scss +++ b/app/javascript/styles/mastodon/widgets.scss @@ -407,15 +407,11 @@ } thead th { - text-align: center; + text-align: left; text-transform: uppercase; color: $darker-text-color; font-weight: 700; padding: 10px; - - &:first-child { - text-align: left; - } } tbody td { diff --git a/app/views/settings/account_subscribes/_account_subscribe.html.haml b/app/views/settings/account_subscribes/_account_subscribe.html.haml new file mode 100644 index 000000000..a400b24b7 --- /dev/null +++ b/app/views/settings/account_subscribes/_account_subscribe.html.haml @@ -0,0 +1,16 @@ +%tr + %td + = account_link_to account_subscribe.target_account + %td.nowrap.symbol + - if account_subscribe.show_reblogs + = fa_icon('check') + %td.nowrap + - if account_subscribe.list_id + = fa_icon 'list-ul' + = account_subscribe.list&.title + - else + = fa_icon 'home' + = t 'lists.home' + %td.nowrap + = table_link_to 'pencil', t('account_subscribes.edit.title'), edit_settings_account_subscribe_path(account_subscribe) + = table_link_to 'trash', t('filters.index.delete'), settings_account_subscribe_path(account_subscribe), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/settings/account_subscribes/index.html.haml b/app/views/settings/account_subscribes/index.html.haml index e3bf6af8f..573da4a63 100644 --- a/app/views/settings/account_subscribes/index.html.haml +++ b/app/views/settings/account_subscribes/index.html.haml @@ -3,34 +3,22 @@ %p= t('account_subscribes.hint_html') += link_to t('account_subscribes.new.title'), new_settings_account_subscribe_path, class: 'button' + %hr.spacer/ -.table-wrapper - %table.table - %thead - %tr - %th= t('simple_form.labels.form_account_subscribe.acct') - %th.nowrap= t('simple_form.labels.form_account_subscribe.reblog') - %th.nowrap= t('simple_form.labels.form_account_subscribe.timeline') - %th.nowrap - %tbody - - @account_subscribings.each do |account_subscribe| +- if @account_subscribings.empty? + = nothing_here 'nothing-here--under-tabs' +- else + .table-wrapper + %table.table.accounts-table + %thead %tr - %td - = fa_icon 'user' - = account_subscribe.target_account.acct - %td.nowrap - - if account_subscribe.show_reblogs - = fa_icon('check') - %td.nowrap - - if account_subscribe.list_id - = fa_icon 'list-ul' - = account_subscribe.list&.title - - else - = fa_icon 'home' - = t 'lists.home' - %td.nowrap - = table_link_to 'pencil', t('account_subscribes.edit.title'), edit_settings_account_subscribe_path(account_subscribe) - = table_link_to 'trash', t('filters.index.delete'), settings_account_subscribe_path(account_subscribe), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + %th= t('simple_form.labels.form_account_subscribe.acct') + %th.nowrap.symbol= t('simple_form.labels.form_account_subscribe.reblog') + %th.nowrap= t('simple_form.labels.form_account_subscribe.timeline') + %th.nowrap + %tbody + = render partial: 'account_subscribe', collection: @account_subscribings -= link_to t('account_subscribes.new.title'), new_settings_account_subscribe_path, class: 'button' += paginate @account_subscribings diff --git a/app/views/settings/domain_subscribes/_domain_subscribe.html.haml b/app/views/settings/domain_subscribes/_domain_subscribe.html.haml new file mode 100644 index 000000000..10a786c50 --- /dev/null +++ b/app/views/settings/domain_subscribes/_domain_subscribe.html.haml @@ -0,0 +1,16 @@ +%tr + %td + = domain_subscribe.domain + %td.nowrap.symbol + - if domain_subscribe.exclude_reblog + = fa_icon('times') + %td.nowrap + - if domain_subscribe.list_id + = fa_icon 'list-ul' + = domain_subscribe.list&.title + - else + = fa_icon 'home' + = t 'lists.home' + %td.nowrap + = table_link_to 'pencil', t('domain_subscribes.edit.title'), edit_settings_domain_subscribe_path(domain_subscribe) + = table_link_to 'trash', t('filters.index.delete'), settings_domain_subscribe_path(domain_subscribe), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/settings/domain_subscribes/index.html.haml b/app/views/settings/domain_subscribes/index.html.haml index 762cf89d6..5080ce9ca 100644 --- a/app/views/settings/domain_subscribes/index.html.haml +++ b/app/views/settings/domain_subscribes/index.html.haml @@ -3,33 +3,22 @@ %p= t('domain_subscribes.hint_html') += link_to t('domain_subscribes.new.title'), new_settings_domain_subscribe_path, class: 'button' + %hr.spacer/ -.table-wrapper - %table.table - %thead - %tr - %th= t('simple_form.labels.domain_subscribe.domain') - %th.nowrap= t('simple_form.labels.domain_subscribe.reblog') - %th.nowrap= t('simple_form.labels.domain_subscribe.timeline') - %th.nowrap - %tbody - - @domain_subscribes.each do |domain_subscribe| +- if @domain_subscribes.empty? + = nothing_here 'nothing-here--under-tabs' +- else + .table-wrapper + %table.table + %thead %tr - %td - = domain_subscribe.domain - %td.nowrap - - if domain_subscribe.exclude_reblog - = fa_icon('times') - %td.nowrap - - if domain_subscribe.list_id - = fa_icon 'list-ul' - = domain_subscribe.list&.title - - else - = fa_icon 'home' - = t 'lists.home' - %td.nowrap - = table_link_to 'pencil', t('domain_subscribes.edit.title'), edit_settings_domain_subscribe_path(domain_subscribe) - = table_link_to 'trash', t('filters.index.delete'), settings_domain_subscribe_path(domain_subscribe), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } + %th= t('simple_form.labels.domain_subscribe.domain') + %th.nowrap.symbol= t('simple_form.labels.domain_subscribe.reblog') + %th.nowrap= t('simple_form.labels.domain_subscribe.timeline') + %th.nowrap + %tbody + = render partial: 'domain_subscribe', collection: @domain_subscribes -= link_to t('domain_subscribes.new.title'), new_settings_domain_subscribe_path, class: 'button' += paginate @domain_subscribes diff --git a/app/views/settings/follow_tags/_follow_tag.html.haml b/app/views/settings/follow_tags/_follow_tag.html.haml new file mode 100644 index 000000000..9750247ef --- /dev/null +++ b/app/views/settings/follow_tags/_follow_tag.html.haml @@ -0,0 +1,14 @@ +%tr + %td + = fa_icon 'hashtag' + = follow_tag.name + %td.nowrap + - if follow_tag.list_id + = fa_icon 'list-ul' + = follow_tag.list&.title + - else + = fa_icon 'home' + = t 'lists.home' + %td.nowrap + = table_link_to 'pencil', t('follow_tags.edit.title'), edit_settings_follow_tag_path(follow_tag) + = table_link_to 'trash', t('filters.index.delete'), settings_follow_tag_path(follow_tag), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } diff --git a/app/views/settings/follow_tags/index.html.haml b/app/views/settings/follow_tags/index.html.haml index c26bc7e37..f54707275 100644 --- a/app/views/settings/follow_tags/index.html.haml +++ b/app/views/settings/follow_tags/index.html.haml @@ -3,30 +3,19 @@ %p= t('follow_tags.hint_html') += link_to t('follow_tags.new.title'), new_settings_follow_tag_path, class: 'button' + %hr.spacer/ -.table-wrapper - %table.table - %thead - %tr - %th= t('simple_form.labels.follow_tag.name') - %th.nowrap= t('simple_form.labels.follow_tag.timeline') - %th.nowrap - %tbody - - @follow_tags.each do |follow_tag| +- if @follow_tags.empty? + = nothing_here 'nothing-here--under-tabs' +- else + .table-wrapper + %table.table + %thead %tr - %td - = fa_icon 'hashtag' - = follow_tag.name - %td.nowrap - - if follow_tag.list_id - = fa_icon 'list-ul' - = follow_tag.list&.title - - else - = fa_icon 'home' - = t 'lists.home' - %td.nowrap - = table_link_to 'pencil', t('follow_tags.edit.title'), edit_settings_follow_tag_path(follow_tag) - = table_link_to 'trash', t('filters.index.delete'), settings_follow_tag_path(follow_tag), method: :delete, data: { confirm: t('admin.accounts.are_you_sure') } - -= link_to t('follow_tags.new.title'), new_settings_follow_tag_path, class: 'button' + %th= t('simple_form.labels.follow_tag.name') + %th.nowrap= t('simple_form.labels.follow_tag.timeline') + %th.nowrap + %tbody + = render partial: 'follow_tag', collection: @follow_tags diff --git a/app/views/settings/keyword_subscribes/_keyword_subscribe.html.haml b/app/views/settings/keyword_subscribes/_keyword_subscribe.html.haml new file mode 100644 index 000000000..e3d89471b --- /dev/null +++ b/app/views/settings/keyword_subscribes/_keyword_subscribe.html.haml @@ -0,0 +1,41 @@ +%tr + %td.nowrap= keyword_subscribe.name + %td.nowrap + - if keyword_subscribe.regexp + = t 'keyword_subscribes.regexp.enabled' + - else + = t 'keyword_subscribes.regexp.disabled' + %td + .include-keyword + = keyword_subscribe.keyword + .exclude-keyword + = keyword_subscribe.exclude_keyword + %td.nowrap + - if keyword_subscribe.ignorecase + = t 'keyword_subscribes.ignorecase.enabled' + - else + = t 'keyword_subscribes.ignorecase.disabled' + %td.nowrap + - if keyword_subscribe.ignore_block + = t 'keyword_subscribes.ignore_block' + %td.nowrap + - if keyword_subscribe.list_id + = fa_icon 'list-ul' + = keyword_subscribe.list&.title + - else + = fa_icon 'home' + = t 'keyword_subscribe.home' + %td.nowrap + - if !keyword_subscribe.disabled + %span.positive-hint + = fa_icon('check') + = ' ' + = t 'keyword_subscribes.enabled' + - else + %span.negative-hint + = fa_icon('times') + = ' ' + = t 'keyword_subscribes.disabled' + %td.nowrap + = table_link_to 'pencil', t('keyword_subscribes.edit.title'), edit_settings_keyword_subscribe_path(keyword_subscribe) + = table_link_to 'times', t('keyword_subscribes.index.delete'), settings_keyword_subscribe_path(keyword_subscribe), method: :delete diff --git a/app/views/settings/keyword_subscribes/index.html.haml b/app/views/settings/keyword_subscribes/index.html.haml index 750a816a4..ec1b42123 100644 --- a/app/views/settings/keyword_subscribes/index.html.haml +++ b/app/views/settings/keyword_subscribes/index.html.haml @@ -3,64 +3,26 @@ %p= t('keyword_subscribes.hint_html') += link_to t('keyword_subscribes.new.title'), new_settings_keyword_subscribe_path, class: 'button' + %hr.spacer/ = render 'shared/error_messages', object: @keyword_subscribe -.table-wrapper - %table.table - %thead - %tr - %th.nowrap= t('simple_form.labels.keyword_subscribes.name') - %th.nowrap= t('simple_form.labels.keyword_subscribes.regexp') - %th= t('simple_form.labels.keyword_subscribes.keyword') - %th.nowrap= t('simple_form.labels.keyword_subscribes.ignorecase') - %th.nowrap= t('simple_form.labels.keyword_subscribes.ignore_block') - %th.nowrap= t('simple_form.labels.keyword_subscribes.timeline') - %th.nowrap= t('simple_form.labels.keyword_subscribes.disabled') - %th.nowrap - %tbody - - @keyword_subscribes.each do |keyword_subscribe| +- if @keyword_subscribes.empty? + = nothing_here 'nothing-here--under-tabs' +- else + .table-wrapper + %table.table + %thead %tr - %td.nowrap= keyword_subscribe.name - %td.nowrap - - if keyword_subscribe.regexp - = t 'keyword_subscribes.regexp.enabled' - - else - = t 'keyword_subscribes.regexp.disabled' - %td - .include-keyword - = keyword_subscribe.keyword - .exclude-keyword - = keyword_subscribe.exclude_keyword - %td.nowrap - - if keyword_subscribe.ignorecase - = t 'keyword_subscribes.ignorecase.enabled' - - else - = t 'keyword_subscribes.ignorecase.disabled' - %td.nowrap - - if keyword_subscribe.ignore_block - = t 'keyword_subscribes.ignore_block' - %td.nowrap - - if keyword_subscribe.list_id - = fa_icon 'list-ul' - = keyword_subscribe.list&.title - - else - = fa_icon 'home' - = t 'keyword_subscribe.home' - %td.nowrap - - if !keyword_subscribe.disabled - %span.positive-hint - = fa_icon('check') - = ' ' - = t 'keyword_subscribes.enabled' - - else - %span.negative-hint - = fa_icon('times') - = ' ' - = t 'keyword_subscribes.disabled' - %td.nowrap - = table_link_to 'pencil', t('keyword_subscribes.edit.title'), edit_settings_keyword_subscribe_path(keyword_subscribe) - = table_link_to 'times', t('keyword_subscribes.index.delete'), settings_keyword_subscribe_path(keyword_subscribe), method: :delete - -= link_to t('keyword_subscribes.new.title'), new_settings_keyword_subscribe_path, class: 'button' + %th.nowrap= t('simple_form.labels.keyword_subscribes.name') + %th.nowrap= t('simple_form.labels.keyword_subscribes.regexp') + %th= t('simple_form.labels.keyword_subscribes.keyword') + %th.nowrap= t('simple_form.labels.keyword_subscribes.ignorecase') + %th.nowrap= t('simple_form.labels.keyword_subscribes.ignore_block') + %th.nowrap= t('simple_form.labels.keyword_subscribes.timeline') + %th.nowrap= t('simple_form.labels.keyword_subscribes.disabled') + %th.nowrap + %tbody + = render partial: 'keyword_subscribe', collection: @keyword_subscribes