mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-18 07:33:57 +00:00
No-update mode for "want to read"
This commit is contained in:
parent
257c9854c2
commit
e6b785d731
3 changed files with 23 additions and 3 deletions
|
@ -177,6 +177,12 @@ let BookWyrm = new class {
|
|||
this.toggleCheckbox(checkbox, pressed);
|
||||
}
|
||||
|
||||
// Toggle form disabled, if appropriate
|
||||
let disable = trigger.dataset.disables;
|
||||
if (disable) {
|
||||
this.toggleDisabled(disable, !pressed);
|
||||
}
|
||||
|
||||
// Set focus, if appropriate.
|
||||
let focus = trigger.dataset.focusTarget;
|
||||
|
||||
|
@ -227,6 +233,17 @@ let BookWyrm = new class {
|
|||
document.getElementById(checkbox).checked = !!pressed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable a form element or fieldset
|
||||
*
|
||||
* @param {string} form_element - id of the element
|
||||
* @param {boolean} pressed - Is the trigger pressed?
|
||||
* @return {undefined}
|
||||
*/
|
||||
toggleDisabled(form_element, pressed) {
|
||||
document.getElementById(form_element).disabled = !!pressed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Give the focus to an element.
|
||||
* Only move the focus based on user interactions.
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
{% with 0|uuid as local_uuid %}
|
||||
<div class="is-flex is-justify-content-space-between">
|
||||
<label for="post_status_start_{{ uuid }}" data-controls="reading_content_{{ local_uuid }}_{{ uuid }}" data-controls-checkbox="post_status_start_{{ local_uuid }}_{{ uuid }}" aria-pressed="true">
|
||||
<input type="checkbox" name="post-status" class="checkbox" id="post_status_start_{{ local_uuid }}_{{ uuid }}" checked>
|
||||
<label for="post_status_{{ local_uuid }}_{{ uuid }}" data-controls="reading_content_{{ local_uuid }}_{{ uuid }}" data-controls-checkbox="post_status_{{ local_uuid }}_{{ uuid }}" data-disables="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}" aria-pressed="true">
|
||||
<input type="checkbox" name="post-status" class="checkbox" id="post_status_{{ local_uuid }}_{{ uuid }}" checked>
|
||||
{% trans "Post to feed" %}
|
||||
</label>
|
||||
<div class="is-hidden" id="hide_reading_content_{{ local_uuid }}_{{ uuid }}">
|
||||
|
@ -19,7 +19,9 @@
|
|||
|
||||
<div id="reading_content_{{ local_uuid }}_{{ uuid }}">
|
||||
<hr aria-hidden="true">
|
||||
{% include "snippets/reading_modals/form.html" %}
|
||||
<fieldset id="reading_content_fieldset_{{ local_uuid }}_{{ uuid }}">
|
||||
{% include "snippets/reading_modals/form.html" %}
|
||||
</fieldset>
|
||||
</div>
|
||||
{% endwith %}
|
||||
|
||||
|
|
|
@ -10,4 +10,5 @@ Want to Read "<em>{{ book_title }}</em>"
|
|||
|
||||
{% block modal-form-open %}
|
||||
<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post">
|
||||
{% csrf_token %}
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in a new issue