mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Improve comments because the logic is complicated and unintuitive
This commit is contained in:
parent
981741062b
commit
e4b24e17f3
|
@ -151,9 +151,9 @@
|
|||
//now re-populate the custom fields based on the previously saved values
|
||||
$('#custom_fields_content').find('input,select').each(function (index,elem) {
|
||||
if(transformed_oldvals[elem.name]) {
|
||||
{{-- If there already *is* is a previously input 'transformed_oldvals' handy,
|
||||
only overwrite with previously that value *IF* this is an edit of an existing item *OR*
|
||||
there is no new default custom field value coming from the model --}}
|
||||
{{-- If there already *is* is a previously-input 'transformed_oldvals' handy,
|
||||
overwrite with that previously-input value *IF* this is an edit of an existing item *OR*
|
||||
if there is no new default custom field value coming from the model --}}
|
||||
if({{ $item->id ? 'true' : 'false' }} || $(elem).val() == '') {
|
||||
$(elem).val(transformed_oldvals[elem.name]).trigger('change'); //the trigger is for select2-based objects, if we have any
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue