mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-23 11:43:47 -08:00
Fixed #4098 - autolink URL and email addresses in listing
This commit is contained in:
parent
22fdd05314
commit
d98d06377e
|
@ -86,24 +86,21 @@ class AssetsTransformer
|
|||
$decrypted = \App\Helpers\Helper::gracefulDecrypt($field,$asset->{$field->convertUnicodeDbSlug()});
|
||||
$value = (Gate::allows('superadmin')) ? $decrypted : strtoupper(trans('admin/custom_fields/general.encrypted'));
|
||||
|
||||
// $fields_array = [$field->convertUnicodeDbSlug() => $value];
|
||||
|
||||
|
||||
$fields_array[$field->name] = [
|
||||
'field' => $field->convertUnicodeDbSlug(),
|
||||
'value' => $value
|
||||
'value' => $value,
|
||||
'field_format' => $field->format,
|
||||
];
|
||||
|
||||
} else {
|
||||
$fields_array[$field->name] = [
|
||||
'field' => $field->convertUnicodeDbSlug(),
|
||||
'value' => $asset->{$field->convertUnicodeDbSlug()}
|
||||
'value' => $asset->{$field->convertUnicodeDbSlug()},
|
||||
'field_format' => $field->format,
|
||||
];
|
||||
//$fields_array = [$field->convertUnicodeDbSlug() => $asset->{$field->convertUnicodeDbSlug()}];
|
||||
|
||||
|
||||
}
|
||||
//array += $fields_array;
|
||||
$array['custom_fields'] = $fields_array;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -354,7 +354,18 @@
|
|||
// (for example, the locked icon for encrypted fields)
|
||||
var field_column_plain = field_column.replace(/<(?:.|\n)*?> ?/gm, '');
|
||||
if ((row.custom_fields) && (row.custom_fields[field_column_plain])) {
|
||||
|
||||
// If the field type needs special formatting, do that here
|
||||
if ((row.custom_fields[field_column_plain].field_format) && (row.custom_fields[field_column_plain].value)) {
|
||||
if (row.custom_fields[field_column_plain].field_format=='URL') {
|
||||
return '<a href="' + row.custom_fields[field_column_plain].value + '" target="_blank" rel="noopener">' + row.custom_fields[field_column_plain].value + '</a>';
|
||||
} else if (row.custom_fields[field_column_plain].field_format=='EMAIL') {
|
||||
return '<a href="mailto:' + row.custom_fields[field_column_plain].value + '">' + row.custom_fields[field_column_plain].value + '</a>';
|
||||
}
|
||||
}
|
||||
console.log('NOT a URL!');
|
||||
return row.custom_fields[field_column_plain].value;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue