index.html.haml 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. - content_for :page_title do
  2. = t('admin.accounts.title')
  3. - content_for :header_tags do
  4. = javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
  5. = form_tag admin_accounts_url, method: 'GET', class: 'simple_form' do
  6. .filters
  7. .filter-subset.filter-subset--with-select
  8. %strong= t('admin.accounts.location.title')
  9. .input.select.optional
  10. = select_tag :origin, options_for_select([[t('admin.accounts.location.local'), 'local'], [t('admin.accounts.location.remote'), 'remote']], params[:origin]), prompt: I18n.t('generic.all')
  11. .filter-subset.filter-subset--with-select
  12. %strong= t('admin.accounts.moderation.title')
  13. .input.select.optional
  14. = select_tag :status, options_for_select([[t('admin.accounts.moderation.active'), 'active'], [t('admin.accounts.moderation.silenced'), 'silenced'], [t('admin.accounts.moderation.disabled'), 'disabled'], [t('admin.accounts.moderation.suspended'), 'suspended'], [safe_join([t('admin.accounts.moderation.pending'), "(#{number_with_delimiter(User.pending.count)})"], ' '), 'pending']], params[:status]), prompt: I18n.t('generic.all')
  15. .filter-subset.filter-subset--with-select
  16. %strong= t('admin.accounts.role')
  17. .input.select.optional
  18. = select_tag :role_ids, options_from_collection_for_select(UserRole.assignable, :id, :name, params[:role_ids]), prompt: I18n.t('admin.accounts.moderation.all')
  19. .filter-subset.filter-subset--with-select
  20. %strong= t 'generic.order_by'
  21. .input.select
  22. = select_tag :order, options_for_select([[t('relationships.most_recent'), 'recent'], [t('relationships.last_active'), 'active']], params[:order])
  23. .fields-group
  24. - %i(username by_domain display_name email ip).each do |key|
  25. - unless key == :by_domain && params[:origin] != 'remote'
  26. .input.string.optional
  27. = text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.accounts.#{key}")
  28. .actions
  29. %button.button= t('admin.accounts.search')
  30. = link_to t('admin.accounts.reset'), admin_accounts_path, class: 'button negative'
  31. %hr.spacer/
  32. = form_for(@form, url: batch_admin_accounts_path) do |f|
  33. = hidden_field_tag :page, params[:page] || 1
  34. = hidden_field_tag :select_all_matching, '0'
  35. - AccountFilter::KEYS.each do |key|
  36. = hidden_field_tag key, params[key] if params[key].present?
  37. .batch-table
  38. .batch-table__toolbar
  39. %label.batch-table__toolbar__select.batch-checkbox-all
  40. = check_box_tag :batch_checkbox_all, nil, false
  41. .batch-table__toolbar__actions
  42. - if @accounts.any? { |account| account.user_pending? }
  43. = f.button safe_join([fa_icon('check'), t('admin.accounts.approve')]), name: :approve, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  44. = f.button safe_join([fa_icon('times'), t('admin.accounts.reject')]), name: :reject, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  45. = f.button safe_join([fa_icon('lock'), t('admin.accounts.perform_full_suspension')]), name: :suspend, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  46. - if @accounts.total_count > @accounts.size
  47. .batch-table__select-all
  48. .not-selected.active
  49. %span= t('generic.all_items_on_page_selected_html', count: @accounts.size)
  50. %button{ type: 'button' }= t('generic.select_all_matching_items', count: @accounts.total_count)
  51. .selected
  52. %span= t('generic.all_matching_items_selected_html', count: @accounts.total_count)
  53. %button{ type: 'button' }= t('generic.deselect')
  54. .batch-table__body
  55. - if @accounts.empty?
  56. = nothing_here 'nothing-here--under-tabs'
  57. - else
  58. = render partial: 'account', collection: @accounts, locals: { f: f }
  59. = paginate @accounts