1
0

index.html.haml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. - content_for :page_title do
  2. = t('admin.custom_emojis.title')
  3. - if can?(:create, :custom_emoji)
  4. - content_for :heading_actions do
  5. = link_to t('admin.custom_emojis.upload'), new_admin_custom_emoji_path, class: 'button'
  6. .filters
  7. .filter-subset
  8. %strong= t('admin.accounts.location.title')
  9. %ul
  10. %li= filter_link_to t('admin.accounts.location.all'), local: nil, remote: nil
  11. %li
  12. - if selected? local: '1', remote: nil
  13. = filter_link_to t('admin.accounts.location.local'), { local: nil, remote: nil }, { local: '1', remote: nil }
  14. - else
  15. = filter_link_to t('admin.accounts.location.local'), local: '1', remote: nil
  16. %li
  17. - if selected? remote: '1', local: nil
  18. = filter_link_to t('admin.accounts.location.remote'), { remote: nil, local: nil }, { remote: '1', local: nil }
  19. - else
  20. = filter_link_to t('admin.accounts.location.remote'), remote: '1', local: nil
  21. = form_tag admin_custom_emojis_url, method: 'GET', class: 'simple_form' do
  22. .fields-group
  23. - CustomEmojiFilter::KEYS.each do |key|
  24. = hidden_field_tag key, params[key] if params[key].present?
  25. - %i(shortcode by_domain).each do |key|
  26. .input.string.optional
  27. = text_field_tag key, params[key], class: 'string optional', placeholder: I18n.t("admin.custom_emojis.#{key}")
  28. .actions
  29. %button.button= t('admin.accounts.search')
  30. = link_to t('admin.accounts.reset'), admin_custom_emojis_path, class: 'button negative'
  31. = form_for(@form, url: batch_admin_custom_emojis_path) do |f|
  32. = hidden_field_tag :page, params[:page] || 1
  33. - CustomEmojiFilter::KEYS.each do |key|
  34. = hidden_field_tag key, params[key] if params[key].present?
  35. .batch-table
  36. .batch-table__toolbar
  37. %label.batch-table__toolbar__select.batch-checkbox-all
  38. = check_box_tag :batch_checkbox_all, nil, false
  39. .batch-table__toolbar__actions
  40. - if params[:local] == '1'
  41. = 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') }
  42. = 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') }
  43. = 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') }
  44. = 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') }
  45. = 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') }
  46. - if can?(:destroy, :custom_emoji)
  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. - if can?(:copy, :custom_emoji) && 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