| 1 |
|
| 2 |
|
| 3 |
use std::sync::Arc; |
| 4 |
|
| 5 |
use askama::Template; |
| 6 |
|
| 7 |
use crate::db::{DbUserSession, UserSessionId}; |
| 8 |
use crate::types::{ |
| 9 |
AdminAppealRow, AdminHeldUploadRow, AdminReportRow, AdminUserRow, AdminWaitlistRow, |
| 10 |
BlogPostDashboardRow, ChartBar, Collection, ContentItem, DiscoverItem, DiscoverProject, |
| 11 |
InviteCodeDisplay, Item, ItemSection, LicenseKeyRow, Project, ProjectCard, ProjectMemberRow, |
| 12 |
PromoCodeRow, SidebarView, StatCard, SubscriptionTier, SyncAppRow, TipReceived, Transaction, |
| 13 |
User, UserSubscription, Version, WaitlistEntry, WaveStats, |
| 14 |
}; |
| 15 |
|
| 16 |
use super::CsrfTokenOption; |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
#[derive(Template)] |
| 22 |
#[template(path = "partials/discover_results.html")] |
| 23 |
pub struct DiscoverResultsTemplate { |
| 24 |
pub items: Vec<DiscoverItem>, |
| 25 |
pub projects: Vec<DiscoverProject>, |
| 26 |
pub mode: String, |
| 27 |
pub total_items: u32, |
| 28 |
pub current_page: u32, |
| 29 |
pub total_pages: u32, |
| 30 |
pub pagination_range: Vec<u32>, |
| 31 |
pub showing_start: u32, |
| 32 |
pub showing_end: u32, |
| 33 |
|
| 34 |
pub current_category: String, |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
pub is_search: bool, |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
pub count_label: String, |
| 45 |
|
| 46 |
pub is_authenticated: bool, |
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
pub sidebar: SidebarView, |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
pub oob_sidebar: bool, |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
#[derive(Template)] |
| 59 |
#[template(path = "partials/alert.html")] |
| 60 |
pub struct AlertTemplate { |
| 61 |
pub alert_type: String, |
| 62 |
pub message: String, |
| 63 |
pub link_url: Option<String>, |
| 64 |
pub link_text: Option<String>, |
| 65 |
} |
| 66 |
|
| 67 |
impl AlertTemplate { |
| 68 |
pub fn new(alert_type: &str, message: &str) -> Self { |
| 69 |
Self { |
| 70 |
alert_type: alert_type.to_string(), |
| 71 |
message: message.to_string(), |
| 72 |
link_url: None, |
| 73 |
link_text: None, |
| 74 |
} |
| 75 |
} |
| 76 |
|
| 77 |
#[must_use] |
| 78 |
pub fn with_link(mut self, url: &str, text: &str) -> Self { |
| 79 |
self.link_url = Some(url.to_string()); |
| 80 |
self.link_text = Some(text.to_string()); |
| 81 |
self |
| 82 |
} |
| 83 |
} |
| 84 |
|
| 85 |
|
| 86 |
#[derive(Template)] |
| 87 |
#[template(path = "partials/form_status.html")] |
| 88 |
pub struct FormStatusTemplate { |
| 89 |
pub success: bool, |
| 90 |
pub message: String, |
| 91 |
} |
| 92 |
|
| 93 |
impl FormStatusTemplate { |
| 94 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 95 |
crate::helpers::render_fragment(self) |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
|
| 100 |
#[derive(Template)] |
| 101 |
#[template(path = "partials/library_status.html")] |
| 102 |
pub struct LibraryStatusTemplate { |
| 103 |
pub message: String, |
| 104 |
} |
| 105 |
|
| 106 |
|
| 107 |
#[derive(Template)] |
| 108 |
#[template(path = "partials/export_download.html")] |
| 109 |
pub struct ExportDownloadTemplate { |
| 110 |
pub data_uri: String, |
| 111 |
pub filename: String, |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
#[derive(Template)] |
| 116 |
#[template(path = "partials/export_content_ready.html")] |
| 117 |
pub struct ExportContentReadyTemplate { |
| 118 |
pub download_url: String, |
| 119 |
} |
| 120 |
|
| 121 |
|
| 122 |
#[derive(Template)] |
| 123 |
#[template(path = "partials/login_error.html")] |
| 124 |
pub struct LoginErrorTemplate { |
| 125 |
pub message: String, |
| 126 |
} |
| 127 |
|
| 128 |
impl LoginErrorTemplate { |
| 129 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 130 |
crate::helpers::render_fragment(self) |
| 131 |
} |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
#[derive(Template)] |
| 136 |
#[template(path = "partials/username_status.html")] |
| 137 |
pub struct UsernameStatusTemplate { |
| 138 |
pub available: bool, |
| 139 |
} |
| 140 |
|
| 141 |
impl UsernameStatusTemplate { |
| 142 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 143 |
crate::helpers::render_fragment(self) |
| 144 |
} |
| 145 |
} |
| 146 |
|
| 147 |
|
| 148 |
#[derive(Template)] |
| 149 |
#[template(path = "partials/slug_status.html")] |
| 150 |
pub struct SlugStatusTemplate { |
| 151 |
pub available: bool, |
| 152 |
pub suggestions: Vec<String>, |
| 153 |
} |
| 154 |
|
| 155 |
impl SlugStatusTemplate { |
| 156 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 157 |
crate::helpers::render_fragment(self) |
| 158 |
} |
| 159 |
} |
| 160 |
|
| 161 |
|
| 162 |
#[derive(Template)] |
| 163 |
#[template(path = "partials/save_status.html")] |
| 164 |
pub struct SaveStatusTemplate { |
| 165 |
pub success: bool, |
| 166 |
pub message: String, |
| 167 |
} |
| 168 |
|
| 169 |
impl SaveStatusTemplate { |
| 170 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 171 |
crate::helpers::render_fragment(self) |
| 172 |
} |
| 173 |
} |
| 174 |
|
| 175 |
|
| 176 |
#[derive(Template)] |
| 177 |
#[template(path = "partials/transactions_table.html")] |
| 178 |
pub struct TransactionsTableTemplate { |
| 179 |
pub transactions: Vec<Transaction>, |
| 180 |
} |
| 181 |
|
| 182 |
|
| 183 |
|
| 184 |
|
| 185 |
#[derive(Template)] |
| 186 |
#[template(path = "partials/tabs/user_profile.html")] |
| 187 |
pub struct UserProfileTabTemplate { |
| 188 |
pub user: User, |
| 189 |
pub custom_links: Vec<CustomLinkWithId>, |
| 190 |
|
| 191 |
pub feed_url: String, |
| 192 |
|
| 193 |
pub can_create_projects: bool, |
| 194 |
|
| 195 |
pub custom_domain: Option<CustomDomainInfo>, |
| 196 |
|
| 197 |
pub theme_options: Vec<crate::theming::ThemeOption>, |
| 198 |
} |
| 199 |
|
| 200 |
|
| 201 |
#[derive(Template)] |
| 202 |
#[template(path = "partials/tabs/user_settings.html")] |
| 203 |
pub struct UserSettingsTabTemplate { |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
|
| 209 |
|
| 210 |
pub sections: String, |
| 211 |
} |
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
pub struct OperationalMailRow { |
| 219 |
pub label: &'static str, |
| 220 |
pub justification: &'static str, |
| 221 |
} |
| 222 |
|
| 223 |
impl OperationalMailRow { |
| 224 |
|
| 225 |
pub fn all() -> Vec<Self> { |
| 226 |
crate::email::OperationalKind::ALL |
| 227 |
.iter() |
| 228 |
.filter(|k| k.user_facing()) |
| 229 |
.map(|k| Self { |
| 230 |
label: k.label(), |
| 231 |
justification: k.justification(), |
| 232 |
}) |
| 233 |
.collect() |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
|
| 238 |
#[derive(Template)] |
| 239 |
#[template(path = "partials/tabs/user_account.html")] |
| 240 |
pub struct UserAccountTabTemplate { |
| 241 |
pub user: User, |
| 242 |
|
| 243 |
|
| 244 |
pub operational_mail: Vec<OperationalMailRow>, |
| 245 |
|
| 246 |
|
| 247 |
pub notifications: crate::db::lists::NotificationPrefs, |
| 248 |
pub sessions: Vec<DbUserSession>, |
| 249 |
pub current_session_id: Option<UserSessionId>, |
| 250 |
|
| 251 |
pub can_create_projects: bool, |
| 252 |
|
| 253 |
pub email_verified: bool, |
| 254 |
|
| 255 |
pub moderation_active: Vec<ModerationActionView>, |
| 256 |
|
| 257 |
pub moderation_history: Vec<ModerationActionView>, |
| 258 |
|
| 259 |
pub creator_paused: bool, |
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
pub fan_plus: Option<FanPlusPaneView>, |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
pub csrf_token: super::CsrfTokenOption, |
| 268 |
} |
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
pub struct FanPlusPaneView { |
| 273 |
|
| 274 |
|
| 275 |
pub period_end: Option<String>, |
| 276 |
|
| 277 |
|
| 278 |
pub cancel_at_period_end: bool, |
| 279 |
} |
| 280 |
|
| 281 |
|
| 282 |
pub struct ModerationActionView { |
| 283 |
|
| 284 |
pub action_label: String, |
| 285 |
pub reason: String, |
| 286 |
pub created_at: String, |
| 287 |
pub resolved_at: Option<String>, |
| 288 |
} |
| 289 |
|
| 290 |
|
| 291 |
pub struct CustomDomainInfo { |
| 292 |
pub id: String, |
| 293 |
pub domain: String, |
| 294 |
pub verified: bool, |
| 295 |
pub verification_token: String, |
| 296 |
pub instructions: String, |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
#[derive(Clone)] |
| 301 |
pub struct CustomLinkWithId { |
| 302 |
pub id: String, |
| 303 |
pub url: String, |
| 304 |
pub title: String, |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
#[derive(Template)] |
| 309 |
#[template(path = "partials/tabs/user_payments.html")] |
| 310 |
pub struct UserPaymentsTabTemplate { |
| 311 |
|
| 312 |
pub csrf_token: CsrfTokenOption, |
| 313 |
pub user: User, |
| 314 |
pub transactions: Vec<Transaction>, |
| 315 |
pub tips_received: Vec<TipReceived>, |
| 316 |
pub tips_total: String, |
| 317 |
pub tips_count: i64, |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
pub splits_incoming_total: String, |
| 322 |
|
| 323 |
|
| 324 |
pub splits_incoming_foreign: bool, |
| 325 |
|
| 326 |
|
| 327 |
pub pending_invitations: Vec<crate::db::project_members::PendingSplitInvitation>, |
| 328 |
|
| 329 |
|
| 330 |
pub own_currency: crate::currency::SettlementCurrency, |
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
pub splits_outgoing_any: bool, |
| 335 |
pub splits_incoming_count: i64, |
| 336 |
|
| 337 |
pub splits_outgoing_total: String, |
| 338 |
|
| 339 |
pub can_create_projects: bool, |
| 340 |
} |
| 341 |
|
| 342 |
|
| 343 |
#[derive(Template)] |
| 344 |
#[template(path = "partials/tabs/user_creator.html")] |
| 345 |
#[allow(dead_code)] |
| 346 |
pub struct UserCreatorTabTemplate { |
| 347 |
pub csrf_token: CsrfTokenOption, |
| 348 |
|
| 349 |
pub can_create_projects: bool, |
| 350 |
|
| 351 |
pub email_verified: bool, |
| 352 |
|
| 353 |
pub follower_count: i64, |
| 354 |
|
| 355 |
pub waitlist_entry: Option<WaitlistEntry>, |
| 356 |
|
| 357 |
|
| 358 |
pub mail_allowance: Option<crate::types::MailAllowanceView>, |
| 359 |
|
| 360 |
pub invites_enabled: bool, |
| 361 |
|
| 362 |
pub active_invite_count: i64, |
| 363 |
|
| 364 |
pub invite_limit: i64, |
| 365 |
|
| 366 |
pub invite_codes: Vec<InviteCodeDisplay>, |
| 367 |
|
| 368 |
pub total_creators: u32, |
| 369 |
|
| 370 |
pub waitlist_pending: u32, |
| 371 |
|
| 372 |
pub waves: Vec<WaveStats>, |
| 373 |
|
| 374 |
pub creator_tier_label: Option<String>, |
| 375 |
|
| 376 |
pub creator_period_end: Option<String>, |
| 377 |
|
| 378 |
pub creator_sub_status: Option<crate::db::SubscriptionStatus>, |
| 379 |
|
| 380 |
pub creator_tiers_configured: bool, |
| 381 |
|
| 382 |
pub storage_audio: String, |
| 383 |
pub storage_covers: String, |
| 384 |
pub storage_downloads: String, |
| 385 |
pub storage_insertions: String, |
| 386 |
pub storage_video: String, |
| 387 |
pub storage_media: String, |
| 388 |
pub storage_gallery: String, |
| 389 |
pub storage_total: String, |
| 390 |
pub storage_max: String, |
| 391 |
|
| 392 |
pub storage_pct: u8, |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
pub storage_tier: &'static str, |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
pub founder_window_open: bool, |
| 401 |
|
| 402 |
|
| 403 |
pub is_founder: bool, |
| 404 |
|
| 405 |
pub is_founder_locked: bool, |
| 406 |
|
| 407 |
|
| 408 |
pub tier_cards: Vec<crate::tier_prices::TierCard>, |
| 409 |
} |
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
|
| 418 |
pub struct ProjectOverviewTabTemplate { |
| 419 |
pub stats: Vec<StatCard>, |
| 420 |
pub project_slug: String, |
| 421 |
pub stripe_connected: bool, |
| 422 |
pub has_items: bool, |
| 423 |
pub has_published_item: bool, |
| 424 |
} |
| 425 |
|
| 426 |
|
| 427 |
pub struct DeletedItemRow { |
| 428 |
pub id: String, |
| 429 |
pub title: String, |
| 430 |
pub deleted_at: String, |
| 431 |
} |
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
pub struct ProjectContentTabTemplate { |
| 442 |
pub items: Vec<ContentItem>, |
| 443 |
pub deleted_items: Vec<DeletedItemRow>, |
| 444 |
pub project_slug: String, |
| 445 |
pub project_id: String, |
| 446 |
pub posts: Vec<BlogPostDashboardRow>, |
| 447 |
} |
| 448 |
|
| 449 |
|
| 450 |
#[derive(Template)] |
| 451 |
#[template(path = "partials/tabs/project_settings.html")] |
| 452 |
pub struct ProjectSettingsTabTemplate { |
| 453 |
pub project: Project, |
| 454 |
|
| 455 |
pub category_name: String, |
| 456 |
|
| 457 |
pub project_id: String, |
| 458 |
|
| 459 |
pub features: Vec<String>, |
| 460 |
|
| 461 |
pub project_features: &'static [(&'static str, &'static str, &'static str)], |
| 462 |
|
| 463 |
pub sections: Vec<crate::db::DbProjectSection>, |
| 464 |
|
| 465 |
pub pricing_model: String, |
| 466 |
|
| 467 |
pub price_dollars: String, |
| 468 |
|
| 469 |
pub pwyw_min_dollars: String, |
| 470 |
|
| 471 |
pub theme_options: Vec<crate::theming::ThemeOption>, |
| 472 |
} |
| 473 |
|
| 474 |
|
| 475 |
#[derive(Template)] |
| 476 |
#[template(path = "partials/tabs/project_code.html")] |
| 477 |
pub struct ProjectCodeTabTemplate { |
| 478 |
pub project: Project, |
| 479 |
pub git_enabled: bool, |
| 480 |
pub linked_repos: Vec<LinkedRepoView>, |
| 481 |
pub available_repos: Vec<crate::db::DbGitRepo>, |
| 482 |
pub project_id: String, |
| 483 |
} |
| 484 |
|
| 485 |
|
| 486 |
#[derive(Template)] |
| 487 |
#[template(path = "partials/tabs/project_synckit.html")] |
| 488 |
pub struct ProjectSyncKitTabTemplate { |
| 489 |
pub apps: Vec<SyncAppRow>, |
| 490 |
pub project_id: String, |
| 491 |
|
| 492 |
|
| 493 |
pub project_slug: String, |
| 494 |
} |
| 495 |
|
| 496 |
|
| 497 |
pub struct LinkedRepoView { |
| 498 |
pub id: String, |
| 499 |
pub name: String, |
| 500 |
pub collaborators: Vec<RepoCollaboratorView>, |
| 501 |
} |
| 502 |
|
| 503 |
|
| 504 |
pub struct RepoCollaboratorView { |
| 505 |
pub user_id: String, |
| 506 |
pub username: String, |
| 507 |
pub can_push: bool, |
| 508 |
} |
| 509 |
|
| 510 |
|
| 511 |
#[derive(Template)] |
| 512 |
#[template(path = "partials/tabs/project_subscriptions.html")] |
| 513 |
#[allow(dead_code)] |
| 514 |
pub struct ProjectSubscriptionsTabTemplate { |
| 515 |
pub project_id: String, |
| 516 |
pub project_slug: String, |
| 517 |
pub tiers: Vec<SubscriptionTier>, |
| 518 |
pub subscriber_count: i64, |
| 519 |
pub stripe_connected: bool, |
| 520 |
} |
| 521 |
|
| 522 |
|
| 523 |
#[derive(Template)] |
| 524 |
#[template(path = "partials/tabs/project_monetization.html")] |
| 525 |
pub struct ProjectMonetizationTabTemplate { |
| 526 |
pub project_id: String, |
| 527 |
pub project_slug: String, |
| 528 |
pub tiers: Vec<SubscriptionTier>, |
| 529 |
pub subscriber_count: i64, |
| 530 |
pub stripe_connected: bool, |
| 531 |
pub promo_codes: Vec<crate::types::PromoCodeRow>, |
| 532 |
pub items: Vec<ContentItem>, |
| 533 |
pub members: Vec<ProjectMemberRow>, |
| 534 |
pub owner_split: i64, |
| 535 |
} |
| 536 |
|
| 537 |
|
| 538 |
#[derive(Template)] |
| 539 |
#[template(path = "partials/tabs/user_synckit.html")] |
| 540 |
pub struct UserSyncKitTabTemplate { |
| 541 |
pub apps: Vec<SyncAppRow>, |
| 542 |
pub projects: Vec<ProjectCard>, |
| 543 |
} |
| 544 |
|
| 545 |
|
| 546 |
pub struct ForumMembership { |
| 547 |
pub community_name: String, |
| 548 |
pub profile_url: String, |
| 549 |
pub role: String, |
| 550 |
pub joined: String, |
| 551 |
pub post_count: i64, |
| 552 |
} |
| 553 |
|
| 554 |
|
| 555 |
pub struct MediaFileRow { |
| 556 |
pub id: String, |
| 557 |
pub folder: String, |
| 558 |
pub filename: String, |
| 559 |
pub content_type: String, |
| 560 |
pub file_size: String, |
| 561 |
pub media_type: String, |
| 562 |
pub cdn_url: String, |
| 563 |
pub markdown_ref: String, |
| 564 |
pub created_at: String, |
| 565 |
} |
| 566 |
|
| 567 |
|
| 568 |
#[derive(Template)] |
| 569 |
#[template(path = "partials/tabs/user_media.html")] |
| 570 |
pub struct UserMediaTabTemplate { |
| 571 |
pub files: Vec<MediaFileRow>, |
| 572 |
pub folders: Vec<String>, |
| 573 |
pub storage_display: String, |
| 574 |
} |
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
#[derive(Template)] |
| 580 |
#[template(path = "partials/tabs/library_purchases.html")] |
| 581 |
pub struct LibraryPurchasesTabTemplate { |
| 582 |
pub purchases: Vec<crate::db::DbPurchaseRow>, |
| 583 |
pub subscriptions: Vec<UserSubscription>, |
| 584 |
} |
| 585 |
|
| 586 |
|
| 587 |
#[derive(Template)] |
| 588 |
#[template(path = "partials/tabs/library_collections.html")] |
| 589 |
pub struct LibraryCollectionsTabTemplate { |
| 590 |
pub collections: Vec<Collection>, |
| 591 |
pub username: String, |
| 592 |
pub wishlists: Vec<crate::db::wishlists::WishlistItem>, |
| 593 |
} |
| 594 |
|
| 595 |
|
| 596 |
pub struct ProjectRevenue { |
| 597 |
pub title: String, |
| 598 |
pub revenue: String, |
| 599 |
} |
| 600 |
|
| 601 |
|
| 602 |
#[derive(Template)] |
| 603 |
#[template(path = "partials/ssh_keys_list.html")] |
| 604 |
pub struct SshKeysListTemplate { |
| 605 |
pub ssh_keys: Vec<crate::routes::api::ssh_keys::SshKeyView>, |
| 606 |
} |
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
#[derive(Template)] |
| 611 |
#[template(path = "partials/git_tokens_list.html")] |
| 612 |
pub struct GitTokensListTemplate { |
| 613 |
pub tokens: Vec<crate::routes::api::git_tokens::GitTokenView>, |
| 614 |
pub new_token: Option<String>, |
| 615 |
} |
| 616 |
|
| 617 |
|
| 618 |
#[derive(Template)] |
| 619 |
#[template(path = "partials/tabs/user_sessions.html")] |
| 620 |
pub struct UserSessionsPartialTemplate { |
| 621 |
pub sessions: Vec<DbUserSession>, |
| 622 |
pub current_session_id: Option<UserSessionId>, |
| 623 |
} |
| 624 |
|
| 625 |
|
| 626 |
#[derive(Template)] |
| 627 |
#[template(path = "partials/tag.html")] |
| 628 |
pub struct TagTemplate { |
| 629 |
pub item_id: String, |
| 630 |
pub tag_id: String, |
| 631 |
pub tag_name: String, |
| 632 |
pub is_primary: bool, |
| 633 |
} |
| 634 |
|
| 635 |
impl TagTemplate { |
| 636 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 637 |
crate::helpers::render_fragment(self) |
| 638 |
} |
| 639 |
} |
| 640 |
|
| 641 |
|
| 642 |
#[derive(Template)] |
| 643 |
#[template(path = "partials/item_edit_row.html")] |
| 644 |
pub struct ItemEditRowTemplate { |
| 645 |
pub item: ContentItem, |
| 646 |
} |
| 647 |
|
| 648 |
|
| 649 |
#[derive(Template)] |
| 650 |
#[template(path = "partials/link_row.html")] |
| 651 |
pub struct LinkRowTemplate { |
| 652 |
pub id: String, |
| 653 |
pub title: String, |
| 654 |
pub url: String, |
| 655 |
} |
| 656 |
|
| 657 |
impl LinkRowTemplate { |
| 658 |
pub fn render_string(&self) -> crate::error::Result<String> { |
| 659 |
crate::helpers::render_fragment(self) |
| 660 |
} |
| 661 |
} |
| 662 |
|
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
#[derive(Template)] |
| 669 |
#[template(path = "partials/admin_waitlist_entries.html")] |
| 670 |
pub struct AdminWaitlistEntriesTemplate { |
| 671 |
pub entries: Vec<AdminWaitlistRow>, |
| 672 |
} |
| 673 |
|
| 674 |
|
| 675 |
#[derive(Template)] |
| 676 |
#[template(path = "partials/admin_user_entries.html")] |
| 677 |
pub struct AdminUserEntriesTemplate { |
| 678 |
pub users: Vec<AdminUserRow>, |
| 679 |
pub current_page: i64, |
| 680 |
pub total_pages: i64, |
| 681 |
pub current_filter: String, |
| 682 |
} |
| 683 |
|
| 684 |
|
| 685 |
#[derive(Template)] |
| 686 |
#[template(path = "partials/admin_upload_entries.html")] |
| 687 |
pub struct AdminUploadEntriesTemplate { |
| 688 |
pub held_uploads: Vec<AdminHeldUploadRow>, |
| 689 |
} |
| 690 |
|
| 691 |
|
| 692 |
#[derive(Template)] |
| 693 |
#[template(path = "partials/admin_queue_summary.html")] |
| 694 |
pub struct AdminQueueSummaryTemplate { |
| 695 |
pub queue_pending: i64, |
| 696 |
pub queue_running: i64, |
| 697 |
} |
| 698 |
|
| 699 |
|
| 700 |
#[derive(Template)] |
| 701 |
#[template(path = "partials/admin_appeal_entries.html")] |
| 702 |
pub struct AdminAppealEntriesTemplate { |
| 703 |
pub appeals: Vec<AdminAppealRow>, |
| 704 |
} |
| 705 |
|
| 706 |
|
| 707 |
#[derive(Template)] |
| 708 |
#[template(path = "partials/admin_report_entries.html")] |
| 709 |
pub struct AdminReportEntriesTemplate { |
| 710 |
pub reports: Vec<AdminReportRow>, |
| 711 |
} |
| 712 |
|
| 713 |
|
| 714 |
#[derive(Template)] |
| 715 |
#[template(path = "partials/suspension_banner.html")] |
| 716 |
pub struct SuspensionBannerTemplate { |
| 717 |
pub reason: String, |
| 718 |
pub has_pending_appeal: bool, |
| 719 |
pub appeal_decision: Option<String>, |
| 720 |
pub appeal_response: Option<String>, |
| 721 |
} |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
|
| 726 |
#[derive(Template)] |
| 727 |
#[template(path = "partials/promo_codes_list.html")] |
| 728 |
pub struct PromoCodesListTemplate { |
| 729 |
pub promo_codes: Vec<crate::types::PromoCodeRow>, |
| 730 |
} |
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
|
| 735 |
|
| 736 |
|
| 737 |
|
| 738 |
|
| 739 |
|
| 740 |
|
| 741 |
|
| 742 |
#[derive(Template)] |
| 743 |
#[template(path = "partials/item_license_keys.html")] |
| 744 |
pub struct ItemLicenseKeysTemplate { |
| 745 |
pub license_keys: Vec<crate::types::LicenseKeyRow>, |
| 746 |
} |
| 747 |
|
| 748 |
|
| 749 |
|
| 750 |
|
| 751 |
#[derive(Template)] |
| 752 |
#[template(path = "partials/follow_button.html")] |
| 753 |
pub struct FollowButtonTemplate { |
| 754 |
pub target_type: String, |
| 755 |
pub target_id: String, |
| 756 |
pub is_following: bool, |
| 757 |
pub follower_count: i64, |
| 758 |
} |
| 759 |
|
| 760 |
|
| 761 |
|
| 762 |
|
| 763 |
#[derive(Template)] |
| 764 |
#[template(path = "partials/tag_follow_toggle.html")] |
| 765 |
pub struct TagFollowToggleTemplate { |
| 766 |
pub tag_id: String, |
| 767 |
pub is_following: bool, |
| 768 |
} |
| 769 |
|
| 770 |
|
| 771 |
|
| 772 |
|
| 773 |
#[derive(Template)] |
| 774 |
#[template(path = "partials/totp_setup.html")] |
| 775 |
pub struct TotpSetupTemplate { |
| 776 |
pub qr_base64: String, |
| 777 |
pub secret_base32: String, |
| 778 |
pub backup_codes: Vec<String>, |
| 779 |
} |
| 780 |
|
| 781 |
|
| 782 |
#[derive(Template)] |
| 783 |
#[template(path = "partials/totp_status.html")] |
| 784 |
pub struct TotpStatusTemplate { |
| 785 |
pub enabled: bool, |
| 786 |
} |
| 787 |
|
| 788 |
|
| 789 |
|
| 790 |
|
| 791 |
pub struct PasskeyDisplay { |
| 792 |
pub id: String, |
| 793 |
pub name: String, |
| 794 |
pub created_at: String, |
| 795 |
pub last_used_at: Option<String>, |
| 796 |
} |
| 797 |
|
| 798 |
|
| 799 |
#[derive(Template)] |
| 800 |
#[template(path = "partials/passkey_list.html")] |
| 801 |
pub struct PasskeyListTemplate { |
| 802 |
pub passkeys: Vec<PasskeyDisplay>, |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
#[derive(Clone)] |
| 809 |
pub struct TagSuggestion { |
| 810 |
pub id: String, |
| 811 |
pub name: String, |
| 812 |
} |
| 813 |
|
| 814 |
|
| 815 |
#[derive(Template)] |
| 816 |
#[template(path = "partials/tag_suggestions.html")] |
| 817 |
pub struct TagSuggestionsTemplate { |
| 818 |
pub suggestions: Vec<TagSuggestion>, |
| 819 |
} |
| 820 |
|
| 821 |
|
| 822 |
|
| 823 |
|
| 824 |
#[derive(Template)] |
| 825 |
#[template(path = "partials/item_analytics.html")] |
| 826 |
pub struct ItemAnalyticsPartialTemplate { |
| 827 |
pub stats: Vec<StatCard>, |
| 828 |
pub bars: Vec<ChartBar>, |
| 829 |
pub item_id: String, |
| 830 |
pub active_range: String, |
| 831 |
} |
| 832 |
|
| 833 |
|
| 834 |
#[derive(Clone)] |
| 835 |
pub struct InsertionDisplay { |
| 836 |
pub id: String, |
| 837 |
pub title: String, |
| 838 |
pub media_type: String, |
| 839 |
pub duration_display: String, |
| 840 |
pub created_at: String, |
| 841 |
} |
| 842 |
|
| 843 |
|
| 844 |
#[derive(Template)] |
| 845 |
#[template(path = "partials/insertion_list.html")] |
| 846 |
pub struct InsertionListTemplate { |
| 847 |
pub insertions: Vec<InsertionDisplay>, |
| 848 |
} |
| 849 |
|
| 850 |
|
| 851 |
#[derive(Clone)] |
| 852 |
pub struct PlacementDisplay { |
| 853 |
pub id: String, |
| 854 |
pub insertion_title: String, |
| 855 |
pub position: String, |
| 856 |
pub offset_display: Option<String>, |
| 857 |
pub sort_order: i32, |
| 858 |
} |
| 859 |
|
| 860 |
|
| 861 |
#[derive(Template)] |
| 862 |
#[template(path = "partials/placement_list.html")] |
| 863 |
pub struct PlacementListTemplate { |
| 864 |
pub item_id: String, |
| 865 |
pub placements: Vec<PlacementDisplay>, |
| 866 |
pub available_insertions: Vec<InsertionDisplay>, |
| 867 |
} |
| 868 |
|
| 869 |
|
| 870 |
|
| 871 |
|
| 872 |
#[derive(Template)] |
| 873 |
#[template(path = "partials/tabs/item_overview.html")] |
| 874 |
pub struct ItemOverviewTabTemplate { |
| 875 |
pub item: Item, |
| 876 |
} |
| 877 |
|
| 878 |
|
| 879 |
#[derive(Template)] |
| 880 |
#[template(path = "partials/tabs/item_details.html")] |
| 881 |
pub struct ItemDetailsTabTemplate { |
| 882 |
pub item: Item, |
| 883 |
pub bundle_items: Vec<Item>, |
| 884 |
pub bundleable_items: Vec<Item>, |
| 885 |
pub sections: Vec<ItemSection>, |
| 886 |
} |
| 887 |
|
| 888 |
|
| 889 |
#[derive(Template)] |
| 890 |
#[template(path = "partials/tabs/item_pricing.html")] |
| 891 |
pub struct ItemPricingTabTemplate { |
| 892 |
pub item: Item, |
| 893 |
pub license_keys: Vec<LicenseKeyRow>, |
| 894 |
pub promo_codes: Vec<PromoCodeRow>, |
| 895 |
pub license_preset_options: Vec<(&'static str, &'static str)>, |
| 896 |
} |
| 897 |
|
| 898 |
|
| 899 |
|
| 900 |
|
| 901 |
|
| 902 |
|
| 903 |
|
| 904 |
#[derive(Template)] |
| 905 |
#[template(path = "partials/item_version_upload.html")] |
| 906 |
pub struct ItemVersionUploadTemplate { |
| 907 |
pub item: Item, |
| 908 |
pub versions: Vec<Version>, |
| 909 |
} |
| 910 |
|
| 911 |
|
| 912 |
#[derive(Template)] |
| 913 |
#[template(path = "partials/tabs/item_embed.html")] |
| 914 |
pub struct ItemEmbedTabTemplate { |
| 915 |
pub item: Item, |
| 916 |
pub host_url: Arc<str>, |
| 917 |
pub is_audio: bool, |
| 918 |
} |
| 919 |
|