* Merge insensitive refresh custom forms into one method.
This commit is contained in:
@@ -13,69 +13,11 @@ $(function()
|
||||
/* Implement a custom form without feeling refresh. */
|
||||
$('#formSettingForm .btn-primary').click(function()
|
||||
{
|
||||
var fields = '';
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
|
||||
{
|
||||
fields += ',' + $(this).val();
|
||||
});
|
||||
|
||||
var link = createLink('custom', 'ajaxSaveCustomFields', 'module=bug§ion=custom&key=batchCreateFields');
|
||||
$.post(link, {'fields' : fields}, function()
|
||||
{
|
||||
showFields = fields;
|
||||
showCheckedFields(fields);
|
||||
$('#formSetting').parent().removeClass('open');
|
||||
|
||||
if($('#batchCreateForm table thead tr th.c-title').width() < 150) $titleCol.width(150);
|
||||
|
||||
var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
|
||||
$('.form-actions').attr('colspan', fieldCount);
|
||||
|
||||
if(fieldCount > 10)
|
||||
{
|
||||
$('#batchCreateForm > .table-responsive').removeClass('scroll-none');
|
||||
$('#batchCreateForm > .table-responsive').css('overflow', 'auto');
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#batchCreateForm > .table-responsive').addClass('scroll-none');
|
||||
$('#batchCreateForm > .table-responsive').css('overflow', 'visible');
|
||||
}
|
||||
});
|
||||
|
||||
saveCustomFields('batchCreateFields', 10, $titleCol, 150);
|
||||
return false;
|
||||
});
|
||||
})
|
||||
|
||||
/**
|
||||
* Show checked fields.
|
||||
*
|
||||
* @param string fields
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function showCheckedFields(fields)
|
||||
{
|
||||
var fieldList = ',' + fields + ',';
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
|
||||
{
|
||||
var field = ',' + $(this).val() + ',';
|
||||
var $field = $('[name^=' + $(this).val() + ']');
|
||||
var required = ',' + requiredFields + ',';
|
||||
var $fieldBox = $('.' + $(this).val() + 'Box' );
|
||||
if(fieldList.indexOf(field) >= 0 || required.indexOf(field) >= 0)
|
||||
{
|
||||
$fieldBox.removeClass('hidden');
|
||||
$field.removeAttr('disabled');
|
||||
}
|
||||
else if(!$fieldBox.hasClass('hidden'))
|
||||
{
|
||||
$fieldBox.addClass('hidden');
|
||||
$field.attr('disabled', true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Set opened builds.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user