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);
|
this.toggleCheckbox(checkbox, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Toggle form disabled, if appropriate
|
||||||
|
let disable = trigger.dataset.disables;
|
||||||
|
if (disable) {
|
||||||
|
this.toggleDisabled(disable, !pressed);
|
||||||
|
}
|
||||||
|
|
||||||
// Set focus, if appropriate.
|
// Set focus, if appropriate.
|
||||||
let focus = trigger.dataset.focusTarget;
|
let focus = trigger.dataset.focusTarget;
|
||||||
|
|
||||||
|
@ -227,6 +233,17 @@ let BookWyrm = new class {
|
||||||
document.getElementById(checkbox).checked = !!pressed;
|
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.
|
* Give the focus to an element.
|
||||||
* Only move the focus based on user interactions.
|
* Only move the focus based on user interactions.
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
|
|
||||||
{% with 0|uuid as local_uuid %}
|
{% with 0|uuid as local_uuid %}
|
||||||
<div class="is-flex is-justify-content-space-between">
|
<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">
|
<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_start_{{ local_uuid }}_{{ uuid }}" checked>
|
<input type="checkbox" name="post-status" class="checkbox" id="post_status_{{ local_uuid }}_{{ uuid }}" checked>
|
||||||
{% trans "Post to feed" %}
|
{% trans "Post to feed" %}
|
||||||
</label>
|
</label>
|
||||||
<div class="is-hidden" id="hide_reading_content_{{ local_uuid }}_{{ uuid }}">
|
<div class="is-hidden" id="hide_reading_content_{{ local_uuid }}_{{ uuid }}">
|
||||||
|
@ -19,7 +19,9 @@
|
||||||
|
|
||||||
<div id="reading_content_{{ local_uuid }}_{{ uuid }}">
|
<div id="reading_content_{{ local_uuid }}_{{ uuid }}">
|
||||||
<hr aria-hidden="true">
|
<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>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
|
|
|
@ -10,4 +10,5 @@ Want to Read "<em>{{ book_title }}</em>"
|
||||||
|
|
||||||
{% block modal-form-open %}
|
{% block modal-form-open %}
|
||||||
<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post">
|
<form name="shelve" action="{% url 'reading-status' 'want' book.id %}" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue