Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ba9b08d76 | ||
|
|
1a45839699 |
Generated
+1
-1
@@ -2948,7 +2948,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "portal"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"arc-swap",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "portal"
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition = "2021"
|
||||
|
||||
[lib]
|
||||
|
||||
+14
-1
@@ -1177,7 +1177,17 @@ fn AlternativeCard(
|
||||
children=move |e| view! { <p class="alt-encouragement">{e}</p> }
|
||||
/>
|
||||
</div>
|
||||
{if is_gateway {
|
||||
{if alternative.disabled {
|
||||
// Advertised, not yet takeable: the label
|
||||
// stays (it says what will be possible),
|
||||
// the button doesn't act.
|
||||
view! {
|
||||
<button type="button" class="alt-submit soon" disabled=true title="Not yet">
|
||||
{button_label.clone()}
|
||||
</button>
|
||||
}
|
||||
.into_any()
|
||||
} else if is_gateway {
|
||||
let href = alternative.action.clone().unwrap_or_default();
|
||||
view! {
|
||||
<a class="alt-submit" href=href>{button_label.clone()}</a>
|
||||
@@ -1860,6 +1870,9 @@ pub async fn submit_answer(
|
||||
.iter()
|
||||
.find(|a| a.name == alternative)
|
||||
.ok_or_else(|| ServerFnError::new("unknown alternative"))?;
|
||||
if alt.disabled {
|
||||
return Err(ServerFnError::new("this alternative isn't open yet"));
|
||||
}
|
||||
let next = alt.action.clone();
|
||||
let record_as = alt.record_as.clone();
|
||||
|
||||
|
||||
@@ -111,6 +111,11 @@ pub struct Alternative {
|
||||
pub description: String,
|
||||
#[serde(default)]
|
||||
pub action: Option<String>,
|
||||
/// Shown but not takeable yet - the button renders disabled and the
|
||||
/// server refuses the submission. For advertising a path before it
|
||||
/// works (lysbue had the same flag).
|
||||
#[serde(default)]
|
||||
pub disabled: bool,
|
||||
#[serde(default)]
|
||||
pub consequence: Vec<String>,
|
||||
#[serde(default)]
|
||||
|
||||
@@ -675,6 +675,13 @@ textarea:focus {
|
||||
cursor: wait;
|
||||
}
|
||||
|
||||
/* A content-disabled alternative (`disabled: true`): announced, not
|
||||
yet takeable - reads as a promise, not as a stuck form. */
|
||||
.alt-submit.soon:disabled {
|
||||
cursor: not-allowed;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.gate-card {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user