Improve pending image state
This commit is contained in:
parent
40a76f4cb0
commit
3b4e7db912
|
@ -33,8 +33,8 @@ statics::file_upload_js};
|
|||
</article>
|
||||
<article class="content-group">
|
||||
<form method="POST" action="@state.update_collection_path(collection_id, token)">
|
||||
@: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)
|
||||
<div class="button-group button-space">
|
||||
@: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};
|
|||
</div>
|
||||
<div class="edit-item">
|
||||
<form method="POST" action="@state.update_entry_path(collection_id, *id, token)">
|
||||
@if let Some(upload_id) = entry.upload_id() {
|
||||
<input type="hidden" name="upload_id" value="@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()))
|
||||
<input type="hidden" name="filename" value="@filename" />
|
||||
<input type="hidden" name="delete_token" value="@delete_token" />
|
||||
@: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())
|
||||
|
||||
<div class="button-group button-space">
|
||||
@if let Some(upload_id) = entry.upload_id() {
|
||||
<input type="hidden" name="upload_id" value="@upload_id" />
|
||||
@:button_link("Refresh", &state.edit_collection_path(collection_id, token), ButtonKind::Submit)
|
||||
}
|
||||
@if let Some((filename, delete_token)) = entry.file_parts() {
|
||||
<input type="hidden" name="filename" value="@filename" />
|
||||
<input type="hidden" name="delete_token" value="@delete_token" />
|
||||
@:button("Update Image", ButtonKind::Submit)
|
||||
@:button_link("Delete Image", &state.delete_entry_path(collection_id, *id, token, false),
|
||||
ButtonKind::Outline)
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="button-group button-space">
|
||||
@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)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -5,21 +5,23 @@
|
|||
|
||||
@:layout(state, "Collection", None, {}, {
|
||||
<section>
|
||||
<article>
|
||||
<form method="POST" action="@state.create_collection_path()">
|
||||
<div class="content-group">
|
||||
<h3><legend>Create Collection</legend></h3>
|
||||
</div>
|
||||
<div class="content-group">
|
||||
@:text_input("title", Some("Title"), None)
|
||||
@:text_area("description", Some("Description"), None)
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="button-group">
|
||||
@:button("Create Collection", ButtonKind::Submit)
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
<article>
|
||||
<form method="POST" action="@state.create_collection_path()">
|
||||
<div class="content-group">
|
||||
<h3>
|
||||
<legend>Create Collection</legend>
|
||||
</h3>
|
||||
</div>
|
||||
<div class="content-group">
|
||||
@:text_input("title", Some("Title"), None, false)
|
||||
@:text_area("description", Some("Description"), None, false)
|
||||
</div>
|
||||
<div class="content-group">
|
||||
<div class="button-group">
|
||||
@:button("Create Collection", ButtonKind::Submit)
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</article>
|
||||
</section>
|
||||
})
|
||||
|
|
|
@ -1,21 +1,12 @@
|
|||
@(name: &str, title: Option<&str>, value: Option<&str>)
|
||||
|
||||
<div class="input-wrapper">
|
||||
@if let Some(title) = title {
|
||||
<label for="@name">
|
||||
<div class="input-title">@title</div>
|
||||
@if let Some(value) = value {
|
||||
<textarea class="input" name="@name">@value</textarea>
|
||||
} else {
|
||||
<textarea class="input" name="@name"></textarea>
|
||||
}
|
||||
</label>
|
||||
} else {
|
||||
@if let Some(value) = value {
|
||||
<textarea class="input" name="@name">@value</textarea>
|
||||
} else {
|
||||
<textarea class="input" name="@name"></textarea>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@(name: &str, title: Option<&str>, value: Option<&str>, disabled: bool)
|
||||
|
||||
<div class="input-wrapper">
|
||||
@if let Some(title) = title {
|
||||
<label for="@name">
|
||||
<div class="input-title">@title</div>
|
||||
<textarea class="input" name="@name" @if disabled { disabled }>@if let Some(value) = value { @value }</textarea>
|
||||
</label>
|
||||
} else {
|
||||
<textarea class="input" name="@name" @if disabled { disabled }>@if let Some(value) = value { @value }</textarea>
|
||||
}
|
||||
</div>
|
||||
|
|
|
@ -1,20 +1,14 @@
|
|||
@(name: &str, title: Option<&str>, value: Option<&str>)
|
||||
@(name: &str, title: Option<&str>, value: Option<&str>, disabled: bool)
|
||||
|
||||
<div class="input-wrapper">
|
||||
@if let Some(title) = title {
|
||||
<label for="@name">
|
||||
<div class="input-title">@title</div>
|
||||
@if let Some(value) = value {
|
||||
<input type="text" class="input" name="@name" value="@value" />
|
||||
} else {
|
||||
<input type="text" class="input" name="@name" />
|
||||
}
|
||||
</label>
|
||||
} else {
|
||||
@if let Some(value) = value {
|
||||
<input type="text" class="input" name="@name" value="@value" />
|
||||
} else {
|
||||
<input type="text" class="input" name="@name" />
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="input-wrapper">
|
||||
@if let Some(title) = title {
|
||||
<label for="@name">
|
||||
<div class="input-title">@title</div>
|
||||
<input type="text" class="input" name="@name" @if disabled { disabled } @if let Some(value)=value {
|
||||
value="@value" } />
|
||||
</label>
|
||||
} else {
|
||||
<input type="text" class="input" name="@name" @if disabled { disabled } @if let Some(value)=value { value="@value"
|
||||
} />
|
||||
}
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue