/* This file is part of jellything (https://codeberg.org/metamuffin/jellything) which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2026 metamuffin */ use crate::{FlashM, Page, locale::tr, scaffold::{FlashDisplay, RenderInfo}}; use jellycommon::routes::u_admin_import_post; impl Page for AdminImportPage<'_> { fn title(&self) -> String { "Import".to_string() } fn to_render(&self) -> markup::DynRender<'_> { markup::new!(@self) } } markup::define!( AdminImportPage<'a>(ri: &'a RenderInfo<'a>, busy: bool, last_import_err: &'a [String], flash: &'a FlashM) { @FlashDisplay { flash } @if *busy { h1 { @tr(ri.lang, "admin.import.running") } noscript { "Live import progress needs javascript." } div[id="admin_import"] {} } else { h1 { @tr(ri.lang, "admin.import.title") } @if !last_import_err.is_empty() { section.message.error { details { summary { p.error { @tr(ri.lang, "admin.import_errors").replace("{n}", &last_import_err.len().to_string()) } } ol { @for e in *last_import_err { li.error { pre.error { @e } } }} } } } form[method="POST", action=u_admin_import_post(true)] { input[type="submit", value=tr(ri.lang, "admin.dashboard.import.inc").to_string()]; } form[method="POST", action=u_admin_import_post(false)] { input[type="submit", value=tr(ri.lang, "admin.dashboard.import.full").to_string()]; } } } );