FEATURE: add input for setting preview size and quality
This commit is contained in:
@@ -15,6 +15,7 @@ class SettingExtension
|
||||
* @var string view used for rendering given settings part
|
||||
*/
|
||||
protected $view;
|
||||
protected $order;
|
||||
|
||||
/**
|
||||
* SettingExtension constructor.
|
||||
@@ -23,11 +24,12 @@ class SettingExtension
|
||||
* @param string $name
|
||||
* @param string $view
|
||||
*/
|
||||
public function __construct($id, $name, $view)
|
||||
public function __construct($id, $name, $view, $order)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->name = $name;
|
||||
$this->view = $view;
|
||||
$this->order = $order;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,4 +55,14 @@ class SettingExtension
|
||||
{
|
||||
return $this->view;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOrder()
|
||||
{
|
||||
return $this->order;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\CMS\Handlers\Registrators;
|
||||
|
||||
use App\CMS\Enumerations\Exceptions\EnumerationExistsException;
|
||||
use App\CMS\Exceptions\Enumerations\EnumerationExistsException;
|
||||
use App\CMS\Handlers\Registrators\Items\SettingExtension;
|
||||
|
||||
class SettingsExtensionRegistrator
|
||||
@@ -22,12 +23,16 @@ class SettingsExtensionRegistrator
|
||||
*
|
||||
* @throws EnumerationExistsException
|
||||
*/
|
||||
public function register($sectionId, $sectionName, $sectionView)
|
||||
public function register($sectionId, $sectionName, $sectionView, $order = null)
|
||||
{
|
||||
$this->checkIfRegistered($sectionId);
|
||||
|
||||
if (is_null($order)) {
|
||||
$order = count($this->settingsExtensions);
|
||||
}
|
||||
|
||||
// register new extension
|
||||
$this->settingsExtensions[$sectionId] = new SettingExtension($sectionId, $sectionName, $sectionView);
|
||||
$this->settingsExtensions[$sectionId] = new SettingExtension($sectionId, $sectionName, $sectionView, $order);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,13 +49,14 @@ class SettingsExtensionRegistrator
|
||||
|
||||
/**
|
||||
* Getter for all registered extensions
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get()
|
||||
{
|
||||
// sort registered extensions by key
|
||||
ksort($this->settingsExtensions);
|
||||
// sort registered extensions
|
||||
uasort($this->settingsExtensions, function (SettingExtension $a, SettingExtension $b) {
|
||||
return $a->getOrder() - $b->getOrder();
|
||||
});
|
||||
|
||||
return $this->settingsExtensions;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,6 @@ class CreateImageThumbnail implements ShouldQueue
|
||||
});
|
||||
|
||||
// save thumbnail with lower quality
|
||||
$image->save(config('app.thumbnail_path') . DIRECTORY_SEPARATOR . $file->getFilename(), 75);
|
||||
$image->save(config('app.thumbnail_path') . DIRECTORY_SEPARATOR . $file->getFilename(), setting('previewQuality', 75));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
$registrator->register('basic', 'admin/settings.basic', 'admin.settings.parts.basic');
|
||||
$registrator->register('meta', 'admin/settings.meta', 'admin.settings.parts.meta');
|
||||
$registrator->register('social', 'admin/settings.socialSites', 'admin.settings.parts.social');
|
||||
$registrator->register('widgets', 'admin/settings.widgets.title', 'admin.settings.parts.widgets');
|
||||
$registrator->register('advanced', 'admin/settings.advanced.title', 'admin.settings.parts.advanced', 999);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,8 +21,18 @@ return [
|
||||
],
|
||||
"socialSites" => "Sociální sítě",
|
||||
"successfullySaved" => "Nastavení úspěšně změněno",
|
||||
'advanced' => [
|
||||
"title" => 'Pokročilé',
|
||||
],
|
||||
|
||||
'previews' => [
|
||||
'title' => 'Nastavení obrázkových náhledů',
|
||||
'quality' => 'Kvalita',
|
||||
'size' => 'Velikost (v pixelech)'
|
||||
],
|
||||
|
||||
'widgets' => [
|
||||
"title" => 'Widgety',
|
||||
'title' => 'Widgety',
|
||||
'useWidgetPreloading' => 'Používat přednačítání widgetů?',
|
||||
'preloadFrequentedWidgetAreasTreshold' => 'Práh pro přednačtení widgetů',
|
||||
'widgetCacheLifetime' => 'Platnost cache pro widgety'
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
|
||||
<h3>@lang('admin/settings.previews.title')</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
|
||||
<label>@lang('admin/settings.previews.size')</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="previewSize" value="{{old('previewSize', isset($settings->previewSize) ? $settings->previewSize['val'] : 300)}}">
|
||||
<span class="input-group-addon">px</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'previewSize'])
|
||||
</div>
|
||||
|
||||
<div class="col-md-9">
|
||||
|
||||
<label>@lang('admin/settings.previews.quality')</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="previewQuality" value="{{old('previewQuality', isset($settings->previewQuality) ? $settings->previewQuality['val'] : 75)}}">
|
||||
<span class="input-group-addon">%</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'previewQuality'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="m-t-50">@lang('admin/settings.widgets.title')</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label>
|
||||
<input class="checkbox" value="1"
|
||||
@if(!isset($settings->useWidgetPreloading) || $settings->useWidgetPreloading['lang'] == null)
|
||||
checked
|
||||
@endif name="useWidgetPreloading" type="checkbox">
|
||||
<span>@lang('admin/settings.widgets.useWidgetPreloading')</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'useWidgetPreloading'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label class="label-control">
|
||||
@lang('admin/settings.widgets.preloadFrequentedWidgetAreasTreshold')
|
||||
</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="preloadFrequentedWidgetAreasTreshold" value="{{old('preloadFrequentedWidgetAreasTreshold', isset($settings->preloadFrequentedWidgetAreasTreshold) ? $settings->preloadFrequentedWidgetAreasTreshold['val'] : 10)}}">
|
||||
<span class="input-group-addon">@lang('common.views')</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'author'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label class="label-control">
|
||||
@lang('admin/settings.widgets.widgetCacheLifetime')
|
||||
</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" name="widgetCacheLifetime" value="{{old('widgetCacheLifetime', isset($settings->widgetCacheLifetime) ? $settings->widgetCacheLifetime['val'] : 10)}}">
|
||||
<span class="input-group-addon">@lang('common.minutes')</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'author'])
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,49 +0,0 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label>
|
||||
<input class="checkbox" value="1"
|
||||
@if(!isset($settings->useWidgetPreloading) || $settings->useWidgetPreloading['lang'] == null)
|
||||
checked
|
||||
@endif name="useWidgetPreloading" type="checkbox">
|
||||
<span>@lang('admin/settings.widgets.useWidgetPreloading')</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'useWidgetPreloading'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label class="label-control">
|
||||
@lang('admin/settings.widgets.preloadFrequentedWidgetAreasTreshold')
|
||||
</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" value="{{old('preloadFrequentedWidgetAreasTreshold', isset($settings->preloadFrequentedWidgetAreasTreshold) ? $settings->preloadFrequentedWidgetAreasTreshold['val'] : 10)}}">
|
||||
<span class="input-group-addon">@lang('common.views')</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'author'])
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-9">
|
||||
<label class="label-control">
|
||||
@lang('admin/settings.widgets.widgetCacheLifetime')
|
||||
</label>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" value="{{old('widgetCacheLifetime', isset($settings->widgetCacheLifetime) ? $settings->widgetCacheLifetime['val'] : 10)}}">
|
||||
<span class="input-group-addon">@lang('common.minutes')</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
@include('admin.settings.snippets.commonSettings', ['field' => 'author'])
|
||||
</div>
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@ Route::group(['namespace' => 'FileManager'], function () {
|
||||
|
||||
route::post('directories/new', 'CreateNewDirectory@store')
|
||||
->name('upload.postNewDirectory')
|
||||
->middleware('can:create,directory');
|
||||
->middleware('can:create,'.\App\Models\FileManager\Directory::class);
|
||||
|
||||
Route::get('upload/detail/{file}', 'EditUploadedFile@show')
|
||||
->name('upload.detail')
|
||||
|
||||
Reference in New Issue
Block a user