闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
4.3 KiB

  1. - content_for :page_title do
  2. = t('admin.custom_emojis.title')
  3. - content_for :header_tags do
  4. = javascript_pack_tag 'admin', integrity: true, async: true, crossorigin: 'anonymous'
  5. - content_for :heading_actions do
  6. = link_to t('admin.custom_emojis.upload'), new_admin_custom_emoji_path, class: 'button'
  7. .filters
  8. .filter-subset
  9. %strong= t('admin.accounts.location.title')
  10. %ul
  11. %li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil
  12. %li
  13. - if selected? local: '1', remote: nil
  14. = filter_link_to t('admin.accounts.location.local'), {local: nil, remote: nil}, {local: '1', remote: nil}
  15. - else
  16. = filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil
  17. %li
  18. - if selected? remote: '1', local: nil
  19. = filter_link_to t('admin.accounts.location.remote'), {remote: nil, local: nil}, {remote: '1', local: nil}
  20. - else
  21. = filter_link_to t('admin.accounts.location.remote'), remote: '1', local: nil
  22. = form_tag admin_custom_emojis_url, method: 'GET', class: 'simple_form' do
  23. .fields-group
  24. - CustomEmojiFilter::KEYS.each do |key|
  25. = hidden_field_tag key, params[key] if params[key].present?
  26. - %i(shortcode by_domain).each do |key|
  27. .input.string.optional
  28. = text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.custom_emojis.#{key}")
  29. .actions
  30. %button= t('admin.accounts.search')
  31. = link_to t('admin.accounts.reset'), admin_custom_emojis_path, class: 'button negative'
  32. = form_for(@form, url: batch_admin_custom_emojis_path) do |f|
  33. = hidden_field_tag :page, params[:page] || 1
  34. - CustomEmojiFilter::KEYS.each do |key|
  35. = hidden_field_tag key, params[key] if params[key].present?
  36. .batch-table
  37. .batch-table__toolbar
  38. %label.batch-table__toolbar__select.batch-checkbox-all
  39. = check_box_tag :batch_checkbox_all, nil, false
  40. .batch-table__toolbar__actions
  41. - if params[:local] == '1'
  42. = f.button safe_join([fa_icon('save'), t('generic.save_changes')]), name: :update, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  43. = f.button safe_join([fa_icon('eye'), t('admin.custom_emojis.list')]), name: :list, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  44. = f.button safe_join([fa_icon('eye-slash'), t('admin.custom_emojis.unlist')]), name: :unlist, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  45. = f.button safe_join([fa_icon('power-off'), t('admin.custom_emojis.enable')]), name: :enable, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  46. = f.button safe_join([fa_icon('power-off'), t('admin.custom_emojis.disable')]), name: :disable, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  47. = f.button safe_join([fa_icon('times'), t('admin.custom_emojis.delete')]), name: :delete, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  48. - unless params[:local] == '1'
  49. = f.button safe_join([fa_icon('copy'), t('admin.custom_emojis.copy')]), name: :copy, class: 'table-action-link', type: :submit, data: { confirm: t('admin.reports.are_you_sure') }
  50. - if params[:local] == '1'
  51. .batch-table__form.simple_form
  52. .fields-row
  53. .fields-group.fields-row__column.fields-row__column-6
  54. .input.select.optional
  55. .label_input
  56. = f.select :category_id, options_from_collection_for_select(CustomEmojiCategory.all, 'id', 'name'), prompt: t('admin.custom_emojis.assign_category'), class: 'select optional', 'aria-label': t('admin.custom_emojis.assign_category')
  57. .fields-group.fields-row__column.fields-row__column-6
  58. .input.string.optional
  59. .label_input
  60. = f.text_field :category_name, class: 'string optional', placeholder: t('admin.custom_emojis.create_new_category'), 'aria-label': t('admin.custom_emojis.create_new_category')
  61. .batch-table__body
  62. - if @custom_emojis.empty?
  63. = nothing_here 'nothing-here--under-tabs'
  64. - else
  65. = render partial: 'custom_emoji', collection: @custom_emojis, locals: { f: f }
  66. = paginate @custom_emojis