#PHRAS-610 #time 2h

WIP
This commit is contained in:
Jean-Yves Gaulier
2015-07-29 19:05:11 +02:00
parent 41758fe341
commit 4090164896
2 changed files with 20 additions and 44 deletions

View File

@@ -3,15 +3,16 @@
{% for base in search_datas['bases'] %}
{% set sbas_id = base['sbas_id'] %}
<div class="sbas_list sbas_{{sbas_id}}" style="margin-bottom: 10px;">
<input type="checkbox" name="reference" value="{{sbas_id}}"/>
<input type="hidden" name="reference" value="{{sbas_id}}"/>
<div class="clksbas">
<span onclick="deploy(this, '.sbascont_{{sbas_id}}' );return false;" class="deployer_opened" ></span>
<label style="display: inline" class="checkbox" for="sbasChkr_{{sbas_id}}_{{unique_id}}" onclick="clksbas({{sbas_id}}, $('#sbasChkr_{{sbas_id}}_{{unique_id}}')); return false;">
<span onclick="deploy(this, '.sbascont_{{sbas_id}}' );" class="deployer_opened" ></span>
<input type="checkbox" checked xstyle="display: none;" id="sbasChkr_{{sbas_id}}_{{unique_id}}" class="sbasChkr_{{sbas_id}}"
onchange="clksbas(this, {{sbas_id}});" />
<label style="display: inline" class="checkbox" for="sbasChkr_{{sbas_id}}_{{unique_id}}">
<span>{{sbas_id|sbas_labels(app)}}</span>
<span class="infos_sbas_{{sbas_id}}">
{{base["collections"]|length}}/{{base['collections']|length}}
</span>
<input type="checkbox" checked style="display: none;" id="sbasChkr_{{sbas_id}}_{{unique_id}}" class="sbasChkr_{{sbas_id}}" />
</label>
</div>
<div class="sbascont sbascont_{{sbas_id}}" style="-moz-column-width:150px; -webkit-column-width: 150px; -moz-column-gap: 20px; -webkit-column-gap: 20px;">
@@ -23,13 +24,12 @@
<tr>
<td>
<input class="ck_{{collection["base_id"]}} checkbas" style="*margin-top:-18px;"
onclick="cancelEvent(event);return false;"
onmousedown="infoSbas(this, {{sbas_id}}, false, event); return false;"
onchange="infoSbas(this, {{sbas_id}});checkFilters(true);"
id="ck_{{collection["base_id"]}}_{{unique_id}}" type="checkbox"
name="bases[]" value="{{collection["base_id"]}}" {% if collection["selected"] %}checked="checked"{% endif %} />
</td>
<td>
<label style="line-height: 18px;" onclick="infoSbas($('#ck_{{base_id}}_{{unique_id}}'),{{sbas_id}}, false, event); return false;"
<label style="line-height: 18px;"
for="ck_{{base_id}}_{{unique_id}}" class="ck_{{base_id}} {% if collection["selected"] %}selected{% endif %} checkbox inline">
{{base_id|get_collection_logo(app)|raw}} {{base_id|bas_labels(app)}}
</label>

View File

@@ -156,12 +156,12 @@ function is_shift_key(event) {
function checkBases(bool) {
$('form.phrasea_query .sbas_list').each(function () {
var id = $(this).find('input[name=reference]:first').val();
var sbas_id = $(this).find('input[name=reference]:first').val();
if (bool)
$(this).find(':checkbox').attr('checked', 'checked');
else
$(this).find(':checkbox').removeAttr('checked');
infoSbas(false, id, true, false);
infoSbas(null, sbas_id);
});
if (bool) {
@@ -2750,58 +2750,34 @@ function deploy(deployer, todeploy_selector)
}
}
function clksbas(num, el) {
var bool = true;
function clksbas(el, sbas_id) {
var bool = $(el).attr('checked');
if (el.attr('checked')) {
bool = false;
$('.sbasChkr_' + num).removeAttr('checked');
}
else {
$('.sbasChkr_' + num).attr('checked', 'checked');
}
$.each($('.sbascont_' + num + ' :checkbox'), function () {
$.each($('.sbascont_' + sbas_id + ' :checkbox'), function () {
this.checked = bool;
});
if (bool) {
$('.sbascont_' + num + ' label').addClass('selected');
$('.sbascont_' + sbas_id + ' label').addClass('selected');
}
else {
$('.sbascont_' + num + ' label').removeClass('selected');
$('.sbascont_' + sbas_id + ' label').removeClass('selected');
}
infoSbas(false, num, false, false);
}
function cancelEvent(event) {
if (event.stopPropagation)
event.stopPropagation();
if (event.preventDefault)
event.preventDefault();
event.cancelBubble = true;
return false;
infoSbas(null, sbas_id);
checkFilters(true);
}
function infoSbas(el, num, donotfilter, event) {
if (event)
cancelEvent(event);
function infoSbas(el, sbas_id) {
if (el) {
var item = $('input.ck_' + $(el).val());
var label = $('label.ck_' + $(el).val());
if ($(el).attr('checked')) {
label.removeClass('selected');
item.removeAttr('checked');
label.addClass('selected');
}
else {
label.addClass('selected');
item.attr('checked', 'checked');
label.removeClass('selected');
}
}
$('.infos_sbas_' + num).empty().append($('.basChild_' + num + ':first .checkbas:checked').length + '/' + $('.basChild_' + num + ':first .checkbas').length);
if (donotfilter !== true)
checkFilters(true);
$('.infos_sbas_' + sbas_id).empty().append($('.basChild_' + sbas_id + ':first .checkbas:checked').length + '/' + $('.basChild_' + sbas_id + ':first .checkbas').length);
}
function advSearch(event) {