#1: Tab headers in the admin panel are now responsive - hiding the text on xs devices. #3: Added ability to set permissions for anonymous users
This commit is contained in:
parent
a27cf530f5
commit
6be31c9b7e
@ -30,6 +30,16 @@ class Album extends Model
|
|||||||
protected $hidden = [
|
protected $hidden = [
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function anonymousPermissions()
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(Permission::class, 'album_anonymous_permissions');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function doesAnonymousHavePermission(Permission $permission)
|
||||||
|
{
|
||||||
|
return $this->anonymousPermissions()->where(['permission_id' => $permission->id])->count() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
public function doesGroupHavePermission(Group $group, Permission $permission)
|
public function doesGroupHavePermission(Group $group, Permission $permission)
|
||||||
{
|
{
|
||||||
return $this->groupPermissions()->where([
|
return $this->groupPermissions()->where([
|
||||||
|
@ -172,9 +172,9 @@ class AlbumController extends Controller
|
|||||||
|
|
||||||
$album->save();
|
$album->save();
|
||||||
}
|
}
|
||||||
else if ($request->get('action') == 'update_permissions')
|
else if ($request->get('action') == 'update_group_permissions')
|
||||||
{
|
{
|
||||||
/* Update existing permissions for this album */
|
/* Update existing group permissions for this album */
|
||||||
$album->groupPermissions()->detach();
|
$album->groupPermissions()->detach();
|
||||||
|
|
||||||
$permissions = $request->get('permissions');
|
$permissions = $request->get('permissions');
|
||||||
@ -193,6 +193,26 @@ class AlbumController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ($request->get('action') == 'update_user_permissions')
|
||||||
|
{
|
||||||
|
/* Update existing user and anonymous permissions for this album */
|
||||||
|
$album->anonymousPermissions()->detach();
|
||||||
|
|
||||||
|
$permissions = $request->get('permissions');
|
||||||
|
if (is_array($permissions))
|
||||||
|
{
|
||||||
|
if (isset($permissions['anonymous']))
|
||||||
|
{
|
||||||
|
foreach ($permissions['anonymous'] as $permissionID)
|
||||||
|
{
|
||||||
|
$album->anonymousPermissions()->attach($permissionID, [
|
||||||
|
'created_at' => new \DateTime(),
|
||||||
|
'updated_at' => new \DateTime()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return redirect(route('albums.show', [$album->id, 'tab' => 'permissions']));
|
return redirect(route('albums.show', [$album->id, 'tab' => 'permissions']));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateAlbumAnonymousPermissionsTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('album_anonymous_permissions', function ($table) {
|
||||||
|
$table->unsignedInteger('album_id');
|
||||||
|
$table->unsignedInteger('permission_id');
|
||||||
|
|
||||||
|
$table->foreign('album_id')
|
||||||
|
->references('id')->on('albums')
|
||||||
|
->onDelete('cascade');
|
||||||
|
$table->foreign('permission_id')
|
||||||
|
->references('id')->on('permissions')
|
||||||
|
->onDelete('no action');
|
||||||
|
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('album_anonymous_permissions');
|
||||||
|
}
|
||||||
|
}
|
2451
public/themes/base/js/typeahead.bundle.js
Normal file
2451
public/themes/base/js/typeahead.bundle.js
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,6 +21,7 @@ return [
|
|||||||
'others' => ' others'
|
'others' => ' others'
|
||||||
],
|
],
|
||||||
'analyse_photos_failed' => 'The following items could not be analysed and were removed:',
|
'analyse_photos_failed' => 'The following items could not be analysed and were removed:',
|
||||||
|
'anonymous_users' => 'Anonymous (not logged in)',
|
||||||
'bulk_photos_changed' => ':number photo was updated successfully.|:number photos were updated successfully.',
|
'bulk_photos_changed' => ':number photo was updated successfully.|:number photos were updated successfully.',
|
||||||
'cannot_delete_own_user_account' => 'It is not possible to delete your own user account. Please ask another administrator to delete it for you.',
|
'cannot_delete_own_user_account' => 'It is not possible to delete your own user account. Please ask another administrator to delete it for you.',
|
||||||
'cannot_remove_own_admin' => 'You cannot remove your own administrator permissions. Please ask another administrator to remove the administrator permissions for you.',
|
'cannot_remove_own_admin' => 'You cannot remove your own administrator permissions. Please ask another administrator to remove the administrator permissions for you.',
|
||||||
@ -126,6 +127,9 @@ return [
|
|||||||
'visible_action' => 'Only those visible'
|
'visible_action' => 'Only those visible'
|
||||||
],
|
],
|
||||||
'select_none_action' => 'Clear selection',
|
'select_none_action' => 'Clear selection',
|
||||||
|
'settings_email_tab' => 'E-mail',
|
||||||
|
'settings_general_tab' => 'General',
|
||||||
|
'settings_security_tab' => 'Security',
|
||||||
'settings_image_protection' => 'Image Protection',
|
'settings_image_protection' => 'Image Protection',
|
||||||
'settings_intro' => 'Configure your Blue Twilight system just the way you like it.',
|
'settings_intro' => 'Configure your Blue Twilight system just the way you like it.',
|
||||||
'settings_recaptcha' => 'reCAPTCHA settings',
|
'settings_recaptcha' => 'reCAPTCHA settings',
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
<div>
|
<div>
|
||||||
{{-- Nav tabs --}}
|
{{-- Nav tabs --}}
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li role="presentation" class="active"><a href="#details-tab" aria-controls="details-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-info-circle"></i> @lang('admin.user_details_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['active_tab' => 'details', 'tab_name' => 'details', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.user_details_tab')])
|
||||||
<li role="presentation"><a href="#groups-tab" aria-controls="groups-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-users"></i> @lang('admin.user_groups_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['active_tab' => 'details', 'tab_name' => 'groups', 'tab_icon' => 'users', 'tab_text' => trans('admin.user_groups_tab')])
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{-- Tab panes --}}
|
{{-- Tab panes --}}
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
<div>
|
<div>
|
||||||
{{-- Nav tabs --}}
|
{{-- Nav tabs --}}
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li role="presentation" class="active"><a href="#general-tab" aria-controls="general-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-info-circle"></i> General</a></li>
|
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'general', 'tab_icon' => 'info-circle', 'tab_text' => trans('admin.settings_general_tab')])
|
||||||
<li role="presentation"><a href="#email-tab" aria-controls="email-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-envelope"></i> E-mail</a></li>
|
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'email', 'tab_icon' => 'envelope', 'tab_text' => trans('admin.settings_email_tab')])
|
||||||
<li role="presentation"><a href="#security-tab" aria-controls="security-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-lock"></i> Security</a></li>
|
@include(Theme::viewName('partials.tab'), ['active_tab' => 'general', 'tab_name' => 'security', 'tab_icon' => 'lock', 'tab_text' => trans('admin.settings_security_tab')])
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{{-- Tab panes --}}
|
{{-- Tab panes --}}
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<ul class="nav nav-tabs" role="tablist">
|
<ul class="nav nav-tabs" role="tablist">
|
||||||
<li role="presentation" class="{{ $active_tab == 'photos' ? 'active' : '' }}"><a href="#photos-tab" aria-controls="photos-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-photo"></i> @lang('admin.album_photos_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['tab_name' => 'photos', 'tab_icon' => 'photo', 'tab_text' => trans('admin.album_photos_tab')])
|
||||||
<li role="presentation" class="{{ $active_tab == 'upload' ? 'active' : '' }}"><a href="#upload-tab" aria-controls="upload-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-upload"></i> @lang('admin.album_upload_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['tab_name' => 'upload', 'tab_icon' => 'upload', 'tab_text' => trans('admin.album_upload_tab')])
|
||||||
<li role="presentation" class="{{ $active_tab == 'permissions' ? 'active' : '' }}"><a href="#permissions-tab" aria-controls="permissions-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-lock"></i> @lang('admin.album_security_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['tab_name' => 'permissions', 'tab_icon' => 'lock', 'tab_text' => trans('admin.album_security_tab')])
|
||||||
<li role="presentation" class="{{ $active_tab == 'settings' ? 'active' : '' }}"><a href="#settings-tab" aria-controls="settings-tab" role="tab" data-toggle="tab"><i class="fa fa-fw fa-cog"></i> @lang('admin.album_settings_tab')</a></li>
|
@include(Theme::viewName('partials.tab'), ['tab_name' => 'settings', 'tab_icon' => 'cog', 'tab_text' => trans('admin.album_settings_tab')])
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
@ -183,7 +183,7 @@
|
|||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading" role="tab" id="heading-{{ $group->id }}">
|
<div class="panel-heading" role="tab" id="heading-{{ $group->id }}">
|
||||||
<h4 class="panel-title">
|
<h4 class="panel-title">
|
||||||
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-{{ $group->id }}" aria-expanded="true" aria-controls="collapse-{{ $group->id }}">
|
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#groups-accordion" href="#collapse-{{ $group->id }}" aria-expanded="true" aria-controls="collapse-{{ $group->id }}">
|
||||||
{{ $group->name }}
|
{{ $group->name }}
|
||||||
</a>
|
</a>
|
||||||
</h4>
|
</h4>
|
||||||
@ -213,7 +213,7 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<button type="submit" name="action" value="add_group" class="btn btn-primary"@if (count($add_new_groups) == 0) disabled="disabled"@endif>Assign Permissions</button>
|
<button type="submit" name="action" value="add_group" class="btn btn-primary"@if (count($add_new_groups) == 0) disabled="disabled"@endif>Assign Permissions</button>
|
||||||
<button type="submit" name="action" value="update_permissions" class="btn btn-success pull-right">
|
<button type="submit" name="action" value="update_group_permissions" class="btn btn-success pull-right">
|
||||||
<i class="fa fa-fw fa-check"></i> @lang('forms.save_action')
|
<i class="fa fa-fw fa-check"></i> @lang('forms.save_action')
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
@ -221,6 +221,46 @@
|
|||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<h5 style="font-weight: bold;">@lang('admin.security_users_heading')</h5>
|
<h5 style="font-weight: bold;">@lang('admin.security_users_heading')</h5>
|
||||||
|
|
||||||
|
<form action="{{ route('albums.set_user_permissions', ['id' => $album->id]) }}" method="post">
|
||||||
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<div class="panel-group" id="users-accordion" role="tablist" aria-multiselectable="true">
|
||||||
|
{{-- Anonymous users --}}
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-heading" role="tab" id="heading-anonymous">
|
||||||
|
<h4 class="panel-title">
|
||||||
|
<a class="collapsed" role="button" data-toggle="collapse" data-parent="#users-accordion" href="#collapse-anonymous" aria-expanded="true" aria-controls="collapse-anonymous">
|
||||||
|
@lang('admin.anonymous_users')
|
||||||
|
</a>
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div id="collapse-anonymous" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-anonymous">
|
||||||
|
<div class="panel-body">
|
||||||
|
<p style="margin-bottom: 20px;"><a class="select-all" href="#">Select All</a> · <a class="select-none" href="">Select None</a></p>
|
||||||
|
|
||||||
|
@foreach ($all_permissions as $permission)
|
||||||
|
<div class="checkbox">
|
||||||
|
<label for="permission|anonymous|{{ $permission->id }}">
|
||||||
|
<input id="permission|anonymous|{{ $permission->id }}" name="permissions[anonymous][]" value="{{ $permission->id }}" type="checkbox"{{ $album->doesAnonymousHavePermission($permission) ? ' checked="checked"' : '' }} /> {{ trans(sprintf('permissions.%s.%s', $permission->section, $permission->description)) }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<input class="form-control" name="user_id" size="20" style="width: auto; display: inline;" />
|
||||||
|
<button type="submit" name="action" value="add_user" class="btn btn-primary">Assign Permissions</button>
|
||||||
|
|
||||||
|
<button type="submit" name="action" value="update_user_permissions" class="btn btn-success pull-right">
|
||||||
|
<i class="fa fa-fw fa-check"></i> @lang('forms.save_action')
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="clearfix"><!-- --></div>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{-- Settings --}}
|
{{-- Settings --}}
|
||||||
|
6
resources/views/themes/base/partials/tab.blade.php
Normal file
6
resources/views/themes/base/partials/tab.blade.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<li role="presentation" class="{{ $active_tab == $tab_name ? 'active' : '' }}">
|
||||||
|
<a href="#{{ $tab_name }}-tab" aria-controls="{{ $tab_name }}-tab" role="tab" data-toggle="tab">
|
||||||
|
<i class="fa fa-fw fa-{{ $tab_icon }}"></i>
|
||||||
|
<span class="hidden-xs">{{ $tab_text }}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
@ -42,6 +42,7 @@ Route::group(['prefix' => 'admin'], function () {
|
|||||||
Route::get('albums/{id}/analyse/{queue_token}', 'Admin\AlbumController@analyse')->name('albums.analyse');
|
Route::get('albums/{id}/analyse/{queue_token}', 'Admin\AlbumController@analyse')->name('albums.analyse');
|
||||||
Route::get('albums/{id}/delete', 'Admin\AlbumController@delete')->name('albums.delete');
|
Route::get('albums/{id}/delete', 'Admin\AlbumController@delete')->name('albums.delete');
|
||||||
Route::post('albums/{id}/set-group-permissions', 'Admin\AlbumController@setGroupPermissions')->name('albums.set_group_permissions');
|
Route::post('albums/{id}/set-group-permissions', 'Admin\AlbumController@setGroupPermissions')->name('albums.set_group_permissions');
|
||||||
|
Route::post('albums/{id}/set-user-permissions', 'Admin\AlbumController@setGroupPermissions')->name('albums.set_user_permissions');
|
||||||
Route::resource('albums', 'Admin\AlbumController');
|
Route::resource('albums', 'Admin\AlbumController');
|
||||||
|
|
||||||
// Photo management
|
// Photo management
|
||||||
|
Loading…
Reference in New Issue
Block a user