forked from mirrors/bookwyrm
Edit shelf form using component
This commit is contained in:
parent
bcbcdd5b3b
commit
502e235e59
2 changed files with 34 additions and 24 deletions
31
bookwyrm/templates/user/edit_shelf_form.html
Normal file
31
bookwyrm/templates/user/edit_shelf_form.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{% extends 'components/inline_form.html' %}
|
||||||
|
|
||||||
|
{% block header %}
|
||||||
|
Edit Shelf
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block form %}
|
||||||
|
<form name="edit-shelf" action="{{ shelf.local_path }}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="user" value="{{ request.user.id }}">
|
||||||
|
{% if shelf.editable %}
|
||||||
|
<div class="field">
|
||||||
|
<label class="label" for="id_name">Name:</label>
|
||||||
|
<input type="text" name="name" maxlength="100" class="input" required="true" value="{{ shelf.name }}" id="id_name">
|
||||||
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<input type="hidden" name="name" required="true" value="{{ shelf.name }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<div class="field has-addons">
|
||||||
|
<div class="control">
|
||||||
|
{% include 'snippets/privacy_select.html' with current=shelf.privacy %}
|
||||||
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<button class="button is-primary" type="submit">Update shelf</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
|
@ -49,34 +49,13 @@
|
||||||
</div>
|
</div>
|
||||||
{% if is_self %}
|
{% if is_self %}
|
||||||
<div class="column is-narrow">
|
<div class="column is-narrow">
|
||||||
{% include 'snippets/toggle/open_button.html' with text="Edit shelf" icon="pencil" class="is-clickable" controls_text="edit-shelf-form" %}
|
{% include 'snippets/toggle/open_button.html' with text="Edit shelf" icon="pencil" controls_text="edit-shelf-form" focus="edit-shelf-form-header" %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="hidden box mb-5" id="edit-shelf-form">
|
<div class="block">
|
||||||
<h2 class="title is-4">Edit shelf</h2>
|
{% include 'user/edit_shelf_form.html' with controls_text="edit-shelf-form" %}
|
||||||
<form name="create-shelf" action="{{ shelf.local_path }}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<input type="hidden" name="user" value="{{ request.user.id }}">
|
|
||||||
{% if shelf.editable %}
|
|
||||||
<div class="field">
|
|
||||||
<label class="label" for="id_name">Name:</label>
|
|
||||||
<input type="text" name="name" maxlength="100" class="input" required="true" value="{{ shelf.name }}" id="id_name">
|
|
||||||
</div>
|
|
||||||
{% else %}
|
|
||||||
<input type="hidden" name="name" required="true" value="{{ shelf.name }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<label class="label">
|
|
||||||
<p>Shelf privacy:</p>
|
|
||||||
{% include 'snippets/privacy_select.html' with no_label=True current=shelf.privacy %}
|
|
||||||
</label>
|
|
||||||
<div class="field is-grouped">
|
|
||||||
<button class="button is-primary" type="submit">Update shelf</button>
|
|
||||||
{% include 'snippets/toggle/close_button.html' with text="Cancel" controls_text="edit-shelf-form" %}
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="block">
|
<div class="block">
|
||||||
|
|
Loading…
Reference in a new issue