2023-05-02 12:08:48 +02:00
|
|
|
- content_for :page_title do
|
|
|
|
= t('settings.import')
|
|
|
|
|
|
|
|
= simple_form_for @import, url: settings_imports_path do |f|
|
|
|
|
.field-group
|
2024-01-09 16:28:56 +01:00
|
|
|
= f.input :type,
|
|
|
|
as: :grouped_select,
|
|
|
|
collection: { constructive: %i(following bookmarks lists), destructive: %i(muting blocking domain_blocking) },
|
|
|
|
group_label_method: ->(group) { I18n.t("imports.type_groups.#{group.first}") },
|
|
|
|
group_method: :last,
|
|
|
|
hint: t('imports.preface'),
|
|
|
|
include_blank: false,
|
|
|
|
label_method: ->(type) { I18n.t("imports.types.#{type}") },
|
|
|
|
wrapper: :with_block_label
|
2023-05-02 12:08:48 +02:00
|
|
|
|
|
|
|
.fields-row
|
|
|
|
.fields-group.fields-row__column.fields-row__column-6
|
2024-01-09 16:28:56 +01:00
|
|
|
= f.input :data,
|
|
|
|
as: :file,
|
|
|
|
hint: t('simple_form.hints.imports.data'),
|
|
|
|
wrapper: :with_block_label
|
2023-05-02 12:08:48 +02:00
|
|
|
.fields-group.fields-row__column.fields-row__column-6
|
2024-01-09 16:28:56 +01:00
|
|
|
= f.input :mode,
|
|
|
|
as: :radio_buttons,
|
|
|
|
collection_wrapper_tag: 'ul',
|
2024-09-05 16:07:17 +02:00
|
|
|
collection: Form::Import::MODES,
|
2024-01-09 16:28:56 +01:00
|
|
|
item_wrapper_tag: 'li',
|
|
|
|
label_method: ->(mode) { safe_join([I18n.t("imports.modes.#{mode}"), content_tag(:span, I18n.t("imports.modes.#{mode}_long"), class: 'hint')]) }
|
2023-05-02 12:08:48 +02:00
|
|
|
|
|
|
|
.actions
|
|
|
|
= f.button :button, t('imports.upload'), type: :submit
|
|
|
|
|
|
|
|
- unless @recent_imports.empty?
|
|
|
|
%hr.spacer/
|
|
|
|
|
|
|
|
%h3= t('imports.recent_imports')
|
|
|
|
|
|
|
|
.table-wrapper
|
|
|
|
%table.table
|
|
|
|
%thead
|
|
|
|
%tr
|
|
|
|
%th= t('imports.type')
|
|
|
|
%th= t('imports.status')
|
|
|
|
%th= t('imports.imported')
|
|
|
|
%th= t('imports.time_started')
|
|
|
|
%th= t('imports.failures')
|
|
|
|
%tbody
|
|
|
|
- @recent_imports.each do |import|
|
2024-09-03 17:23:16 +02:00
|
|
|
%tr{ id: dom_id(import) }
|
2023-05-02 12:08:48 +02:00
|
|
|
%td= t("imports.types.#{import.type}")
|
|
|
|
%td
|
2024-04-18 12:13:35 +02:00
|
|
|
- if import.state_unconfirmed?
|
2023-05-02 12:08:48 +02:00
|
|
|
= link_to t("imports.states.#{import.state}"), settings_import_path(import)
|
|
|
|
- else
|
|
|
|
= t("imports.states.#{import.state}")
|
|
|
|
%td
|
|
|
|
#{import.imported_items} / #{import.total_items}
|
|
|
|
%td= l(import.created_at)
|
|
|
|
%td
|
|
|
|
- num_failed = import.processed_items - import.imported_items
|
|
|
|
- if num_failed.positive?
|
2024-04-18 12:13:35 +02:00
|
|
|
- if import.state_finished?
|
2023-05-02 12:08:48 +02:00
|
|
|
= link_to num_failed, failures_settings_import_path(import, format: 'csv')
|
|
|
|
- else
|
|
|
|
= num_failed
|