Files
EasySoft-ZenTaoPMS/module/testcase/js/browse.js
T
2016-11-24 16:55:39 +08:00

54 lines
2.0 KiB
JavaScript

/* Swtich to search module. */
function browseBySearch(active)
{
$('#querybox').removeClass('hidden');
$('.divider').addClass('hidden');
$('#' + active + 'Tab').removeClass('active');
$('#bysearchTab').addClass('active');
$('#bymoduleTab').removeClass('active');
}
/**
* Confirm batch delete cases.
*
* @param string $actionLink
* @access public
* @return void
*/
function confirmBatchDelete(actionLink)
{
if(confirm(batchDelete)) setFormAction(actionLink);
return false;
}
$(document).ready(function()
{
if(browseType == 'bysearch') ajaxGetSearchForm();
setTimeout(function(){fixedTfootAction('#batchForm')}, 100);
setTimeout(function(){fixedTheadOfList('#caseList')}, 100);
$('.dropdown-menu .with-search .menu-search').click(function(e)
{
e.stopPropagation();
return false;
}).on('keyup change paste', 'input', function()
{
var val = $(this).val().toLowerCase();
var $options = $(this).closest('.dropdown-menu.with-search').find('.option');
if(val == '') return $options.removeClass('hide');
$options.each(function()
{
var $option = $(this);
$option.toggleClass('hide', $option.text().toString().toLowerCase().indexOf(val) < 0 && $option.data('key').toString().toLowerCase().indexOf(val) < 0);
});
});
setModal4List('runCase', 'caseList');
var treeMaxHeight = document.documentElement.clientHeight - $('#header').height() - $('#featurebar').height() - $('#footer').height() - $('#treebox .side-body .panel-heading').height() - 120;
if($('#treebox').height() > $('#caseList').height()) treeMaxHeight -= 20;
$('#treebox .side-body .panel-body').children().each(function(){if(!$(this).hasClass('tree')) treeMaxHeight -= $(this).height()});
$('#treebox .tree').css({'max-height':treeMaxHeight, 'overflow-y': 'auto', 'overflow-x':'hidden'})
if(moduleID > 0)$('#treebox .tree').scrollTop($('#treebox .tree #module' + moduleID).offset().top - $('#treebox .tree li[data-id="1"]').offset().top);
});