Merge pull request #16287 from uberbrady/better_hover_titles

Fixes: [sc-28423] Better tooltips on lists, Bootstrap style
This commit is contained in:
snipe 2025-02-22 14:24:02 +00:00 committed by GitHub
commit 346aeeda71
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 86 additions and 58 deletions

View file

@ -21,6 +21,7 @@ class AssetPresenter extends Presenter
[ [
'field' => 'checkbox', 'field' => 'checkbox',
'checkbox' => true, 'checkbox' => true,
'titleTooltip' => 'Toggle Select All' //FIXME - translate.
], [ ], [
'field' => 'id', 'field' => 'id',
'searchable' => false, 'searchable' => false,

View file

@ -65,13 +65,13 @@
paginationLastText: "{{ trans('general.last') }}", paginationLastText: "{{ trans('general.last') }}",
paginationPreText: "{{ trans('general.previous') }}", paginationPreText: "{{ trans('general.previous') }}",
paginationNextText: "{{ trans('general.next') }}", paginationNextText: "{{ trans('general.next') }}",
pageList: ['10','20', '30','50','100','150','200'{!! ((config('app.max_results') > 200) ? ",'500'" : '') !!}{!! ((config('app.max_results') > 500) ? ",'".config('app.max_results')."'" : '') !!}], pageList: ['10', '20', '30', '50', '100', '150', '200'{!! ((config('app.max_results') > 200) ? ",'500'" : '') !!}{!! ((config('app.max_results') > 500) ? ",'".config('app.max_results')."'" : '') !!}],
pageSize: {{ (($snipeSettings->per_page!='') && ($snipeSettings->per_page > 0)) ? $snipeSettings->per_page : 20 }}, pageSize: {{ (($snipeSettings->per_page!='') && ($snipeSettings->per_page > 0)) ? $snipeSettings->per_page : 20 }},
paginationVAlign: 'both', paginationVAlign: 'both',
queryParams: function (params) { queryParams: function (params) {
var newParams = {}; var newParams = {};
for(var i in params) { for (var i in params) {
if(!keyBlocked(i)) { // only send the field if it's not in blockedFields if (!keyBlocked(i)) { // only send the field if it's not in blockedFields
newParams[i] = params[i]; newParams[i] = params[i];
} }
} }
@ -92,10 +92,37 @@
}, },
locale: '{{ app()->getLocale() }}', locale: '{{ app()->getLocale() }}',
exportOptions: export_options, exportOptions: export_options,
exportTypes: ['xlsx', 'excel', 'csv', 'pdf','json', 'xml', 'txt', 'sql', 'doc' ], exportTypes: ['xlsx', 'excel', 'csv', 'pdf', 'json', 'xml', 'txt', 'sql', 'doc'],
onLoadSuccess: function () { onLoadSuccess: function () { // possible 'fixme'? this might be for contents, not for headers?
$('[data-tooltip="true"]').tooltip(); // Needed to attach tooltips after ajax call $('[data-tooltip="true"]').tooltip(); // Needed to attach tooltips after ajax call
}, },
onPostHeader: function () {
var lookup = {};
var lookup_initialized = false;
var ths = $('th');
ths.each(function (index, element) {
th = $(element);
//only populate the lookup table once; don't need to keep doing it.
if (!lookup_initialized) {
// th -> tr -> thead -> table
var table = th.parent().parent().parent()
var column_data = table.data('columns')
for (var column in column_data) {
lookup[column_data[column].field] = column_data[column].titleTooltip;
}
lookup_initialized = true
}
field = th.data('field'); // find fieldname this column refers to
title = lookup[field];
if (title) {
th.attr('data-toggle', 'tooltip');
th.attr('data-placement', 'top');
// th.attr('title', title) //this causes 'double-titles' which looks gross
th.tooltip({container: 'body', title: title});
}
})
},
formatNoMatches: function () { formatNoMatches: function () {
return '{{ trans('table.no_matching_records') }}'; return '{{ trans('table.no_matching_records') }}';
} }