Skip to content

Commit cc8c206

Browse files
authored
Merge pull request #16630 from snipe/license_key_formatting
Fixed #16628 - added formatting for license keys
2 parents 33a9211 + 274c5fe commit cc8c206

File tree

15 files changed

+108
-48
lines changed

15 files changed

+108
-48
lines changed

app/Presenters/LicensePresenter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static function dataTableLayout()
4141
'searchable' => true,
4242
'sortable' => true,
4343
'title' => trans('admin/licenses/form.license_key'),
44-
'formatter' => 'licensesLinkFormatter',
44+
'formatter' => 'licenseKeyFormatter',
4545
], [
4646
'field' => 'expiration_date',
4747
'searchable' => true,

public/css/build/app.css

+7
Original file line numberDiff line numberDiff line change
@@ -1426,4 +1426,11 @@ th.text-right.text-padding-number-footer-cell {
14261426
padding-right: 20px !important;
14271427
white-space: nowrap;
14281428
}
1429+
code.single-line {
1430+
display: -webkit-box;
1431+
-webkit-box-orient: vertical;
1432+
-webkit-line-clamp: 1;
1433+
overflow: hidden;
1434+
max-width: 400px;
1435+
}
14291436

public/css/build/overrides.css

+7
Original file line numberDiff line numberDiff line change
@@ -1057,4 +1057,11 @@ th.text-right.text-padding-number-footer-cell {
10571057
padding-right: 20px !important;
10581058
white-space: nowrap;
10591059
}
1060+
code.single-line {
1061+
display: -webkit-box;
1062+
-webkit-box-orient: vertical;
1063+
-webkit-line-clamp: 1;
1064+
overflow: hidden;
1065+
max-width: 400px;
1066+
}
10601067

public/css/dist/all.css

+14
Original file line numberDiff line numberDiff line change
@@ -22761,6 +22761,13 @@ th.text-right.text-padding-number-footer-cell {
2276122761
padding-right: 20px !important;
2276222762
white-space: nowrap;
2276322763
}
22764+
code.single-line {
22765+
display: -webkit-box;
22766+
-webkit-box-orient: vertical;
22767+
-webkit-line-clamp: 1;
22768+
overflow: hidden;
22769+
max-width: 400px;
22770+
}
2276422771

2276522772

2276622773
.select2-container {
@@ -24304,4 +24311,11 @@ th.text-right.text-padding-number-footer-cell {
2430424311
padding-right: 20px !important;
2430524312
white-space: nowrap;
2430624313
}
24314+
code.single-line {
24315+
display: -webkit-box;
24316+
-webkit-box-orient: vertical;
24317+
-webkit-line-clamp: 1;
24318+
overflow: hidden;
24319+
max-width: 400px;
24320+
}
2430724321

public/mix-manifest.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"/js/build/app.js": "/js/build/app.js?id=607de09b70b83ef82a427e4b36341682",
33
"/css/dist/skins/skin-black-dark.css": "/css/dist/skins/skin-black-dark.css?id=06c13e817cc022028b3f4a33c0ca303a",
44
"/css/dist/skins/_all-skins.css": "/css/dist/skins/_all-skins.css?id=79aa889a1a6691013be6c342ca7391cd",
5-
"/css/build/overrides.css": "/css/build/overrides.css?id=f188c07f91348503bc38f4b6683993aa",
6-
"/css/build/app.css": "/css/build/app.css?id=7f6827b6d2149b8eab327d00e2dd66f0",
5+
"/css/build/overrides.css": "/css/build/overrides.css?id=01e77f7a486fd578a14760d045dcd80f",
6+
"/css/build/app.css": "/css/build/app.css?id=ad2974ecfed16a76dadd2f4ec34f8dac",
77
"/css/build/AdminLTE.css": "/css/build/AdminLTE.css?id=4ea0068716c1bb2434d87a16d51b98c9",
88
"/css/dist/skins/skin-yellow.css": "/css/dist/skins/skin-yellow.css?id=7b315b9612b8fde8f9c5b0ddb6bba690",
99
"/css/dist/skins/skin-yellow-dark.css": "/css/dist/skins/skin-yellow-dark.css?id=ea22079836a432d7f46a5d390c445e13",
@@ -19,7 +19,7 @@
1919
"/css/dist/skins/skin-blue.css": "/css/dist/skins/skin-blue.css?id=a82b065847bf3cd5d713c04ee8dc86c6",
2020
"/css/dist/skins/skin-blue-dark.css": "/css/dist/skins/skin-blue-dark.css?id=6ea836d8126de101081c49abbdb89417",
2121
"/css/dist/skins/skin-black.css": "/css/dist/skins/skin-black.css?id=76482123f6c70e866d6b971ba91de7bb",
22-
"/css/dist/all.css": "/css/dist/all.css?id=e6bb343692dc7255405be1793f149e0a",
22+
"/css/dist/all.css": "/css/dist/all.css?id=524d6fe45db04b3258c818dfb391fe2c",
2323
"/css/dist/signature-pad.css": "/css/dist/signature-pad.css?id=6a89d3cd901305e66ced1cf5f13147f7",
2424
"/css/dist/signature-pad.min.css": "/css/dist/signature-pad.min.css?id=6a89d3cd901305e66ced1cf5f13147f7",
2525
"/js/select2/i18n/af.js": "/js/select2/i18n/af.js?id=4f6fcd73488ce79fae1b7a90aceaecde",

resources/assets/less/overrides.less

+7
Original file line numberDiff line numberDiff line change
@@ -1175,3 +1175,10 @@ th.text-right.text-padding-number-footer-cell {
11751175
white-space: nowrap;
11761176
}
11771177

1178+
code.single-line {
1179+
display: -webkit-box;
1180+
-webkit-box-orient: vertical;
1181+
-webkit-line-clamp: 1;
1182+
overflow: hidden;
1183+
max-width: 400px;
1184+
}

resources/lang/en-US/general.php

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
'changepassword' => 'Change Password',
6363
'checkin' => 'Checkin',
6464
'checkin_from' => 'Checkin from',
65+
'checkin_note' => 'Checkin Note',
66+
'checkout_note' => 'Checkout Note',
6567
'checkout' => 'Checkout',
6668
'checkouts_count' => 'Checkouts',
6769
'checkins_count' => 'Checkins',

resources/views/account/view-assets.blade.php

+10-7
Original file line numberDiff line numberDiff line change
@@ -554,21 +554,24 @@ class="table table-striped snipe-table"
554554
}'>
555555
<thead>
556556
<tr>
557-
<th>{{ trans('general.name') }}</th>
558-
<th>{{ trans('admin/licenses/form.license_key') }}</th>
559-
<th>{{ trans('admin/licenses/form.to_name') }}</th>
560-
<th>{{ trans('admin/licenses/form.to_email') }}</th>
561-
<th>{{ trans('general.category') }}</th>
557+
<th class="col-md-2">{{ trans('general.name') }}</th>
558+
<th class="col-md-4">{{ trans('admin/licenses/form.license_key') }}</th>
559+
<th class="col-md-2">{{ trans('admin/licenses/form.to_name') }}</th>
560+
<th class="col-md-2">{{ trans('admin/licenses/form.to_email') }}</th>
561+
<th class="col-md-2">{{ trans('general.category') }}</th>
562562

563563
</tr>
564564
</thead>
565565
<tbody>
566566
@foreach ($user->licenses as $license)
567567
<tr>
568-
<td>{{ $license->name }}</td>
568+
<td>
569+
{{ $license->name }}
570+
</td>
569571
<td>
570572
@can('viewKeys', $license)
571-
{{ $license->serial }}
573+
<code class="single-line"><span class="js-copy-link" data-clipboard-target=".js-copy-key-{{ $license->id }}" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}"><span class="js-copy-key-{{ $license->id }}">{{ $license->serial }}</span></span></code>
574+
572575
@else
573576
------------
574577
@endcan

resources/views/hardware/view.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -1152,10 +1152,10 @@ class="form-inline"
11521152
<table class="table">
11531153
<thead>
11541154
<tr>
1155-
<th class="col-md-4">{{ trans('general.name') }}</th>
1156-
<th class="col-md-4"><span class="line"></span>{{ trans('admin/licenses/form.license_key') }}</th>
1157-
<th class="col-md-4"><span class="line"></span>{{ trans('admin/licenses/form.expiration') }}</th>
1158-
<th class="col-md-1"><span class="line"></span>{{ trans('table.actions') }}</th>
1155+
<th>{{ trans('general.name') }}</th>
1156+
<th><span class="line"></span>{{ trans('admin/licenses/form.license_key') }}</th>
1157+
<th><span class="line"></span>{{ trans('admin/licenses/form.expiration') }}</th>
1158+
<th><span class="line"></span>{{ trans('table.actions') }}</th>
11591159
</tr>
11601160
</thead>
11611161
<tbody>
@@ -1165,7 +1165,7 @@ class="form-inline"
11651165
<td><a href="{{ route('licenses.show', $seat->license->id) }}">{{ $seat->license->name }}</a></td>
11661166
<td>
11671167
@can('viewKeys', $seat->license)
1168-
{!! nl2br(e($seat->license->serial)) !!}
1168+
<code class="single-line"><span class="js-copy-link" data-clipboard-target=".js-copy-key-{{ $seat->id }}" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}"><span class="js-copy-key-{{ $seat->id }}">{{ $seat->license->serial }}</span></span></code>
11691169
@else
11701170
------------
11711171
@endcan

resources/views/licenses/checkin.blade.php

+24-14
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@section('content')
1717
<div class="row">
1818
<!-- left column -->
19-
<div class="col-md-7">
19+
<div class="col-md-8">
2020
<form class="form-horizontal" method="post" action="{{ route('licenses.checkin.save', ['licenseId'=>$licenseSeat->id, 'backTo'=>$backto] ) }}" autocomplete="off">
2121
{{csrf_field()}}
2222

@@ -28,31 +28,41 @@
2828

2929
<!-- license name -->
3030
<div class="form-group">
31-
<label class="col-sm-2 control-label">{{ trans('admin/hardware/form.name') }}</label>
32-
<div class="col-md-6">
31+
<label class="col-sm-3 control-label">{{ trans('admin/hardware/form.name') }}</label>
32+
<div class="col-md-8">
3333
<p class="form-control-static">{{ $licenseSeat->license->name }}</p>
3434
</div>
3535
</div>
3636

37+
<!-- Category -->
38+
<div class="form-group">
39+
<label class="col-sm-3 control-label">{{ trans('general.category') }}</label>
40+
<div class="col-md-9">
41+
<p class="form-control-static">{{ $licenseSeat->license->category->name }}</p>
42+
</div>
43+
</div>
44+
3745
<!-- Serial -->
46+
@can('viewKeys', $licenseSeat->license)
3847
<div class="form-group">
39-
<label class="col-sm-2 control-label">{{ trans('admin/licenses/form.license_key') }}</label>
40-
<div class="col-md-6">
48+
<label class="col-sm-3 control-label">{{ trans('admin/licenses/form.license_key') }}
49+
<i class="fa-regular fa-clipboard js-copy-link hidden-print" data-clipboard-target=".js-copy-key" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
50+
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
51+
</i>
52+
</label>
53+
<div class="col-md-8">
4154
<p class="form-control-static">
42-
@can('viewKeys', $licenseSeat->license)
43-
{{ $licenseSeat->license->serial }}
44-
@else
45-
------------
46-
@endcan
47-
</p>
55+
<code style="white-space: pre-wrap"><span class="js-copy-key">{{ $licenseSeat->license->serial }}</span></code>
56+
</p>
4857
</div>
4958
</div>
59+
@endcan
5060

5161
<!-- Note -->
5262
<div class="form-group {{ $errors->has('notes') ? 'error' : '' }}">
53-
<label for="note" class="col-md-2 control-label">{{ trans('admin/hardware/form.notes') }}</label>
54-
<div class="col-md-7">
55-
<textarea class="col-md-6 form-control" id="notes" name="notes"></textarea>
63+
<label for="note" class="col-md-3 control-label">{{ trans('general.checkin_note') }}</label>
64+
<div class="col-md-8">
65+
<textarea class="form-control" id="notes" name="notes" rows="5"></textarea>
5666
{!! $errors->first('notes', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
5767
</div>
5868
</div>

resources/views/licenses/checkout.blade.php

+12-11
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
@section('content')
1616
<div class="row">
1717
<!-- left column -->
18-
<div class="col-md-7">
18+
<div class="col-md-8">
1919
<form class="form-horizontal" method="post" action="" autocomplete="off">
2020
{{csrf_field()}}
2121

@@ -26,7 +26,7 @@
2626
<div class="box-body">
2727

2828

29-
<!-- Asset name -->
29+
<!-- License name -->
3030
<div class="form-group">
3131
<label class="col-sm-3 control-label">{{ trans('admin/hardware/form.name') }}</label>
3232
<div class="col-md-9">
@@ -42,18 +42,19 @@
4242
</div>
4343

4444
<!-- Serial -->
45+
@can('viewKeys', $license)
4546
<div class="form-group">
46-
<label class="col-sm-3 control-label">{{ trans('admin/licenses/form.license_key') }}</label>
47+
<label class="col-sm-3 control-label">{{ trans('admin/licenses/form.license_key') }}
48+
<i class="fa-regular fa-clipboard js-copy-link hidden-print" data-clipboard-target=".js-copy-key" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
49+
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
50+
</i>
51+
</label>
4752
<div class="col-md-9">
48-
<p class="form-control-static" style="word-wrap: break-word;">
49-
@can('viewKeys', $license)
50-
{{ $license->serial }}
51-
@else
52-
------------
53-
@endcan
53+
<p class="form-control-static"><code style="white-space: pre-wrap"><span class="js-copy-key">{{ $license->serial }}</span></code>
5454
</p>
5555
</div>
5656
</div>
57+
@endcan
5758

5859
@include ('partials.forms.checkout-selector', ['user_select' => 'true','asset_select' => 'true'])
5960

@@ -64,9 +65,9 @@
6465

6566
<!-- Note -->
6667
<div class="form-group {{ $errors->has('notes') ? 'error' : '' }}">
67-
<label for="note" class="col-md-3 control-label">{{ trans('admin/hardware/form.notes') }}</label>
68+
<label for="note" class="col-md-3 control-label">{{ trans('general.checkout_note') }}</label>
6869
<div class="col-md-8">
69-
<textarea class="col-md-6 form-control" id="notes" name="notes" style="width: 100%">{{ old('note') }}</textarea>
70+
<textarea class="col-md-6 form-control" id="notes" name="notes" rows="5">{{ old('note') }}</textarea>
7071
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
7172
</div>
7273
</div>

resources/views/licenses/edit.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<div class="form-group {{ $errors->has('serial') ? ' has-error' : '' }}">
3535
<label for="serial" class="col-md-3 control-label">{{ trans('admin/licenses/form.license_key') }}</label>
3636
<div class="col-md-7">
37-
<textarea class="form-control" type="text" name="serial" id="serial"{{ (Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}>{{ old('serial', $item->serial) }}</textarea>
37+
<textarea class="form-control" type="text" name="serial" id="serial" rows="5"{{ (Helper::checkIfRequired($item, 'serial')) ? ' required' : '' }}>{{ old('serial', $item->serial) }}</textarea>
3838
{!! $errors->first('serial', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
3939
</div>
4040
</div>

resources/views/licenses/view.blade.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@
124124
<div class="row">
125125
<div class="col-md-3">
126126
<strong>{{ trans('admin/licenses/form.license_key') }}</strong>
127+
<i class="fa-regular fa-clipboard js-copy-link" data-clipboard-target=".js-copy" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
128+
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
129+
</i>
127130
</div>
128131
<div class="col-md-9">
129132
@can('viewKeys', $license)
130-
<span class="js-copy">{!! nl2br(e($license->serial)) !!}</span>
131-
<i class="fa-regular fa-clipboard js-copy-link" data-clipboard-target=".js-copy" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}">
132-
<span class="sr-only">{{ trans('general.copy_to_clipboard') }}</span>
133-
</i>
133+
<code><span class="js-copy">{!! nl2br(e($license->serial)) !!}</span></code>
134134
@else
135135
------------
136136
@endcan

resources/views/partials/bootstrap-table.blade.php

+7
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,13 @@ function genericColumnObjLinkFormatter(destination) {
333333
};
334334
}
335335
336+
337+
function licenseKeyFormatter(value, row) {
338+
return '<code class="single-line"><span class="js-copy-link" data-clipboard-target=".js-copy-key-' + row.id + '" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}"><span class="js-copy-key-' + row.id + '">' + value + '</span></span></code>';
339+
}
340+
341+
342+
336343
function hardwareAuditFormatter(value, row) {
337344
return '<a href="{{ config('app.url') }}/hardware/audit/' + row.id + '/" class="btn btn-sm bg-yellow" data-tooltip="true" title="Audit this item">{{ trans('general.audit') }}</a>';
338345
}

resources/views/users/view.blade.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,8 @@ class="table table-striped snipe-table"
792792
</div><!-- /asset -->
793793

794794
<div class="tab-pane" id="licenses">
795+
796+
795797
<div class="table-responsive">
796798
<table
797799
data-cookie-id-table="userLicenseTable"
@@ -815,7 +817,7 @@ class="table table-striped snipe-table table-hover"
815817

816818
<thead>
817819
<tr>
818-
<th class="col-md-5">{{ trans('general.name') }}</th>
820+
<th>{{ trans('general.name') }}</th>
819821
<th>{{ trans('admin/licenses/form.license_key') }}</th>
820822
<th data-footer-formatter="sumFormatter" data-fieldname="purchase_cost">{{ trans('general.purchase_cost') }}</th>
821823
<th>{{ trans('admin/licenses/form.purchase_order') }}</th>
@@ -831,7 +833,7 @@ class="table table-striped snipe-table table-hover"
831833
</td>
832834
<td class="col-md-4">
833835
@can('viewKeys', $license)
834-
{!! $license->present()->serialUrl() !!}
836+
<code class="single-line"><span class="js-copy-link" data-clipboard-target=".js-copy-key-{{ $license->id }}" aria-hidden="true" data-tooltip="true" data-placement="top" title="{{ trans('general.copy_to_clipboard') }}"><span class="js-copy-key-{{ $license->id }}">{{ $license->serial }}</span></span></code>
835837
@else
836838
------------
837839
@endcan

0 commit comments

Comments
 (0)