use askama::Template;
use crate::{
config::{Branding, FeatureFlags, RoutePaths, Theme},
model::{
BatchEntry, DirectoryListing, DownloadLauncherEntry, FileEntry, MountOption,
MoveTargetOption, SearchResults, StorageUsage,
},
preview::PreviewDocument,
};
#[derive(Template)]
#[template(path = "index.html")]
pub struct IndexTemplate<'a> {
pub branding: &'a Branding,
pub theme: &'a Theme,
pub routes: &'a RoutePaths,
pub initial_content_url: &'a str,
}
#[derive(Template)]
#[template(path = "panel.html")]
pub struct PanelTemplate<'a> {
pub eyebrow: &'a str,
pub title: &'a str,
pub message: &'a str,
}
#[derive(Template)]
#[template(path = "browse.html")]
pub struct BrowseTemplate<'a> {
pub listing: &'a DirectoryListing,
pub entries: &'a [FileEntry],
pub batch_entries: &'a [BatchEntry],
pub batch_serialized: &'a str,
pub batch_add_all_url: &'a str,
pub mount_options: &'a [MountOption],
pub move_target_options: &'a [MoveTargetOption],
pub active_mount_name: &'a str,
pub current_mount_id: &'a str,
pub current_path: &'a str,
pub current_query: &'a str,
pub current_sort_key: &'a str,
pub current_sort_desc: bool,
pub sort_name_url: &'a str,
pub sort_size_url: &'a str,
pub sort_modified_url: &'a str,
pub storage_usage: &'a StorageUsage,
pub selected_relative_path: &'a str,
pub action_notice: Option<&'a str>,
pub preview_html: Option<&'a str>,
pub routes: &'a RoutePaths,
pub features: &'a FeatureFlags,
}
#[derive(Template)]
#[template(path = "search.html")]
pub struct SearchTemplate<'a> {
pub results: &'a SearchResults,
pub entries: &'a [FileEntry],
pub batch_entries: &'a [BatchEntry],
pub batch_serialized: &'a str,
pub mount_options: &'a [MountOption],
pub move_target_options: &'a [MoveTargetOption],
pub active_mount_name: &'a str,
pub current_mount_id: &'a str,
pub current_query: &'a str,
pub current_path: &'a str,
pub batch_add_all_url: &'a str,
pub current_sort_key: &'a str,
pub current_sort_desc: bool,
pub sort_name_url: &'a str,
pub sort_size_url: &'a str,
pub sort_modified_url: &'a str,
pub storage_usage: &'a StorageUsage,
pub selected_relative_path: &'a str,
pub action_notice: Option<&'a str>,
pub preview_html: Option<&'a str>,
pub routes: &'a RoutePaths,
pub features: &'a FeatureFlags,
}
#[derive(Template)]
#[template(path = "preview.html")]
pub struct PreviewTemplate<'a> {
pub preview: &'a PreviewDocument,
pub close_url: &'a str,
}
#[derive(Template)]
#[template(path = "download_progress.html")]
pub struct DownloadProgressTemplate<'a> {
pub branding: &'a Branding,
pub routes: &'a RoutePaths,
pub entries: &'a [DownloadLauncherEntry],
pub current_mount_id: &'a str,
pub batch_serialized: &'a str,
pub mode_label: &'a str,
pub total_files: usize,
pub delete_after_download: bool,
pub archive_job_status_url: Option<&'a str>,
pub archive_job_file_url: Option<&'a str>,
}
#[derive(Template)]
#[template(path = "move_progress.html")]
pub struct MoveProgressTemplate<'a> {
pub branding: &'a Branding,
pub routes: &'a RoutePaths,
pub entries: &'a [BatchEntry],
pub source_mount_name: &'a str,
pub target_mount_name: &'a str,
pub total_items: usize,
pub move_job_status_url: &'a str,
pub target_mount_url: &'a str,
}
#[derive(Template)]
#[template(path = "mount_unavailable.html")]
pub struct MountUnavailableTemplate<'a> {
pub mount_options: &'a [MountOption],
pub active_mount_name: &'a str,
pub error_message: &'a str,
pub refresh_url: &'a str,
pub back_url: Option<&'a str>,
}
#[derive(Template)]
#[template(path = "styles.css", escape = "none")]
pub struct StylesCss<'a> {
pub theme: &'a Theme,
}
#[derive(Template)]
#[template(path = "htmx.min.js", escape = "none")]
pub struct HtmxJs;