* Finish task#62937,62950
This commit is contained in:
@@ -4,8 +4,92 @@ $(function()
|
||||
{
|
||||
var show = $(this).is(':checked') ? 1 : 0;
|
||||
$.cookie('showTask', show, {expires:config.cookieLife, path:config.webRoot});
|
||||
if(show == 1) $('input#editExecution1').prop('disabled', true);
|
||||
if(show == 0) $('input#editExecution1').prop('disabled', false);
|
||||
window.location.reload();
|
||||
});
|
||||
if($.cookie('showTask') == 1) $('input#editExecution1').prop('disabled', true);
|
||||
|
||||
$('input#editExecution1').click(function()
|
||||
{
|
||||
var editExecution = $(this).is(':checked') ? 1 : 0;
|
||||
$.cookie('editExecution', editExecution, {expires:config.cookieLife, path:config.webRoot});
|
||||
if(editExecution == 1) $('input[name^="showTask"]').prop('disabled', true);
|
||||
if(editExecution == 0) $('input[name^="showTask"]').prop('disabled', false);
|
||||
|
||||
showEditCheckbox(editExecution);
|
||||
});
|
||||
if($.cookie('editExecution') == 1)
|
||||
{
|
||||
$('input#editExecution1').prop('checked', 'true');
|
||||
showEditCheckbox(true);
|
||||
$('input[name^="showTask"]').prop('disabled', true);
|
||||
}
|
||||
|
||||
$(document).on('click', ":checkbox[name^='executionIDList']", function()
|
||||
{
|
||||
var notCheckedLength = $(":checkbox[name^='executionIDList']:not(:checked)").length;
|
||||
var checkedLength = $(":checkbox[name^='executionIDList']:checked").length;
|
||||
|
||||
if(checkedLength > 0) $('#executionForm').addClass('has-row-checked');
|
||||
if(notCheckedLength == 0) $('.table-footer #checkAll').prop('checked', true);
|
||||
if(checkedLength == 0)
|
||||
{
|
||||
$('.table-footer #checkAll').prop('checked', false);
|
||||
$('#executionForm').removeClass('has-row-checked');
|
||||
}
|
||||
|
||||
var summary = checkedExecutions.replace('%s', checkedLength);
|
||||
if(cilentLang == "en" && checkedLength < 2) summary = summary.replace('items', 'item');
|
||||
var statistic = "<div id='executionsSummary' class='table-statistic'>" + summary + "</div>";
|
||||
if(checkedLength > 0)
|
||||
{
|
||||
$('#executionSummary').addClass('hidden');
|
||||
$('#executionsSummary').remove();
|
||||
$('.editCheckbox').after(statistic);
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#executionSummary').removeClass('hidden');
|
||||
$('#executionsSummary').addClass('hidden');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('click', ".table-footer #checkAll", function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
$(":checkbox[name^='executionIDList']").prop('checked', true);
|
||||
$('#executionForm').addClass('has-row-checked');
|
||||
var checkedLength = $(":checkbox[name^='executionIDList']:checked").length;
|
||||
var summary = checkedExecutions.replace('%s', checkedLength);
|
||||
if(cilentLang == "en" && checkedLength < 2) summary = summary.replace('items', 'item');
|
||||
var statistic = "<div id='executionsSummary' class='table-statistic'>" + summary + "</div>";
|
||||
$('#executionSummary').addClass('hidden');
|
||||
$('#executionsSummary').remove();
|
||||
$('.editCheckbox').after(statistic);
|
||||
$(this).next('label').addClass('hover');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(":checkbox[name^='executionIDList']").prop('checked', false);
|
||||
$('#executionForm').removeClass('has-row-checked');
|
||||
$('#executionSummary').removeClass('hidden');
|
||||
$('#executionsSummary').addClass('hidden');
|
||||
$(this).next('label').removeClass('hover');
|
||||
}
|
||||
});
|
||||
|
||||
/* Solve the problem that clicking the browser back button causes the checkbox to be selected by default. */
|
||||
setTimeout(function()
|
||||
{
|
||||
$(":checkbox[name^='executionIDList']").each(function()
|
||||
{
|
||||
$(this).prop('checked', false);
|
||||
});
|
||||
$('.table-footer #checkAll').prop('checked', false);
|
||||
}, 10);
|
||||
})
|
||||
|
||||
window.addEventListener('scroll', this.handleScroll)
|
||||
@@ -81,3 +165,40 @@ function getWindowHeight()
|
||||
{
|
||||
return document.compatMode == "CSS1Compat" ? windowHeight = document.documentElement.clientHeight : windowHeight = document.body.clientHeight
|
||||
}
|
||||
|
||||
function showEditCheckbox(show)
|
||||
{
|
||||
$('.project-type-label').each(function()
|
||||
{
|
||||
$this = $(this);
|
||||
$tr = $(this).closest('tr');
|
||||
executionID = $tr.attr('data-id');
|
||||
if(show)
|
||||
{
|
||||
var marginLeft = $tr.find('td:first').find('span.table-nest-icon').css('margin-left');
|
||||
|
||||
$tr.find('td:first').prepend("<div class='checkbox-primary'><input type='checkbox' name='executionIDList[]' value='" + executionID + "' id='executionIDList" + executionID + "'/><label for='executionIDList" + executionID + "'></lable></div>");
|
||||
$tr.find('td:first').find('.checkbox-primary').css('margin-left', marginLeft).css('width', '14');
|
||||
$tr.find('td:first').find('span.table-nest-icon').css('margin-left', '0');
|
||||
}
|
||||
else
|
||||
{
|
||||
var marginLeft = $tr.find('td:first').find('.checkbox-primary').css('margin-left');
|
||||
$tr.find('td:first').find('span.table-nest-icon').css('margin-left', marginLeft);
|
||||
$tr.find('td:first').find('[name^="executionIDList"]').parent().remove();
|
||||
}
|
||||
});
|
||||
if(show)
|
||||
{
|
||||
var tableFooter = "<div class='editCheckbox'><div class='checkbox-primary check-all'><input type='checkbox' id='checkAll' /><label>" + selectAll + "</label></div><div class='table-actions btn-toolbar'><button type='submit' class='btn'>" + edit + "</button></div></div>";
|
||||
$('#executionForm').attr('action', createLink('execution', 'batchEdit'));
|
||||
$('.table-footer').prepend(tableFooter).show();
|
||||
$('body').scroll();
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#executionForm').find('.editCheckbox').remove();
|
||||
if($('#executionForm .pager').length == 0) $('.table-footer').hide();
|
||||
$('#executionForm').removeAttr('action');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user