prepare for private demos

This commit is contained in:
Robin Appelman 2025-04-02 20:37:03 +02:00
commit ffb230045c
6 changed files with 58 additions and 14 deletions

View file

@ -23,7 +23,9 @@ impl Page for DemoPage {
fn render(&self) -> Markup {
let style_url = ClassIconsStyle::url();
html! {
@if self.demo.url.is_empty() {
@if self.demo.is_private() {
h3.warning { "This demo is private, it will be available for download " (self.demo.private_until_text()) }
} @else if self.demo.url.is_empty() {
h3.warning { "This demo has been deleted and is no longer available for download." }
}
h2 { (self.demo.server) " - " (self.demo.red) " vs " (self.demo.blu) }
@ -104,8 +106,8 @@ impl Page for DemoPage {
span.time { (self.demo.duration()) }
}
p.demo-download {
@if !self.demo.url.is_empty() {
a.button.button-primary href = (self.demo.url) download = (self.demo.name) rel = "nofollow" { "Download" }
@if !self.demo.url().is_empty() {
a.button.button-primary href = (self.demo.url()) download = (self.demo.name) rel = "nofollow" { "Download" }
a.button href = (self.demo.viewer_url()) rel = "nofollow" { "View" }
}
@if !self.demo.chat.is_empty() {

View file

@ -53,8 +53,12 @@ impl Page for ViewerPage<'_> {
html! {
.viewer-page data-maps = (maps) data-sync = (sync) {
@if let Some(demo) = self.demo.as_ref() {
input type = "hidden" name = "url" value = (demo.url) {}
progress.download min = "0" max = "100" value = "0" {}
@if demo.is_private() {
h3.warning { "This demo is private, it will be available for download " (demo.private_until_text()) }
} @else {
input type = "hidden" name = "url" value = (demo.url) {}
progress.download min = "0" max = "100" value = "0" {}
}
} @else {
.dropzone role = "button" {
noscript {