94 lines
3.6 KiB
HTML
94 lines
3.6 KiB
HTML
@use crate::{ui::ButtonKind, Collection, Entry, State, ValidToken};
|
|
@use super::{button, button_link, image, file_input, layout, return_home, text_area, text_input, statics::file_upload_js};
|
|
@use uuid::Uuid;
|
|
|
|
@(collection: &Collection, collection_id: Uuid, entries: &[(Uuid, Entry)], token: &ValidToken, state: &State)
|
|
|
|
@:layout(state, "Edit Collection", None, {
|
|
<script
|
|
src="@state.statics_path(&file_upload_js.name)"
|
|
type="text/javascript"
|
|
>
|
|
</script>
|
|
}, {
|
|
<section>
|
|
<article class="content-group">
|
|
<h3>Share Collection</h3>
|
|
</article>
|
|
<article class="content-group">
|
|
<a
|
|
href="@state.public_collection_path(collection_id)"
|
|
target="_blank"
|
|
rel="noopen noreferer"
|
|
>
|
|
Public Link
|
|
</a>
|
|
</article>
|
|
</section>
|
|
<section>
|
|
<article class="content-group">
|
|
<h3>Edit Collection</h3>
|
|
</article>
|
|
<article class="content-group">
|
|
<p class="subtitle"><a href="@state.edit_collection_path(collection_id, token)">Do not lose this link</a></p>
|
|
</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))
|
|
<div class="button-group button-space">
|
|
@:button("Update Collection", ButtonKind::Submit)
|
|
@:button_link("Delete Collection", &state.delete_collection_path(collection_id, token, false), ButtonKind::Outline)
|
|
</div>
|
|
</form>
|
|
</article>
|
|
<ul>
|
|
@for (id, entry) in entries {
|
|
<li class="content-group">
|
|
<article>
|
|
<div class="edit-row">
|
|
<div class="edit-item">
|
|
@:image(entry, state)
|
|
</div>
|
|
<div class="edit-item">
|
|
<form method="POST" action="@state.update_entry_path(collection_id, *id, token)">
|
|
@:text_input("title", Some("Image Title"), Some(&entry.title))
|
|
@:text_area("description", Some("Image Description"), Some(&entry.description))
|
|
<input type="hidden" name="filename" value="@entry.filename" />
|
|
<input type="hidden" name="delete_token" value="@entry.delete_token" />
|
|
<div class="button-group button-space">
|
|
@:button("Update Image", ButtonKind::Submit)
|
|
@:button_link("Delete Image", &state.delete_entry_path(collection_id, *id, token, false), ButtonKind::Outline)
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</li>
|
|
}
|
|
</ul>
|
|
</section>
|
|
<section>
|
|
<article>
|
|
<form
|
|
method="POST"
|
|
action="@state.create_entry_path(collection_id, token)"
|
|
enctype="multipart/form-data"
|
|
>
|
|
<div class="content-group">
|
|
<h3><legend>Add Image</legend></h3>
|
|
</div>
|
|
<div class="content-group" id="file-input-container">
|
|
<div class="button-group">
|
|
@:file_input("images[]", Some("Select Image"), Some(crate::accept()), false)
|
|
</div>
|
|
<div class="button-group button-space">
|
|
@:button("Upload", ButtonKind::Submit)
|
|
</div>
|
|
</div>
|
|
</form>
|
|
</article>
|
|
</section>
|
|
@:return_home(state)
|
|
})
|