Merge pull request #15242 from Godmartinz/shortcut_option
Some checks are pending
Crowdin Action / upload-sources-to-crowdin (push) Waiting to run
Docker images (Alpine) / docker (push) Waiting to run
Docker images / docker (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.1) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.2) (push) Waiting to run
Tests in MySQL / PHP ${{ matrix.php-version }} (8.3) (push) Waiting to run
Tests in SQLite / PHP ${{ matrix.php-version }} (8.1.1) (push) Waiting to run

Fixed shortcuts to be optional now
This commit is contained in:
snipe 2024-08-07 18:56:27 +01:00 committed by GitHub
commit ef183f256c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 58 additions and 13 deletions

View file

@ -324,6 +324,7 @@ class SettingsController extends Controller
$setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0'); $setting->full_multiple_companies_support = $request->input('full_multiple_companies_support', '0');
$setting->unique_serial = $request->input('unique_serial', '0'); $setting->unique_serial = $request->input('unique_serial', '0');
$setting->shortcuts_enabled = $request->input('shortcuts_enabled', '0');
$setting->show_images_in_email = $request->input('show_images_in_email', '0'); $setting->show_images_in_email = $request->input('show_images_in_email', '0');
$setting->show_archived_in_list = $request->input('show_archived_in_list', '0'); $setting->show_archived_in_list = $request->input('show_archived_in_list', '0');
$setting->dashboard_message = $request->input('dashboard_message'); $setting->dashboard_message = $request->input('dashboard_message');

View file

@ -0,0 +1,27 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('settings', function (Blueprint $table) {
$table->boolean('shortcuts_enabled')->default(false);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('settings', function (Blueprint $table) {
$table->dropColumn('shortcuts_enabled');
});
}
};

View file

@ -218,6 +218,8 @@ return [
'webhook_integration_help' => ':app integration is optional, however the endpoint and channel are required if you wish to use it. To configure :app integration, you must first <a href=":webhook_link" target="_new" rel="noopener">create an incoming webhook</a> on your :app account. Click on the <strong>Test :app Integration</strong> button to confirm your settings are correct before saving. ', 'webhook_integration_help' => ':app integration is optional, however the endpoint and channel are required if you wish to use it. To configure :app integration, you must first <a href=":webhook_link" target="_new" rel="noopener">create an incoming webhook</a> on your :app account. Click on the <strong>Test :app Integration</strong> button to confirm your settings are correct before saving. ',
'webhook_integration_help_button' => 'Once you have saved your :app information, a test button will appear.', 'webhook_integration_help_button' => 'Once you have saved your :app information, a test button will appear.',
'webhook_test_help' => 'Test whether your :app integration is configured correctly. YOU MUST SAVE YOUR UPDATED :app SETTINGS FIRST.', 'webhook_test_help' => 'Test whether your :app integration is configured correctly. YOU MUST SAVE YOUR UPDATED :app SETTINGS FIRST.',
'shortcuts_enabled' => 'Enable Shortcuts',
'shortcuts_help_text' => '<strong>Windows</strong>: Alt + Access key, <strong>Mac</strong>: Control + Option + Access key',
'snipe_version' => 'Snipe-IT version', 'snipe_version' => 'Snipe-IT version',
'support_footer' => 'Support Footer Links ', 'support_footer' => 'Support Footer Links ',
'support_footer_help' => 'Specify who sees the links to the Snipe-IT Support info and Users Manual', 'support_footer_help' => 'Specify who sees the links to the Snipe-IT Support info and Users Manual',

View file

@ -8,7 +8,7 @@
@section('header_right') @section('header_right')
@can('create', \App\Models\Accessory::class) @can('create', \App\Models\Accessory::class)
<a href="{{ route('accessories.create') }}" accesskey="n" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a> <a href="{{ route('accessories.create') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=n" : ''}} class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan @endcan
@stop @stop

View file

@ -8,7 +8,7 @@
@section('header_right') @section('header_right')
@can('create', \App\Models\Component::class) @can('create', \App\Models\Component::class)
<a href="{{ route('components.create') }}" accesskey="n" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a> <a href="{{ route('components.create') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=n" : ''}} class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan @endcan
@stop @stop

View file

@ -8,7 +8,7 @@
@section('header_right') @section('header_right')
@can('create', \App\Models\Consumable::class) @can('create', \App\Models\Consumable::class)
<a href="{{ route('consumables.create') }}" accesskey="n" class="btn btn-primary pull-right"> {{ trans('general.create') }}</a> <a href="{{ route('consumables.create') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=n" : ''}} class="btn btn-primary pull-right"> {{ trans('general.create') }}</a>
@endcan @endcan
@stop @stop

View file

@ -47,7 +47,7 @@
<a href="{{ route('reports/custom') }}" style="margin-right: 5px;" class="btn btn-default"> <a href="{{ route('reports/custom') }}" style="margin-right: 5px;" class="btn btn-default">
{{ trans('admin/hardware/general.custom_export') }}</a> {{ trans('admin/hardware/general.custom_export') }}</a>
@can('create', \App\Models\Asset::class) @can('create', \App\Models\Asset::class)
<a href="{{ route('hardware.create') }}" accesskey="n" class="btn btn-primary pull-right"></i> {{ trans('general.create') }}</a> <a href="{{ route('hardware.create') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "n" : ''}} class="btn btn-primary pull-right"></i> {{ trans('general.create') }}</a>
@endcan @endcan
@stop @stop

View file

@ -144,7 +144,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
@can('index', \App\Models\Asset::class) @can('index', \App\Models\Asset::class)
<li aria-hidden="true"{!! (Request::is('hardware*') ? ' class="active"' : '') !!}> <li aria-hidden="true"{!! (Request::is('hardware*') ? ' class="active"' : '') !!}>
<a href="{{ url('hardware') }}" accesskey="1" tabindex="-1"> <a href="{{ url('hardware') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=1" : ''}} tabindex="-1">
<i class="fas fa-barcode fa-fw"></i> <i class="fas fa-barcode fa-fw"></i>
<span class="sr-only">{{ trans('general.assets') }}</span> <span class="sr-only">{{ trans('general.assets') }}</span>
</a> </a>
@ -152,7 +152,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
@endcan @endcan
@can('view', \App\Models\License::class) @can('view', \App\Models\License::class)
<li aria-hidden="true"{!! (Request::is('licenses*') ? ' class="active"' : '') !!}> <li aria-hidden="true"{!! (Request::is('licenses*') ? ' class="active"' : '') !!}>
<a href="{{ route('licenses.index') }}" accesskey="2" tabindex="-1"> <a href="{{ route('licenses.index') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=2" : ''}} tabindex="-1">
<i class="far fa-save fa-fw"></i> <i class="far fa-save fa-fw"></i>
<span class="sr-only">{{ trans('general.licenses') }}</span> <span class="sr-only">{{ trans('general.licenses') }}</span>
</a> </a>
@ -160,7 +160,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
@endcan @endcan
@can('index', \App\Models\Accessory::class) @can('index', \App\Models\Accessory::class)
<li aria-hidden="true"{!! (Request::is('accessories*') ? ' class="active"' : '') !!}> <li aria-hidden="true"{!! (Request::is('accessories*') ? ' class="active"' : '') !!}>
<a href="{{ route('accessories.index') }}" accesskey="3" tabindex="-1"> <a href="{{ route('accessories.index') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=3" : ''}} tabindex="-1">
<i class="far fa-keyboard fa-fw"></i> <i class="far fa-keyboard fa-fw"></i>
<span class="sr-only">{{ trans('general.accessories') }}</span> <span class="sr-only">{{ trans('general.accessories') }}</span>
</a> </a>
@ -168,7 +168,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
@endcan @endcan
@can('index', \App\Models\Consumable::class) @can('index', \App\Models\Consumable::class)
<li aria-hidden="true"{!! (Request::is('consumables*') ? ' class="active"' : '') !!}> <li aria-hidden="true"{!! (Request::is('consumables*') ? ' class="active"' : '') !!}>
<a href="{{ url('consumables') }}" accesskey="4" tabindex="-1"> <a href="{{ url('consumables') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=4" : ''}} tabindex="-1">
<i class="fas fa-tint fa-fw"></i> <i class="fas fa-tint fa-fw"></i>
<span class="sr-only">{{ trans('general.consumables') }}</span> <span class="sr-only">{{ trans('general.consumables') }}</span>
</a> </a>
@ -176,7 +176,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
@endcan @endcan
@can('view', \App\Models\Component::class) @can('view', \App\Models\Component::class)
<li aria-hidden="true"{!! (Request::is('components*') ? ' class="active"' : '') !!}> <li aria-hidden="true"{!! (Request::is('components*') ? ' class="active"' : '') !!}>
<a href="{{ route('components.index') }}" accesskey="5" tabindex="-1"> <a href="{{ route('components.index') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=5" : ''}} tabindex="-1">
<i class="far fa-hdd fa-fw"></i> <i class="far fa-hdd fa-fw"></i>
<span class="sr-only">{{ trans('general.components') }}</span> <span class="sr-only">{{ trans('general.components') }}</span>
</a> </a>
@ -622,7 +622,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
@can('view', \App\Models\User::class) @can('view', \App\Models\User::class)
<li{!! (Request::is('users*') ? ' class="active"' : '') !!}> <li{!! (Request::is('users*') ? ' class="active"' : '') !!}>
<a href="{{ route('users.index') }}" accesskey="6"> <a href="{{ route('users.index') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=6" : ''}}>
<i class="fas fa-users fa-fw"></i> <i class="fas fa-users fa-fw"></i>
<span>{{ trans('general.people') }}</span> <span>{{ trans('general.people') }}</span>
</a> </a>

View file

@ -26,7 +26,7 @@
@can('delete', \App\Models\Asset::class) @can('delete', \App\Models\Asset::class)
<option value="delete">{{ trans('button.delete') }}</option> <option value="delete">{{ trans('button.delete') }}</option>
@endcan @endcan
<option value="labels" accesskey="l">{{ trans_choice('button.generate_labels', 2) }}</option> <option value="labels" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=l" : ''}}>{{ trans_choice('button.generate_labels', 2) }}</option>
@endif @endif
</select> </select>

View file

@ -2,6 +2,6 @@
<div class="box-footer text-right" style="padding-bottom: 0px;"> <div class="box-footer text-right" style="padding-bottom: 0px;">
<a class="btn btn-link pull-left" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a> <a class="btn btn-link pull-left" href="{{ URL::previous() }}">{{ trans('button.cancel') }}</a>
<button type="submit" accesskey="s" class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button> <button type="submit" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=s" : ''}} class="btn btn-primary"><i class="fas fa-check icon-white" aria-hidden="true"></i> {{ trans('general.save') }}</button>
</div> </div>
<!-- / partials/forms/edit/submit.blade.php --> <!-- / partials/forms/edit/submit.blade.php -->

View file

@ -163,6 +163,21 @@
</div> </div>
</div> </div>
<!-- Shortcuts enable -->
<div class="form-group {{ $errors->has('shortcuts_enabled') ? 'error' : '' }}">
<div class="col-md-3">
<strong> {{ trans('admin/settings/general.shortcuts_enabled') }}</strong>
</div>
<div class="col-md-9">
<label class="form-control">
<input type="checkbox" name="shortcuts_enabled" value="1" {{ old('shortcuts_enabled', $setting->shortcuts_enabled) ? 'checked' : '' }}>
{{ trans('general.yes') }}
</label>
{!! $errors->first('shortcuts_enabled', '<span class="alert-msg" aria-hidden="true">:message</span>') !!}
<p class="help-block">{!!trans('admin/settings/general.shortcuts_help_text') !!}</p>
</div>
</div>
<!-- Per Page --> <!-- Per Page -->
<div class="form-group {{ $errors->has('per_page') ? 'error' : '' }}"> <div class="form-group {{ $errors->has('per_page') ? 'error' : '' }}">

View file

@ -18,7 +18,7 @@
@if ($snipeSettings->ldap_enabled == 1) @if ($snipeSettings->ldap_enabled == 1)
<a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fas fa-sitemap"></span>{{trans('general.ldap_sync')}}</a> <a href="{{ route('ldap/user') }}" class="btn btn-default pull-right"><span class="fas fa-sitemap"></span>{{trans('general.ldap_sync')}}</a>
@endif @endif
<a href="{{ route('users.create') }}" accesskey="n" class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a> <a href="{{ route('users.create') }}" {{$snipeSettings->shortcuts_enabled == 1 ? "n" : ''}} class="btn btn-primary pull-right" style="margin-right: 5px;"> {{ trans('general.create') }}</a>
@endcan @endcan
@if (request('status')=='deleted') @if (request('status')=='deleted')