#59: Added 2 new settings to customise the albums drop-down navigator. It is now possible to choose to only display top-level albums, and also to restrict the number of items.
This commit is contained in:
parent
f96a9cd9f7
commit
ef4df1ab32
@ -87,6 +87,8 @@ class ConfigHelper
|
||||
$currentAppName = $this->get('app_name', false);
|
||||
|
||||
return array(
|
||||
'albums_menu_parents_only' => false,
|
||||
'albums_menu_number_items' => 10,
|
||||
'allow_self_registration' => true,
|
||||
'analytics_code' => '',
|
||||
'app_name' => trans('global.app_name'),
|
||||
|
@ -214,6 +214,7 @@ class DefaultController extends Controller
|
||||
'smtp_password'
|
||||
];
|
||||
$checkboxKeys = [
|
||||
'albums_menu_parents_only',
|
||||
'allow_self_registration',
|
||||
'enable_visitor_hits',
|
||||
'hotlink_protection',
|
||||
@ -224,6 +225,7 @@ class DefaultController extends Controller
|
||||
'smtp_encryption',
|
||||
];
|
||||
$updateKeys = [
|
||||
'albums_menu_number_items',
|
||||
'app_name',
|
||||
'date_format',
|
||||
'sender_address',
|
||||
|
@ -65,6 +65,24 @@ class GlobalConfiguration
|
||||
$albums = DbHelper::getAlbumsForCurrentUser_NonPaged()->get();
|
||||
View::share('g_albums', $albums);
|
||||
|
||||
if (UserConfig::get('albums_menu_parents_only'))
|
||||
{
|
||||
// Only show top-level albums in the nav bar
|
||||
$navbarAlbums = $albums->filter(function($value, $key)
|
||||
{
|
||||
return is_null($value->parent_album_id);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not just showing top-level albums, we can show all
|
||||
$navbarAlbums = $albums;
|
||||
}
|
||||
|
||||
$navbarAlbumsToDisplay = UserConfig::get('albums_menu_number_items');
|
||||
View::share('g_albums_menu', $navbarAlbums->take($navbarAlbumsToDisplay));
|
||||
View::share('g_more_albums', $navbarAlbums->count() - $navbarAlbumsToDisplay);
|
||||
|
||||
$albumsToUpload = DbHelper::getAlbumsForCurrentUser_NonPaged('upload-photos')->get();
|
||||
View::share('g_albums_upload', $albumsToUpload);
|
||||
}
|
||||
|
@ -24,10 +24,11 @@ class SaveSettingsRequest extends FormRequest
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'albums_menu_number_items' => 'required|integer|min:1',
|
||||
'app_name' => 'required|max:255',
|
||||
'date_format' => 'required',
|
||||
'smtp_server' => 'required',
|
||||
'smtp_port' => 'required:integer'
|
||||
'smtp_port' => 'required|integer'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -198,6 +198,9 @@ return [
|
||||
'security_text' => 'You can assign permissions on this album to either groups (recommended) or directly to users.',
|
||||
'security_users_heading' => 'User Permissions',
|
||||
'settings' => [
|
||||
'albums_menu_heading' => 'Albums Navigation Menu',
|
||||
'albums_menu_number_items' => 'Number of albums to display:',
|
||||
'albums_menu_parents_only' => 'Only show top-level albums',
|
||||
'analytics_cookie_link_1' => 'Information about the EU Cookie Law directive',
|
||||
'analytics_cookie_link_2' => 'Cookie Consent by Insites',
|
||||
'analytics_cookie_warning_1' => 'If you are based in Europe and you enable visitor tracking, you will need to comply with the EU Cookie Law. The easiest way to do so is using a script like Cookie Consent by Insites.',
|
||||
|
@ -34,6 +34,7 @@ return [
|
||||
'other_albums_heading' => 'More Albums in :album_name',
|
||||
'photos' => 'photo|photos',
|
||||
'previous_button' => '« Previous Photo',
|
||||
'show_more_albums' => '... and :count other|... and :count others',
|
||||
'show_more_labels' => '... and :count other|... and :count others',
|
||||
'show_raw_exif_data' => 'Show all EXIF data',
|
||||
'shutter_speed' => 'Shutter speed:',
|
||||
|
@ -77,6 +77,30 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr/>
|
||||
|
||||
<fieldset>
|
||||
<legend>@lang('admin.settings.albums_menu_heading')</legend>
|
||||
|
||||
<div class="form-check">
|
||||
<label class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="custom-control-input" name="albums_menu_parents_only" @if (old('albums_menu_parents_only', UserConfig::get('albums_menu_parents_only')))checked="checked"@endif>
|
||||
<span class="custom-control-indicator"></span>
|
||||
<span class="custom-control-description"><strong>@lang('admin.settings.albums_menu_parents_only')</strong></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="albums-menu-number-items">@lang('admin.settings.albums_menu_number_items')</label>
|
||||
<input type="number" class="form-control{{ $errors->has('albums_menu_number_items') ? ' is-invalid' : '' }}" id="albums-menu-number-items" name="albums_menu_number_items" value="{{ old('albums_menu_number_items', $config['albums_menu_number_items']) }}" style="max-width: 100px;">
|
||||
|
||||
@if ($errors->has('albums_menu_number_items'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('albums_menu_number_items') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<hr/>
|
||||
<fieldset>
|
||||
|
@ -20,9 +20,13 @@
|
||||
<i class="fa fa-book"></i> @lang('navigation.navbar.albums')
|
||||
</a>
|
||||
<div class="dropdown-menu">
|
||||
@foreach ($g_albums as $album)
|
||||
@foreach ($g_albums_menu as $album)
|
||||
<a class="dropdown-item" href="{{ $album->url() }}">{{ $album->name }}</a>
|
||||
@endforeach
|
||||
|
||||
@if ($g_more_albums > 0)
|
||||
<a class="dropdown-item" href="{{ route('home') }}">{{ trans_choice('gallery.show_more_albums', $g_more_albums) }}</a>
|
||||
@endif
|
||||
</div>
|
||||
</li>
|
||||
@endif
|
||||
|
Loading…
Reference in New Issue
Block a user