]> BookStack Code Mirror - bookstack/commitdiff
Ordered entity permission roles by display name
authorDan Brown <redacted>
Fri, 4 Jun 2021 21:36:30 +0000 (22:36 +0100)
committerDan Brown <redacted>
Fri, 4 Jun 2021 21:36:30 +0000 (22:36 +0100)
Closes #2782

app/Auth/Role.php
resources/views/form/entity-permissions.blade.php

index 629cd6a955d8abf7961b67aa1c598d1d62d30658..59b1f547c13f527b7f9bd19d524525a9415e1972 100644 (file)
@@ -92,7 +92,7 @@ class Role extends Model implements Loggable
     }
 
     /**
-     * Get all visible roles
+     * Get all visible roles.
      */
     public static function visible(): Collection
     {
@@ -104,7 +104,10 @@ class Role extends Model implements Loggable
      */
     public static function restrictable(): Collection
     {
-        return static::query()->where('system_name', '!=', 'admin')->get();
+        return static::query()
+            ->where('system_name', '!=', 'admin')
+            ->orderBy('display_name', 'asc')
+            ->get();
     }
 
     /**
index 6cf5ab8bdcac9db8b02f3debb384005ddaa27c80..d3e89cc447fa07953ac30599e27d9b625ec70c27 100644 (file)
@@ -25,7 +25,7 @@
     <table permissions-table class="table permissions-table toggle-switch-list" style="{{ !$model->restricted ? 'display: none' : '' }}">
         <tr>
             <th>{{ trans('common.role') }}</th>
-            <th @if($model->isA('page')) colspan="3" @else colspan="4" @endif>
+            <th colspan="{{ $model->isA('page') ? '3' : '4'  }}">
                 {{ trans('common.actions') }}
                 <a href="#" permissions-table-toggle-all class="text-small ml-m text-primary">{{ trans('common.toggle_all') }}</a>
             </th>