From ac29b142dc9a739c116920fbef09c916c76efbfc Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 25 Jul 2017 19:36:38 -0700 Subject: [PATCH] Adds max thumbnail width to asset listings, settings --- app/Http/Controllers/SettingsController.php | 1 + app/Models/Setting.php | 1 + ...07_25_130710_add_thumbsize_to_settings.php | 32 +++++++++++++++++++ resources/lang/en/admin/settings/general.php | 2 ++ .../views/partials/bootstrap-table.blade.php | 2 +- resources/views/settings/general.blade.php | 12 +++++++ 6 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 database/migrations/2017_07_25_130710_add_thumbsize_to_settings.php diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index c7b1fe4f7a..6dd7cc04c6 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -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'); diff --git a/app/Models/Setting.php b/app/Models/Setting.php index 2a06552804..0f3cb48039 100755 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -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']; diff --git a/database/migrations/2017_07_25_130710_add_thumbsize_to_settings.php b/database/migrations/2017_07_25_130710_add_thumbsize_to_settings.php new file mode 100644 index 0000000000..0e4799c986 --- /dev/null +++ b/database/migrations/2017_07_25_130710_add_thumbsize_to_settings.php @@ -0,0 +1,32 @@ +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'); + }); + } +} diff --git a/resources/lang/en/admin/settings/general.php b/resources/lang/en/admin/settings/general.php index 2f86f03821..09f134feb6 100644 --- a/resources/lang/en/admin/settings/general.php +++ b/resources/lang/en/admin/settings/general.php @@ -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', diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index ff0a123758..375dae244b 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -330,7 +330,7 @@ $('.snipe-table').bootstrapTable({ function imageFormatter(value, row) { if (value) { - return ''; + return ''; } } diff --git a/resources/views/settings/general.blade.php b/resources/views/settings/general.blade.php index 4e2ff7eb74..01eeab2d9a 100644 --- a/resources/views/settings/general.blade.php +++ b/resources/views/settings/general.blade.php @@ -133,6 +133,18 @@ + +
+
+ {{ Form::label('thumbnail_max_h', trans('admin/settings/general.thumbnail_max_h')) }} +
+
+ {{ 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;')) }} +

{{ trans('admin/settings/general.thumbnail_max_h_help') }}

+ {!! $errors->first('thumbnail_max_h', ':message') !!} +
+
+