#3: Removed the dynamic-ness of the album permissions so I have more control over the layout

This commit is contained in:
Andy Heathershaw 2017-04-14 10:23:47 +01:00
parent ac2a24187d
commit 33275a8733
2 changed files with 27 additions and 5 deletions

View File

@ -14,6 +14,19 @@ class ThemeHelper
return $this->getThemeName(); return $this->getThemeName();
} }
public function getPermission($allPermissions, $section, $description)
{
foreach ($allPermissions as $permission)
{
if (strtolower($permission->section) == strtolower($section) && strtolower($permission->description) == strtolower($description))
{
return $permission;
}
}
return null;
}
public function hasStylesheet() public function hasStylesheet()
{ {
$cssFilename = sprintf('%s/%s/theme.css', $this->getThemePublicPath(), $this->getThemeName()); $cssFilename = sprintf('%s/%s/theme.css', $this->getThemePublicPath(), $this->getThemeName());

View File

@ -8,15 +8,24 @@
<div class="card-block"> <div class="card-block">
<p style="margin-bottom: 20px;"><a class="select-all" href="#">Select All</a> &middot; <a class="select-none" href="">Select None</a></p> <p style="margin-bottom: 20px;"><a class="select-all" href="#">Select All</a> &middot; <a class="select-none" href="">Select None</a></p>
@foreach ($all_permissions as $permission) <div class="row">
@if ($object_id == 'anonymous' && $permission->section == 'album' && $permission->description != 'list' && $permission->description != 'view') <div class="col-md-4">
@continue <h5>Album Permissions</h5>
@endif
@php ($permission = Theme::getPermission($all_permissions, 'album', 'list'))
<div class="checkbox"> <div class="checkbox">
<label for="permission|{{ $key_id }}|{{ $permission->id }}"> <label for="permission|{{ $key_id }}|{{ $permission->id }}">
<input id="permission|{{ $key_id }}|{{ $permission->id }}" name="permissions[{{ $object_id }}][]" value="{{ $permission->id }}" type="checkbox"{{ call_user_func($callback, $callback_object, $permission) ? ' checked="checked"' : '' }} /> {{ trans(sprintf('permissions.%s.%s', $permission->section, $permission->description)) }} <input id="permission|{{ $key_id }}|{{ $permission->id }}" name="permissions[{{ $object_id }}][]" value="{{ $permission->id }}" type="checkbox"{{ call_user_func($callback, $callback_object, $permission) ? ' checked="checked"' : '' }} /> {{ trans(sprintf('permissions.%s.%s', $permission->section, $permission->description)) }}
</label> </label>
</div> </div>
</div>
</div>
@foreach ($all_permissions as $permission)
@if ($object_id == 'anonymous' && $permission->section == 'album' && $permission->description != 'list' && $permission->description != 'view')
@continue
@endif
@endforeach @endforeach
</div> </div>
</div> </div>