* Finish task #58554.
This commit is contained in:
@@ -2,18 +2,18 @@
|
||||
$(function()
|
||||
{
|
||||
removeDitto();
|
||||
if($('th.c-name').width() < 200) $('th.c-name').width(200);
|
||||
if($('th.c-name').width() < 165) $('th.c-name').width(165);
|
||||
if(taskConsumed > 0) bootbox.alert(addChildTask);
|
||||
$('#customField').on('click', function(){$('#tableBody .chosen-with-drop').removeClass('chosen-with-drop chosen-container-active')});
|
||||
|
||||
$('#customField').click(function()
|
||||
{
|
||||
disabledRequireFields();
|
||||
hiddenRequireFields();
|
||||
});
|
||||
|
||||
/* Implement a custom form without feeling refresh. */
|
||||
$('#formSettingForm .btn-primary').click(function()
|
||||
{
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input').removeAttr('disabled');
|
||||
var fields = '';
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
|
||||
{
|
||||
@@ -24,8 +24,12 @@ $(function()
|
||||
$.post(link, {'fields' : fields}, function()
|
||||
{
|
||||
checkedShowFields(fields);
|
||||
disabledRequireFields();
|
||||
$('#formSetting').parent().removeClass('open');
|
||||
|
||||
var fieldCount = $('#batchCreateForm .table thead>tr>th:visible').length;
|
||||
$('.form-actions').attr('colspan', fieldCount);
|
||||
|
||||
if($('th.c-name').width() < 165) $('th.c-name').width(165);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
||||
@@ -33,16 +33,17 @@ function checkedShowFields(fields)
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
|
||||
{
|
||||
var field = ',' + $(this).val() + ',';
|
||||
var $field = $('#' + $(this).val());
|
||||
var $fieldBox = $('.' + $(this).val() + 'Box' );
|
||||
if(fieldList.indexOf(field) >= 0)
|
||||
{
|
||||
|
||||
$(this).attr('checked', true);
|
||||
$fieldBox.removeClass('hidden');
|
||||
$field.removeAttr('disabled');
|
||||
}
|
||||
else
|
||||
else if(!$fieldBox.hasClass('hidden'))
|
||||
{
|
||||
if(!$fieldBox.hasClass('hidden')) $fieldBox.addClass('hidden');
|
||||
$fieldBox.addClass('hidden');
|
||||
$field.attr('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,17 +67,17 @@ function checkedShowFields(fields)
|
||||
}
|
||||
|
||||
/**
|
||||
* Disabled require field.
|
||||
* Hidden require field.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function disabledRequireFields()
|
||||
function hiddenRequireFields()
|
||||
{
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input').each(function()
|
||||
{
|
||||
var field = ',' + $(this).val() + ',';
|
||||
var required = ',' + requiredFields + ',';
|
||||
if(required.indexOf(field) >= 0) $(this).attr('disabled', 'disabled');
|
||||
if(required.indexOf(field) >= 0) $(this).closest('div').addClass('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2,12 +2,11 @@ $(function()
|
||||
{
|
||||
$('#customField').click(function()
|
||||
{
|
||||
disabledRequireFields();
|
||||
hiddenRequireFields();
|
||||
});
|
||||
|
||||
$('#formSettingForm .btn-primary').click(function()
|
||||
{
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input').removeAttr('disabled');
|
||||
var fields = '';
|
||||
$('#formSettingForm > .checkboxes > .checkbox-primary > input:checked').each(function()
|
||||
{
|
||||
@@ -18,7 +17,6 @@ $(function()
|
||||
$.post(link, {'fields' : fields}, function()
|
||||
{
|
||||
checkedShowFields(fields);
|
||||
disabledRequireFields();
|
||||
$('#formSetting').parent().removeClass('open');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user