From 98c6422fa63ccf654c0fb9c9c178abf9145c2ffb Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 11 Oct 2022 15:52:56 +0100 Subject: [PATCH] Extracted entity perms. text to translation files --- app/Auth/Permissions/PermissionFormData.php | 4 ++-- app/Http/Controllers/PermissionsController.php | 4 ++++ resources/lang/en/entities.php | 7 ++++++- .../views/form/entity-permissions-row.blade.php | 6 +++--- .../views/form/entity-permissions.blade.php | 17 +++++------------ 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/Auth/Permissions/PermissionFormData.php b/app/Auth/Permissions/PermissionFormData.php index ae06762f4..2e2af6854 100644 --- a/app/Auth/Permissions/PermissionFormData.php +++ b/app/Auth/Permissions/PermissionFormData.php @@ -61,8 +61,8 @@ class PermissionFormData { return (new Role())->forceFill([ 'id' => 0, - 'display_name' => 'Everyone Else', - 'description' => 'Set permissions for all roles not specifically overridden.' + 'display_name' => trans('entities.permissions_role_everyone_else'), + 'description' => trans('entities.permissions_role_everyone_else_desc'), ]); } } diff --git a/app/Http/Controllers/PermissionsController.php b/app/Http/Controllers/PermissionsController.php index 93498a2b9..9d50b834b 100644 --- a/app/Http/Controllers/PermissionsController.php +++ b/app/Http/Controllers/PermissionsController.php @@ -29,6 +29,7 @@ class PermissionsController extends Controller $page = Page::getBySlugs($bookSlug, $pageSlug); $this->checkOwnablePermission('restrictions-manage', $page); + $this->setPageTitle(trans('entities.pages_permissions')); return view('pages.permissions', [ 'page' => $page, 'data' => new PermissionFormData($page), @@ -58,6 +59,7 @@ class PermissionsController extends Controller $chapter = Chapter::getBySlugs($bookSlug, $chapterSlug); $this->checkOwnablePermission('restrictions-manage', $chapter); + $this->setPageTitle(trans('entities.chapters_permissions')); return view('chapters.permissions', [ 'chapter' => $chapter, 'data' => new PermissionFormData($chapter), @@ -87,6 +89,7 @@ class PermissionsController extends Controller $book = Book::getBySlug($slug); $this->checkOwnablePermission('restrictions-manage', $book); + $this->setPageTitle(trans('entities.books_permissions')); return view('books.permissions', [ 'book' => $book, 'data' => new PermissionFormData($book), @@ -116,6 +119,7 @@ class PermissionsController extends Controller $shelf = Bookshelf::getBySlug($slug); $this->checkOwnablePermission('restrictions-manage', $shelf); + $this->setPageTitle(trans('entities.shelves_permissions')); return view('shelves.permissions', [ 'shelf' => $shelf, 'data' => new PermissionFormData($shelf), diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index 28ec591d7..bf6201900 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -42,9 +42,14 @@ return [ // Permissions and restrictions 'permissions' => 'Permissions', - 'permissions_intro' => 'Once enabled, These permissions will take priority over any set role permissions.', + 'permissions_desc' => 'Set permissions here to override the default permissions provided by user roles.', + 'permissions_book_cascade' => 'Permissions set on books will automatically cascade to child chapters and pages, unless they have their own permissions defined.', + 'permissions_chapter_cascade' => 'Permissions set on chapters will automatically cascade to child pages, unless they have their own permissions defined.', 'permissions_save' => 'Save Permissions', 'permissions_owner' => 'Owner', + 'permissions_role_everyone_else' => 'Everyone Else', + 'permissions_role_everyone_else_desc' => 'Set permissions for all roles not specifically overridden.', + 'permissions_role_override' => 'Override permissions for role', // Search 'search_results' => 'Search Results', diff --git a/resources/views/form/entity-permissions-row.blade.php b/resources/views/form/entity-permissions-row.blade.php index a7a314bf4..d2e6a4756 100644 --- a/resources/views/form/entity-permissions-row.blade.php +++ b/resources/views/form/entity-permissions-row.blade.php @@ -7,7 +7,7 @@ $inheriting - Boolean if the current row should be marked as inheriting default
-
+
@icon($role->id === 0 ? 'groups' : 'role')
@@ -80,8 +80,8 @@ $inheriting - Boolean if the current row should be marked as inheriting default class="text-neg p-m icon-button" data-role-id="{{ $role->id }}" data-role-name="{{ $role->display_name }}" - title="Remove Row"> - @icon('close') Remove Row + title="{{ trans('common.remove') }}"> + @icon('close') {{ trans('common.remove') }}
@endif diff --git a/resources/views/form/entity-permissions.blade.php b/resources/views/form/entity-permissions.blade.php index 5e6503e0e..724d0fb39 100644 --- a/resources/views/form/entity-permissions.blade.php +++ b/resources/views/form/entity-permissions.blade.php @@ -11,20 +11,13 @@

{{ $title }}

-{{--

{{ trans('entities.permissions_intro') }}

--}}

- Set permissions here to override the default permissions provided by user roles. + {{ trans('entities.permissions_desc') }} @if($model instanceof \BookStack\Entities\Models\Book) -
- Permissions set on books will automatically cascade to child chapters and pages, unless - they have their own permissions defined. - @endif - - @if($model instanceof \BookStack\Entities\Models\Chapter) -
- Permissions set on chapters will automatically cascade to child pages, unless - they have their own permissions defined. +
{{ trans('entities.permissions_book_cascade') }} + @elseif($model instanceof \BookStack\Entities\Models\Chapter) +
{{ trans('entities.permissions_chapter_cascade') }} @endif

@@ -55,7 +48,7 @@
- +