les paramètres de récurrence ne sont affichés que s'ils existent
Cf #224
This commit is contained in:
parent
d46ebeae3b
commit
256fed1e2e
@ -254,7 +254,14 @@ class EventForm(GroupFormMixin, ModelForm):
|
||||
self.fields['end_day'].group_id = 'end'
|
||||
self.fields['end_time'].group_id = 'end'
|
||||
|
||||
self.add_group('recurrences', _('This is a recurring event'), maskable=True, default_masked=True)
|
||||
self.add_group('recurrences',
|
||||
_('This is a recurring event'),
|
||||
maskable=True,
|
||||
default_masked=not (self.instance and
|
||||
self.instance.recurrences and
|
||||
self.instance.recurrences.rrules and
|
||||
len(self.instance.recurrences.rrules) > 0))
|
||||
|
||||
self.fields['recurrences'].group_id = 'recurrences'
|
||||
|
||||
self.add_group('details', _('Details'))
|
||||
|
@ -6,7 +6,13 @@
|
||||
{% for group, fields in form.fields_by_group %}
|
||||
<div {% if group.maskable %}class="maskable_group"{% endif %} id="group_{{ group.id }}">
|
||||
{% if group.maskable %}
|
||||
<input class="toggle_body" type="checkbox" id="maskable_group_{{ group.id }}" name="group_{{ group.id }}"><label for="maskable_group_{{ group.id }}">{{ group.label }}</label>
|
||||
<input
|
||||
class="toggle_body"
|
||||
type="checkbox"
|
||||
id="maskable_group_{{ group.id }}"
|
||||
name="group_{{ group.id }}"
|
||||
{% if not group.default_masked %}checked{% endif %}
|
||||
><label for="maskable_group_{{ group.id }}">{{ group.label }}</label>
|
||||
{% endif %}
|
||||
<div class="error_group">
|
||||
{% for field in fields %}
|
||||
@ -36,7 +42,9 @@
|
||||
<script>
|
||||
const maskables = document.querySelectorAll('.maskable_group');
|
||||
maskables.forEach(function (item) {
|
||||
item.querySelector('.body_group').classList.add('closed');
|
||||
if (!item.checked) {
|
||||
item.querySelector('.body_group').classList.add('closed');
|
||||
}
|
||||
console.log('item ' + item);
|
||||
|
||||
item.querySelector('.toggle_body').addEventListener('change', (event) => {
|
||||
|
Loading…
Reference in New Issue
Block a user