Added ability to disable the alert icon in the top menu

This commit is contained in:
snipe 2017-11-08 03:08:17 -08:00
parent e9e32fdb00
commit 35ee52212f
5 changed files with 50 additions and 3 deletions

View file

@ -552,6 +552,7 @@ class SettingsController extends Controller
$setting->alert_threshold = $request->input('alert_threshold');
$setting->audit_interval = $request->input('audit_interval');
$setting->audit_warning_days = $request->input('audit_warning_days');
$setting->show_alerts_in_menu = $request->input('show_alerts_in_menu', '0');
if ($setting->save()) {
return redirect()->route('settings.index')

View file

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

View file

@ -6,7 +6,7 @@ return array(
'ad_domain_help' => 'This is sometimes the same as your email domain, but not always.',
'is_ad' => 'This is an Active Directory server',
'alert_email' => 'Send alerts to',
'alerts_enabled' => 'Alerts Enabled',
'alerts_enabled' => 'Email Alerts Enabled',
'alert_interval' => 'Expiring Alerts Threshold (in days)',
'alert_inv_threshold' => 'Inventory Alert Threshold',
'asset_ids' => 'Asset IDs',
@ -27,7 +27,7 @@ return array(
'custom_forgot_pass_url_help' => 'This replaces the built-in forgotten password URL on the login screen, useful to direct people to internal or hosted LDAP password reset functionality. It will effectively disable local user forgotten password functionality.',
'default_currency' => 'Default Currency',
'default_eula_text' => 'Default EULA',
'default_language' => 'Default Language',
'default_language' => 'Default Language',
'default_eula_help_text' => 'You can also associate custom EULAs to specific asset categories.',
'display_asset_name' => 'Display Asset Name',
'display_checkout_date' => 'Display Checkout Date',
@ -91,6 +91,7 @@ return array(
'qr_text' => 'QR Code Text',
'setting' => 'Setting',
'settings' => 'Settings',
'show_alerts_in_menu' => 'Show alerts in top menu',
'site_name' => 'Site Name',
'slack_botname' => 'Slack Botname',
'slack_channel' => 'Slack Channel',

View file

@ -239,6 +239,7 @@
@endcan
@can('admin')
@if ($snipeSettings->show_alerts_in_menu=='1')
<!-- Tasks: style can be found in dropdown.less -->
<?php $alert_items = \App\Helpers\Helper::checkLowInventory(); ?>
@ -281,6 +282,7 @@
</ul>
</li>
@endcan
@endif
<!-- User Account: style can be found in dropdown.less -->

View file

@ -47,7 +47,18 @@
</div>
<div class="col-md-5">
{{ Form::checkbox('alerts_enabled', '1', Input::old('alerts_enabled', $setting->alerts_enabled),array('class' => 'minimal')) }}
{{ trans('admin/settings/general.alerts_enabled') }}
{{ trans('general.yes') }}
</div>
</div>
<!-- Menu Alerts Enabled -->
<div class="form-group {{ $errors->has('show_alerts_in_menu') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('show_alerts_in_menu', trans('admin/settings/general.show_alerts_in_menu')) }}
</div>
<div class="col-md-5">
{{ Form::checkbox('show_alerts_in_menu', '1', Input::old('show_alerts_in_menu', $setting->show_alerts_in_menu),array('class' => 'minimal')) }}
{{ trans('general.yes') }}
</div>
</div>