- @:text_input("title", Some("Collection Title"), Some(&collection.title)) - @:text_area("description", Some("Collection Description"), Some(&collection.description)) + @:text_input("title", Some("Collection Title"), Some(&collection.title), false) + @:text_area("description", Some("Collection Description"), Some(&collection.description), false) @:button("Update Collection", ButtonKind::Submit) @:button_link("Delete Collection", &state.delete_collection_path(collection_id, token, false), @@ -52,21 +52,25 @@ statics::file_upload_js}; - @if let Some(upload_id) = entry.upload_id() { - - } - @if let Some((filename, delete_token)) = entry.file_parts() { - @:text_input("title", Some("Image Title"), entry.title.as_deref()) - @:text_area("description", Some("Image Description"), entry.description.as_deref()) - @:text_input("link", Some("https://..."), entry.link.as_ref().map(|l| l.as_str())) - - + @:text_input("title", Some("Image Title"), entry.title.as_deref(), entry.file_parts().is_none()) + @:text_area("description", Some("Image Description"), entry.description.as_deref(), + entry.file_parts().is_none()) + @:text_input("link", Some("Image Link"), entry.link.as_ref().map(|l| l.as_str()), + entry.file_parts().is_none()) + + @if let Some(upload_id) = entry.upload_id() { + + @:button_link("Refresh", &state.edit_collection_path(collection_id, token), ButtonKind::Submit) + } + @if let Some((filename, delete_token)) = entry.file_parts() { + + @:button("Update Image", ButtonKind::Submit) @:button_link("Delete Image", &state.delete_entry_path(collection_id, *id, token, false), ButtonKind::Outline) + } - @if i != 0 { @:button_link("Move Up", &state.move_entry_path(collection_id, *id, token, Direction::Up), @@ -78,7 +82,6 @@ statics::file_upload_js}; ButtonKind::Outline) } - } diff --git a/templates/index.rs.html b/templates/index.rs.html index 9136e0a..84a2ccc 100644 --- a/templates/index.rs.html +++ b/templates/index.rs.html @@ -5,21 +5,23 @@ @:layout(state, "Collection", None, {}, { - - - - Create Collection - - - @:text_input("title", Some("Title"), None) - @:text_area("description", Some("Description"), None) - - - - @:button("Create Collection", ButtonKind::Submit) - - - - + + + + + Create Collection + + + + @:text_input("title", Some("Title"), None, false) + @:text_area("description", Some("Description"), None, false) + + + + @:button("Create Collection", ButtonKind::Submit) + + + + }) diff --git a/templates/text_area.rs.html b/templates/text_area.rs.html index 5bcca72..52da359 100644 --- a/templates/text_area.rs.html +++ b/templates/text_area.rs.html @@ -1,21 +1,12 @@ -@(name: &str, title: Option<&str>, value: Option<&str>) - - - @if let Some(title) = title { - - @title - @if let Some(value) = value { - @value - } else { - - } - - } else { - @if let Some(value) = value { - @value - } else { - - } - } - +@(name: &str, title: Option<&str>, value: Option<&str>, disabled: bool) + + @if let Some(title) = title { + + @title + @if let Some(value) = value { @value } + + } else { + @if let Some(value) = value { @value } + } + diff --git a/templates/text_input.rs.html b/templates/text_input.rs.html index 525dff5..2927265 100644 --- a/templates/text_input.rs.html +++ b/templates/text_input.rs.html @@ -1,20 +1,14 @@ -@(name: &str, title: Option<&str>, value: Option<&str>) +@(name: &str, title: Option<&str>, value: Option<&str>, disabled: bool) - - @if let Some(title) = title { - - @title - @if let Some(value) = value { - - } else { - - } - - } else { - @if let Some(value) = value { - - } else { - - } - } - + + @if let Some(title) = title { + + @title + + + } else { + + } +
- - - Create Collection - - - @:text_input("title", Some("Title"), None) - @:text_area("description", Some("Description"), None) - - - - @:button("Create Collection", ButtonKind::Submit) - - - -
+ + + + Create Collection + + + + @:text_input("title", Some("Title"), None, false) + @:text_area("description", Some("Description"), None, false) + + + + @:button("Create Collection", ButtonKind::Submit) + + + +