Merge pull request #2855 from filipx/PHRAS-2327_report_refacto_41

PHRAS-2327_report_refacto_41 base collections fix
This commit is contained in:
Nicolas Maillat
2018-12-13 14:56:22 +00:00
committed by GitHub
2 changed files with 42 additions and 24 deletions

View File

@@ -52,20 +52,31 @@ $(document).ready(function () {
$list.hide();
});
$(".form2 .select-options li").click(function(e) {
e.stopPropagation();
var value = $(this).attr('rel'),
form = $(this).closest('form');
$(".form2 .collist", form).hide();
$(".form2 .collist-" + value, form).show();
});
$(document).click(function() {
$styledSelect.removeClass('active');
$list.hide();
});
});
$(".form2 .select-options li").click(function(e) {
e.stopPropagation();
var $this = $(this),
value = $this.attr('rel'),
form = $this.closest('form');
$(".form2 .collist", form).hide();
$(".form2 .collist-" + value, form).show();
$(".form2 .collist", form).each(function(i, list) {
if ($(list).is(':visible') === true) {
$(list).find('input').prop('checked', true);
}
else {
$(list).find('input').prop('checked', false);
}
});
});
$('.form2 .collist').each(function() {
var $this = $(this),
form = $this.closest('form'),
@@ -73,6 +84,13 @@ $(document).ready(function () {
;
$this.hide();
$(".collist-" + i, form).show();
if ($this.hasClass('collist-1')) {
$this.find('input').prop('checked', true);
}
else {
$this.find('input').prop('checked', false);
}
});
$('.form2').each(function() {

View File

@@ -61,30 +61,30 @@
<div class="form3 form_content">
<div class="form_titre">{{ "report:: 4 - Fields" | trans }}</div>
<div class="collist">
{% for sbas_id,databox in granted_bases %}
<div class="collist collist-{{ sbas_id }}">
<div class="collist_buttons">
<button class="select-all btn btn-mini" data-target_selector="#chkfld-records input:checkbox">
<button class="select-all btn btn-mini" data-target_selector="#chkfld-records-{{ sbas_id }} input:checkbox">
{% trans %}Select all{% endtrans %}
</button>
<button class="unselect-all btn btn-mini" data-target_selector="#chkfld-records input:checkbox">
<button class="unselect-all btn btn-mini" data-target_selector="#chkfld-records-{{ sbas_id }} input:checkbox">
{% trans %}Deselect all{% endtrans %}
</button>
</div>
<ul id="chkfld-records" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
{% for sbas_id,databox in granted_bases %}
{% for meta in databox.metas %}
<li>
<label class="checkbox custom_checkbox_label">
<input name="meta[]" checked="checked" type="checkbox" value="{{ meta }}">
<span class="custom_checkbox"></span>
{{ meta }}
</label>
</li>
{% endfor %}
{% endfor %}
<ul id="chkfld-records-{{ sbas_id }}" style="max-height: 150px; overflow-y: auto; overflow-x: hidden;">
{% for meta in databox.metas %}
<li>
<label class="checkbox custom_checkbox_label">
<input name="meta[]" checked="checked" type="checkbox" value="{{ meta }}">
<span class="custom_checkbox"></span>
{{ meta }}
</label>
</li>
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
{% endblock form_records %}
</form>