From 57dc53ceff99e65c726f59c8b14a599878adba59 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Thu, 17 Nov 2016 13:33:07 +0000 Subject: [PATCH] Extracted text from book & chapter views --- phpunit.xml | 1 + resources/lang/en/common.php | 16 ++++ resources/lang/en/entities.php | 75 +++++++++++++++++++ .../views/auth/passwords/reset.blade.php | 2 +- resources/views/books/create.blade.php | 2 +- resources/views/books/delete.blade.php | 10 +-- resources/views/books/edit.blade.php | 2 +- resources/views/books/form.blade.php | 8 +- resources/views/books/index.blade.php | 16 ++-- resources/views/books/restrictions.blade.php | 2 +- resources/views/books/show.blade.php | 36 ++++----- resources/views/chapters/create.blade.php | 2 +- resources/views/chapters/delete.blade.php | 11 ++- resources/views/chapters/edit.blade.php | 2 +- resources/views/chapters/form.blade.php | 8 +- resources/views/chapters/list-item.blade.php | 2 +- resources/views/chapters/move.blade.php | 6 +- .../views/chapters/restrictions.blade.php | 2 +- resources/views/chapters/show.blade.php | 41 +++++----- resources/views/pages/show.blade.php | 6 +- .../views/pages/sidebar-tree-list.blade.php | 10 +-- .../views/partials/entity-meta.blade.php | 13 ++++ tests/Auth/AuthTest.php | 4 +- tests/Auth/LdapTest.php | 8 +- tests/Entity/EntityTest.php | 2 +- tests/Permissions/RolesTest.php | 2 +- 26 files changed, 191 insertions(+), 98 deletions(-) create mode 100644 resources/lang/en/common.php create mode 100644 resources/lang/en/entities.php create mode 100644 resources/views/partials/entity-meta.blade.php diff --git a/phpunit.xml b/phpunit.xml index 72e06a3fc..2e07cdbf8 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -22,6 +22,7 @@ + diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php new file mode 100644 index 000000000..8daf0a1c8 --- /dev/null +++ b/resources/lang/en/common.php @@ -0,0 +1,16 @@ + 'Cancel', + 'confirm' => 'Confirm', + + + /** + * Form Labels + */ + 'name' => 'Name', + 'description' => 'Description', +]; \ No newline at end of file diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php new file mode 100644 index 000000000..d832720b0 --- /dev/null +++ b/resources/lang/en/entities.php @@ -0,0 +1,75 @@ + 'Recently Created', + 'recently_update' => 'Recently Updated', + 'recently_viewed' => 'Recently Viewed', + 'recent_activity' => 'Recent Activity', + 'create_now' => 'Create one now', + 'edit' => 'Edit', + 'sort' => 'Sort', + 'move' => 'Move', + 'permissions' => 'Permissions', + 'delete' => 'Delete', + 'meta_created' => 'Created :timeLength', + 'meta_created_name' => 'Created :timeLength by :user', + 'meta_updated' => 'Updated :timeLength', + 'meta_updated_name' => 'Updated :timeLength by :user', + 'x_pages' => ':count Pages', + + /** + * Search + */ + 'search_results' => 'Search Results', + 'search_clear' => 'Clear Search', + + /** + * Books + */ + 'books' => 'Books', + 'books_empty' => 'No books have been created', + 'books_popular' => 'Popular Books', + 'books_popular_empty' => 'The most popular books will appear here.', + 'books_create' => 'Create New Book', + 'books_delete' => 'Delete Book', + 'books_delete_explain' => 'This will delete the book with the name \':bookName\', All pages and chapters will be removed.', + 'books_delete_confirmation' => 'Are you sure you want to delete this book?', + 'books_edit' => 'Edit Book', + 'books_form_book_name' => 'Book Name', + 'books_save' => 'Save Book', + 'books_permissions' => 'Book Permissions', + 'books_empty_contents' => 'No pages or chapters have been created for this book.', + 'books_empty_create_page' => 'Create a new page', + 'books_empty_or' => 'or', + 'books_empty_sort_current_book' => 'Sort the current book', + 'books_empty_add_chapter' => 'Add a chapter', + 'books_permissions_active' => 'Book Permissions Active', + 'books_search_this' => 'Search this book', + 'books_navigation' => 'Book Navigation', + + /** + * Chapters + */ + 'chapters_new' => 'New Chapter', + 'chapters_create' => 'Create New Chapter', + 'chapters_delete' => 'Delete Chapter', + 'chapters_delete_explain' => 'This will delete the chapter with the name \':chapterName\', All pages will be removed + and added directly to the parent book.', + 'chapters_delete_confirm' => 'Are you sure you want to delete this chapter?', + 'chapters_edit' => 'Edit Chapter', + 'chapters_save' => 'Save Chapter', + 'chapters_move' => 'Move Chapter', + 'chapters_permissions' => 'Chapter Permissions', + 'chapters_empty' => 'No pages are currently in this chapter.', + 'chapters_permissions_active' => 'Chapter Permissions Active', + + /** + * Pages + */ + 'pages_new' => 'New Page', + 'pages_attachments' => 'Attachments', + 'pages_navigation' => 'Page Navigation', +]; \ No newline at end of file diff --git a/resources/views/auth/passwords/reset.blade.php b/resources/views/auth/passwords/reset.blade.php index fef9ad476..a463eef45 100644 --- a/resources/views/auth/passwords/reset.blade.php +++ b/resources/views/auth/passwords/reset.blade.php @@ -1,4 +1,4 @@ -1@extends('public') +@extends('public') @section('header-buttons') {{ trans('auth.log_in') }} diff --git a/resources/views/books/create.blade.php b/resources/views/books/create.blade.php index 60f4f65bd..2c629e699 100644 --- a/resources/views/books/create.blade.php +++ b/resources/views/books/create.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Create New Book

+

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

@include('books/form')
diff --git a/resources/views/books/delete.blade.php b/resources/views/books/delete.blade.php index 68f755131..b47cae2cc 100644 --- a/resources/views/books/delete.blade.php +++ b/resources/views/books/delete.blade.php @@ -3,15 +3,15 @@ @section('content')
-

Delete Book

-

This will delete the book with the name '{{$book->name}}', All pages and chapters will be removed.

-

Are you sure you want to delete this book?

+

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

+

{{ trans('entities.books_delete_explain', ['bookName' => $book->name]) }}

+

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

{!! csrf_field() !!} - Cancel - + {{ trans('common.cancel') }} +
diff --git a/resources/views/books/edit.blade.php b/resources/views/books/edit.blade.php index e67e6f459..2b9e376e7 100644 --- a/resources/views/books/edit.blade.php +++ b/resources/views/books/edit.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Edit Book

+

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

@include('books/form', ['model' => $book]) diff --git a/resources/views/books/form.blade.php b/resources/views/books/form.blade.php index dc0fd0a3f..514abf42c 100644 --- a/resources/views/books/form.blade.php +++ b/resources/views/books/form.blade.php @@ -1,16 +1,16 @@ {{ csrf_field() }}
- + @include('form/text', ['name' => 'name'])
- + @include('form/textarea', ['name' => 'description'])
- Cancel - + {{ trans('common.cancel') }} +
\ No newline at end of file diff --git a/resources/views/books/index.blade.php b/resources/views/books/index.blade.php index 91906e7b8..c090a127e 100644 --- a/resources/views/books/index.blade.php +++ b/resources/views/books/index.blade.php @@ -9,7 +9,7 @@
@if($currentUser->can('book-create-all')) - Add new book + {{ trans('entities.books_create') }} @endif
@@ -21,7 +21,7 @@
-

Books

+

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

@if(count($books) > 0) @foreach($books as $book) @include('books/list-item', ['book' => $book]) @@ -29,27 +29,27 @@ @endforeach {!! $books->render() !!} @else -

No books have been created.

+

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

@if(userCan('books-create-all')) - Create one now + {{ trans('entities.create_one_now') }} @endif @endif
@if($recents) -
 
-

Recently Viewed

+
 
+

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

@include('partials/entity-list', ['entities' => $recents]) @endif
 
diff --git a/resources/views/books/restrictions.blade.php b/resources/views/books/restrictions.blade.php index 7fdd3abef..f14042933 100644 --- a/resources/views/books/restrictions.blade.php +++ b/resources/views/books/restrictions.blade.php @@ -16,7 +16,7 @@
-

Book Permissions

+

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

@include('form/restriction-form', ['model' => $book])
diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index 129851d5e..6ae126c63 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -8,26 +8,26 @@
@if(userCan('page-create', $book)) - New Page + {{ trans('entities.pages_new') }} @endif @if(userCan('chapter-create', $book)) - New Chapter + {{ trans('entities.chapters_new') }} @endif @if(userCan('book-update', $book)) - Edit + {{ trans('entities.edit') }} @endif @if(userCan('book-update', $book) || userCan('restrictions-manage', $book) || userCan('book-delete', $book)) @@ -59,23 +59,19 @@
@endforeach @else -

No pages or chapters have been created for this book.

+

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

- Create a new page -   -or-    - Add a chapter + {{ trans('entities.books_empty_create_page') }} +   -{{ trans('entities.books_empty_or') }}-    + {{ trans('entities.books_empty_add_chapter') }}


@endif -

- Created {{$book->created_at->diffForHumans()}} @if($book->createdBy) by {{$book->createdBy->name}} @endif -
- Last Updated {{$book->updated_at->diffForHumans()}} @if($book->updatedBy) by {{$book->updatedBy->name}} @endif -

+ @include('partials.entity-meta', ['entity' => $book])
-

Search Results Clear Search

+

{{ trans('entities.search_results') }} {{ trans('entities.search_clear') }}

@include('partials/loading-icon')
@@ -90,21 +86,21 @@ @if($book->restricted)

@if(userCan('restrictions-manage', $book)) - Book Permissions Active + {{ trans('entities.books_permissions_active') }} @else - Book Permissions Active + {{ trans('entities.books_permissions_active') }} @endif

@endif
-

Recent Activity

+

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

@include('partials/activity-list', ['activity' => Activity::entityActivity($book, 20, 0)])
diff --git a/resources/views/chapters/create.blade.php b/resources/views/chapters/create.blade.php index b81cb15d7..afdbfa99d 100644 --- a/resources/views/chapters/create.blade.php +++ b/resources/views/chapters/create.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Create New Chapter

+

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

@include('chapters/form')
diff --git a/resources/views/chapters/delete.blade.php b/resources/views/chapters/delete.blade.php index e9573f228..7005312c8 100644 --- a/resources/views/chapters/delete.blade.php +++ b/resources/views/chapters/delete.blade.php @@ -3,16 +3,15 @@ @section('content')
-

Delete Chapter

-

This will delete the chapter with the name '{{$chapter->name}}', All pages will be removed - and added directly to the book.

-

Are you sure you want to delete this chapter?

+

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

+

{{ trans('entities.chapters_delete_explain', ['chapterName' => $chapter->name]) }}

+

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

{!! csrf_field() !!} - Cancel - + {{ trans('common.cancel') }} +
diff --git a/resources/views/chapters/edit.blade.php b/resources/views/chapters/edit.blade.php index 0363da96d..272543e67 100644 --- a/resources/views/chapters/edit.blade.php +++ b/resources/views/chapters/edit.blade.php @@ -3,7 +3,7 @@ @section('content')
-

Edit Chapter

+

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

@include('chapters/form', ['model' => $chapter]) diff --git a/resources/views/chapters/form.blade.php b/resources/views/chapters/form.blade.php index 70df4737a..54722a58a 100644 --- a/resources/views/chapters/form.blade.php +++ b/resources/views/chapters/form.blade.php @@ -2,16 +2,16 @@ {!! csrf_field() !!}
- + @include('form/text', ['name' => 'name'])
- + @include('form/textarea', ['name' => 'description'])
- Cancel - + {{ trans('common.cancel') }} +
diff --git a/resources/views/chapters/list-item.blade.php b/resources/views/chapters/list-item.blade.php index f70e59244..8487a63a3 100644 --- a/resources/views/chapters/list-item.blade.php +++ b/resources/views/chapters/list-item.blade.php @@ -17,7 +17,7 @@ @endif @if(!isset($hidePages) && count($chapter->pages) > 0) -

{{ count($chapter->pages) }} Pages

+

{{ trans('entities.x_pages', ['count' => $chapter->pages->count()]) }}

@foreach($chapter->pages as $page)
{{$page->name}}
diff --git a/resources/views/chapters/move.blade.php b/resources/views/chapters/move.blade.php index 37d56d30d..291ab5015 100644 --- a/resources/views/chapters/move.blade.php +++ b/resources/views/chapters/move.blade.php @@ -17,7 +17,7 @@
-

Move Chapter {{$chapter->name}}

+

{{ trans('entities.chapters_move') }} {{$chapter->name}}

{!! csrf_field() !!} @@ -25,8 +25,8 @@ @include('partials/entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book']) - Cancel - + {{ trans('common.cancel') }} +
diff --git a/resources/views/chapters/restrictions.blade.php b/resources/views/chapters/restrictions.blade.php index 771665037..7a38fa104 100644 --- a/resources/views/chapters/restrictions.blade.php +++ b/resources/views/chapters/restrictions.blade.php @@ -17,7 +17,7 @@
-

Chapter Permissions

+

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

@include('form/restriction-form', ['model' => $chapter])
diff --git a/resources/views/chapters/show.blade.php b/resources/views/chapters/show.blade.php index 70b09e9ce..d929d61cc 100644 --- a/resources/views/chapters/show.blade.php +++ b/resources/views/chapters/show.blade.php @@ -13,23 +13,23 @@
@if(userCan('page-create', $chapter)) - New Page + {{ trans('entities.pages_new') }} @endif @if(userCan('chapter-update', $chapter)) - Edit + {{ trans('entities.edit') }} @endif @if(userCan('chapter-update', $chapter) || userCan('restrictions-manage', $chapter) || userCan('chapter-delete', $chapter)) @@ -57,26 +57,22 @@
@else
-

No pages are currently in this chapter.

+

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

@if(userCan('page-create', $chapter)) - Create a new page + {{ trans('entities.books_empty_create_page') }} @endif @if(userCan('page-create', $chapter) && userCan('book-update', $book)) -   -or-    +   -{{ trans('entities.books_empty_or') }}-    @endif @if(userCan('book-update', $book)) - Sort the current book + {{ trans('entities.books_empty_sort_current_book') }} @endif


@endif -

- Created {{ $chapter->created_at->diffForHumans() }} @if($chapter->createdBy) by {{ $chapter->createdBy->name}} @endif -
- Last Updated {{ $chapter->updated_at->diffForHumans() }} @if($chapter->updatedBy) by {{ $chapter->updatedBy->name}} @endif -

+ @include('partials.entity-meta', ['entity' => $chapter])
@@ -84,19 +80,20 @@
@if($book->restricted) - @if(userCan('restrictions-manage', $book)) - Book Permissions Active - @else - Book Permissions Active - @endif -
+

+ @if(userCan('restrictions-manage', $book)) + {{ trans('entities.books_permissions_active') }} + @else + {{ trans('entities.books_permissions_active') }} + @endif +

@endif @if($chapter->restricted) @if(userCan('restrictions-manage', $chapter)) - Chapter Permissions Active + {{ trans('entities.chapters_permissions_active') }} @else - Chapter Permissions Active + {{ trans('entities.chapters_permissions_active') }} @endif @endif
diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php index af85075a2..0a96afdab 100644 --- a/resources/views/pages/show.blade.php +++ b/resources/views/pages/show.blade.php @@ -72,11 +72,7 @@
-

- Created {{ $page->created_at->diffForHumans() }} @if($page->createdBy) by {{$page->createdBy->name}} @endif -
- Last Updated {{ $page->updated_at->diffForHumans() }} @if($page->updatedBy) by {{$page->updatedBy->name}} @endif -

+ @include('partials.entity-meta', ['entity' => $page])
diff --git a/resources/views/pages/sidebar-tree-list.blade.php b/resources/views/pages/sidebar-tree-list.blade.php index 09d9b77f9..74ce6c34d 100644 --- a/resources/views/pages/sidebar-tree-list.blade.php +++ b/resources/views/pages/sidebar-tree-list.blade.php @@ -2,16 +2,16 @@
@if (isset($page) && $page->attachments->count() > 0) -
Attachments
+
{{ trans('entities.pages_attachments') }}
@foreach($page->attachments as $attachment) @endforeach @endif @if (isset($pageNav) && $pageNav) -
Page Navigation
+
{{ trans('entities.pages_navigation') }}
@endif -
Book Navigation
+
{{ trans('entities.books_navigation') }}