Adds max thumbnail width to asset listings, settings

This commit is contained in:
snipe 2017-07-25 19:36:38 -07:00
parent 978a906513
commit ac29b142dc
6 changed files with 49 additions and 1 deletions

View file

@ -331,6 +331,7 @@ class SettingsController extends Controller
$setting->require_accept_signature = $request->input('require_accept_signature');
$setting->login_note = $request->input('login_note');
$setting->default_eula_text = $request->input('default_eula_text');
$setting->thumbnail_max_h = $request->input('thumbnail_max_h');
if (Input::get('per_page')!='') {
$setting->per_page = $request->input('per_page');

View file

@ -43,6 +43,7 @@ class Setting extends Model
"ldap_lname_field" => 'sometimes|required_if:ldap_enabled,1',
"ldap_auth_filter_query" => 'sometimes|required_if:ldap_enabled,1',
"ldap_version" => 'sometimes|required_if:ldap_enabled,1',
"thumbnail_max_h" => 'numeric|max:500|min:25',
];
protected $fillable = ['site_name','email_domain','email_format','username_format'];

View file

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

View file

@ -107,6 +107,8 @@ return array(
'width_w' => 'w',
'height_h' => 'h',
'text_pt' => 'pt',
'thumbnail_max_h' => 'Max thumbnail height',
'thumbnail_max_h_help' => 'Maximum height in pixels that thumbnails may display in the listing view. Min 25, max 500.',
'two_factor' => 'Two Factor Authentication',
'two_factor_secret' => 'Two-Factor Code',
'two_factor_enrollment' => 'Two-Factor Enrollment',

View file

@ -330,7 +330,7 @@ $('.snipe-table').bootstrapTable({
function imageFormatter(value, row) {
if (value) {
return '<img src="' + value + '" height="50" width="50">';
return '<img src="' + value + '" style="max-height: {{ $snipeSettings->thumbnail_max_h }}px; width: auto;">';
}
}

View file

@ -133,6 +133,18 @@
</div>
</div>
<!-- Thumb Size -->
<div class="form-group {{ $errors->has('thumbnail_max_h') ? 'error' : '' }}">
<div class="col-md-3">
{{ Form::label('thumbnail_max_h', trans('admin/settings/general.thumbnail_max_h')) }}
</div>
<div class="col-md-9">
{{ Form::text('thumbnail_max_h', Input::old('thumbnail_max_h', $setting->thumbnail_max_h), array('class' => 'form-control','placeholder' => '50', 'maxlength'=>'3', 'style'=>'width: 60px;')) }}
<p class="help-block">{{ trans('admin/settings/general.thumbnail_max_h_help') }}</p>
{!! $errors->first('thumbnail_max_h', '<span class="alert-msg">:message</span>') !!}
</div>
</div>
<!-- Default EULA -->
<div class="form-group {{ $errors->has('default_eula_text') ? 'error' : '' }}">
<div class="col-md-3">