Add avatar images and paging to subscribe settings

This commit is contained in:
noellabo 2020-11-14 10:05:24 +09:00
parent fe355a6468
commit 9720a83867
14 changed files with 158 additions and 142 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -54,6 +54,11 @@
white-space: nowrap;
}
th.symbol,
td.symbol {
text-align: center;
}
&.inline-table {
& > tbody > tr:nth-child(odd) {
& > td,

View file

@ -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 {

View file

@ -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') }

View file

@ -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
- if @account_subscribings.empty?
= nothing_here 'nothing-here--under-tabs'
- else
.table-wrapper
%table.table.accounts-table
%thead
%tr
%th= t('simple_form.labels.form_account_subscribe.acct')
%th.nowrap= t('simple_form.labels.form_account_subscribe.reblog')
%th.nowrap.symbol= 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|
%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') }
= render partial: 'account_subscribe', collection: @account_subscribings
= link_to t('account_subscribes.new.title'), new_settings_account_subscribe_path, class: 'button'
= paginate @account_subscribings

View file

@ -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') }

View file

@ -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
- if @domain_subscribes.empty?
= nothing_here 'nothing-here--under-tabs'
- else
.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.symbol= 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|
%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') }
= render partial: 'domain_subscribe', collection: @domain_subscribes
= link_to t('domain_subscribes.new.title'), new_settings_domain_subscribe_path, class: 'button'
= paginate @domain_subscribes

View file

@ -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') }

View file

@ -3,9 +3,14 @@
%p= t('follow_tags.hint_html')
= link_to t('follow_tags.new.title'), new_settings_follow_tag_path, class: 'button'
%hr.spacer/
.table-wrapper
- if @follow_tags.empty?
= nothing_here 'nothing-here--under-tabs'
- else
.table-wrapper
%table.table
%thead
%tr
@ -13,20 +18,4 @@
%th.nowrap= t('simple_form.labels.follow_tag.timeline')
%th.nowrap
%tbody
- @follow_tags.each do |follow_tag|
%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'
= render partial: 'follow_tag', collection: @follow_tags

View file

@ -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

View file

@ -3,11 +3,16 @@
%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
- if @keyword_subscribes.empty?
= nothing_here 'nothing-here--under-tabs'
- else
.table-wrapper
%table.table
%thead
%tr
@ -20,47 +25,4 @@
%th.nowrap= t('simple_form.labels.keyword_subscribes.disabled')
%th.nowrap
%tbody
- @keyword_subscribes.each do |keyword_subscribe|
%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'
= render partial: 'keyword_subscribe', collection: @keyword_subscribes