mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-18 11:15:42 +00:00
Fixed table sticky-columns losing stickiness on tab change
This commit is contained in:
@ -535,6 +535,15 @@ class AssetPresenter extends Presenter
|
||||
return '<span class="'.(($this->deleted_at != '') ? 'deleted' : '').'">'.e($this->display_name).'</span>';
|
||||
}
|
||||
|
||||
public function formattedTagLink()
|
||||
{
|
||||
if (auth()->user()->can('view', ['\App\Models\Asset', $this])) {
|
||||
return '<a href="' . route('hardware.show', e($this->id)) . '" class="' . (($this->deleted_at != '') ? 'deleted' : '') . '">' . e($this->asset_tag) . '</a>';
|
||||
}
|
||||
|
||||
return '<span class="' . (($this->deleted_at != '') ? 'deleted' : '') . '">' . e($this->asset_tag) . '</span>';
|
||||
}
|
||||
|
||||
public function modelUrl()
|
||||
{
|
||||
if ($this->model->model) {
|
||||
|
||||
31
public/js/dist/all.js
vendored
31
public/js/dist/all.js
vendored
@ -75043,6 +75043,37 @@ $(function () {
|
||||
$('a[href="' + $(this).attr('href') + '"]').tab('show');
|
||||
});
|
||||
|
||||
// Bootstrap-table's fixed-columns extension computes the overlay widths
|
||||
// at init time. Tables inside a hidden tab pane initialize with a
|
||||
// zero-width container and the fixed left/right columns never recover
|
||||
// on their own once the pane becomes visible. Force a resetView on any
|
||||
// snipe-tables inside the newly-shown pane so fixed columns line up.
|
||||
$('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
|
||||
var pane = $(e.target).attr('href');
|
||||
if (!pane) return;
|
||||
$(pane).find('.snipe-table').each(function () {
|
||||
if ($(this).data('bootstrap.table')) {
|
||||
$(this).bootstrapTable('resetView');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Same story for viewport resizes: the fixed-columns overlay caches
|
||||
// widths from the initial layout and doesn't recompute when the window
|
||||
// width changes. Debounce so a drag-resize doesn't fire resetView on
|
||||
// every intermediate pixel.
|
||||
var snipeTableResizeTimer;
|
||||
$(window).on('resize', function () {
|
||||
clearTimeout(snipeTableResizeTimer);
|
||||
snipeTableResizeTimer = setTimeout(function () {
|
||||
$('.snipe-table').each(function () {
|
||||
if ($(this).data('bootstrap.table')) {
|
||||
$(this).bootstrapTable('resetView');
|
||||
}
|
||||
});
|
||||
}, 150);
|
||||
});
|
||||
|
||||
// ------------------------------------------------
|
||||
// End Deep Linking for Bootstrap tabs
|
||||
// ------------------------------------------------
|
||||
|
||||
2
public/js/dist/all.js.map
vendored
2
public/js/dist/all.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,5 +1,5 @@
|
||||
{
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=a366aab229a25906857b0e1982e23245",
|
||||
"/js/dist/all.js": "/js/dist/all.js?id=1c9827617dde6d225179399f2dddf8db",
|
||||
"/css/build/overrides.css": "/css/build/overrides.css?id=f4c1e4ba66d7312e87c28cd68b92d9a9",
|
||||
"/css/build/app.css": "/css/build/app.css?id=7527b2f5d51d9058d4cbe5a863160b99",
|
||||
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=ee0ed88465dd878588ed044eefb67723",
|
||||
|
||||
@ -534,6 +534,37 @@ $(function () {
|
||||
$('a[href="' + $(this).attr('href') + '"]').tab('show');
|
||||
});
|
||||
|
||||
// Bootstrap-table's fixed-columns extension computes the overlay widths
|
||||
// at init time. Tables inside a hidden tab pane initialize with a
|
||||
// zero-width container and the fixed left/right columns never recover
|
||||
// on their own once the pane becomes visible. Force a resetView on any
|
||||
// snipe-tables inside the newly-shown pane so fixed columns line up.
|
||||
$('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) {
|
||||
var pane = $(e.target).attr('href');
|
||||
if (!pane) return;
|
||||
$(pane).find('.snipe-table').each(function () {
|
||||
if ($(this).data('bootstrap.table')) {
|
||||
$(this).bootstrapTable('resetView');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Same story for viewport resizes: the fixed-columns overlay caches
|
||||
// widths from the initial layout and doesn't recompute when the window
|
||||
// width changes. Debounce so a drag-resize doesn't fire resetView on
|
||||
// every intermediate pixel.
|
||||
var snipeTableResizeTimer;
|
||||
$(window).on('resize', function () {
|
||||
clearTimeout(snipeTableResizeTimer);
|
||||
snipeTableResizeTimer = setTimeout(function () {
|
||||
$('.snipe-table').each(function () {
|
||||
if ($(this).data('bootstrap.table')) {
|
||||
$(this).bootstrapTable('resetView');
|
||||
}
|
||||
});
|
||||
}, 150);
|
||||
});
|
||||
|
||||
// ------------------------------------------------
|
||||
// End Deep Linking for Bootstrap tabs
|
||||
// ------------------------------------------------
|
||||
|
||||
@ -94,6 +94,7 @@ return [
|
||||
'component' => 'Component',
|
||||
'components' => 'Components',
|
||||
'complete' => 'Complete',
|
||||
'completed' => 'completed',
|
||||
'consumable' => 'Consumable',
|
||||
'consumables' => 'Consumables',
|
||||
'country' => 'Country',
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
'route' => null,
|
||||
'name' => 'maintenances',
|
||||
'fixed_right_number' => 1,
|
||||
'fixed_number' => null,
|
||||
'table_header' => trans('general.maintenances'),
|
||||
'export_filename' => 'export-maintenances-'.date('Y-m-d'),
|
||||
])
|
||||
@ -16,6 +17,7 @@
|
||||
|
||||
<x-table
|
||||
:fixed_right_number="$fixed_right_number"
|
||||
:fixed_number="$fixed_number"
|
||||
buttons="maintenanceButtons"
|
||||
api_url="{{ $route ?? route('api.maintenances.index') }}"
|
||||
:presenter="\App\Presenters\MaintenancesPresenter::dataTableLayout()"
|
||||
|
||||
@ -71,7 +71,7 @@ use Carbon\Carbon;
|
||||
<!-- definition list content -->
|
||||
<x-page-data>
|
||||
<x-data-row :label="trans('admin/hardware/form.tag')" copy_what="asset_tag">
|
||||
{{ $maintenance->asset?->asset_tag }}
|
||||
{!! $maintenance->asset?->present()->formattedTagLink !!}
|
||||
</x-data-row>
|
||||
|
||||
<x-data-row :label="trans('general.asset_model')" copy_what="model">
|
||||
|
||||
Reference in New Issue
Block a user