From 35e6635379d8a4027ddba559a9ff51eb7f83969e Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 25 May 2019 15:21:02 +0100 Subject: [PATCH 01/85] Fixed chapter description not showing in book exports Closes #1465 --- resources/views/books/export.blade.php | 2 +- tests/Entity/ExportTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/resources/views/books/export.blade.php b/resources/views/books/export.blade.php index e1fabd800..61c16c72d 100644 --- a/resources/views/books/export.blade.php +++ b/resources/views/books/export.blade.php @@ -58,7 +58,7 @@

{{ $bookChild->name }}

@if($bookChild->isA('chapter')) -

{{ $bookChild->description }}

+

{{ $bookChild->text }}

@if(count($bookChild->pages) > 0) @foreach($bookChild->pages as $page) diff --git a/tests/Entity/ExportTest.php b/tests/Entity/ExportTest.php index fdcd83366..683f23674 100644 --- a/tests/Entity/ExportTest.php +++ b/tests/Entity/ExportTest.php @@ -76,6 +76,20 @@ class ExportTest extends TestCase $resp->assertHeader('Content-Disposition', 'attachment; filename="' . $book->slug . '.html"'); } + public function test_book_html_export_shows_chapter_descriptions() + { + $chapterDesc = 'My custom test chapter description ' . str_random(12); + $chapter = Chapter::query()->first(); + $chapter->description = $chapterDesc; + $chapter->save(); + + $book = $chapter->book; + $this->asEditor(); + + $resp = $this->get($book->getUrl('/export/html')); + $resp->assertSee($chapterDesc); + } + public function test_chapter_text_export() { $chapter = Chapter::first(); From 78f5f44460cb468133becc05169afdc1bf6b32ac Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 25 May 2019 15:37:49 +0100 Subject: [PATCH 02/85] Updated page navigation click to show content tab on mobile Fixes #1454 --- .../assets/js/components/page-display.js | 1 + resources/assets/js/components/tri-layout.js | 32 ++++++++++++++----- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/resources/assets/js/components/page-display.js b/resources/assets/js/components/page-display.js index e87966d7d..513a07b8d 100644 --- a/resources/assets/js/components/page-display.js +++ b/resources/assets/js/components/page-display.js @@ -20,6 +20,7 @@ class PageDisplay { // Sidebar page nav click event $('.sidebar-page-nav').on('click', 'a', event => { + window.components['tri-layout'][0].showContent(); this.goToText(event.target.getAttribute('href').substr(1)); }); } diff --git a/resources/assets/js/components/tri-layout.js b/resources/assets/js/components/tri-layout.js index 0ae7df976..5cd49b74f 100644 --- a/resources/assets/js/components/tri-layout.js +++ b/resources/assets/js/components/tri-layout.js @@ -66,28 +66,44 @@ class TriLayout { */ mobileTabClick(event) { const tab = event.target.getAttribute('tri-layout-mobile-tab'); + this.showTab(tab); + } + + /** + * Show the content tab. + * Used by the page-display component. + */ + showContent() { + this.showTab('content'); + } + + /** + * Show the given tab + * @param tabName + */ + showTab(tabName) { this.scrollCache[this.lastTabShown] = document.documentElement.scrollTop; // Set tab status - const activeTabs = document.querySelectorAll('.tri-layout-mobile-tab.active'); - for (let tab of activeTabs) { - tab.classList.remove('active'); + const tabs = document.querySelectorAll('.tri-layout-mobile-tab'); + for (let tab of tabs) { + const isActive = (tab.getAttribute('tri-layout-mobile-tab') === tabName); + tab.classList.toggle('active', isActive); } - event.target.classList.add('active'); // Toggle section - const showInfo = (tab === 'info'); + const showInfo = (tabName === 'info'); this.elem.classList.toggle('show-info', showInfo); // Set the scroll position from cache const pageHeader = document.querySelector('header'); const defaultScrollTop = pageHeader.getBoundingClientRect().bottom; - document.documentElement.scrollTop = this.scrollCache[tab] || defaultScrollTop; + document.documentElement.scrollTop = this.scrollCache[tabName] || defaultScrollTop; setTimeout(() => { - document.documentElement.scrollTop = this.scrollCache[tab] || defaultScrollTop; + document.documentElement.scrollTop = this.scrollCache[tabName] || defaultScrollTop; }, 50); - this.lastTabShown = tab; + this.lastTabShown = tabName; } } From 13c0386e84ac1e26cf0db44024a3c0e8de40b5e0 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 25 May 2019 16:14:57 +0100 Subject: [PATCH 03/85] Updated string functions to use mulitbyte versions where needed Fixes #816 --- app/Auth/User.php | 4 ++-- app/Console/Commands/CreateAdmin.php | 6 +++--- app/Entities/Book.php | 2 +- app/Entities/Bookshelf.php | 2 +- app/Entities/Chapter.php | 2 +- app/Entities/Repos/PageRepo.php | 8 ++++---- app/Http/Controllers/Auth/RegisterController.php | 2 +- app/helpers.php | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/Auth/User.php b/app/Auth/User.php index 12f022b06..259b8eec0 100644 --- a/app/Auth/User.php +++ b/app/Auth/User.php @@ -216,12 +216,12 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon */ public function getShortName($chars = 8) { - if (strlen($this->name) <= $chars) { + if (mb_strlen($this->name) <= $chars) { return $this->name; } $splitName = explode(' ', $this->name); - if (strlen($splitName[0]) <= $chars) { + if (mb_strlen($splitName[0]) <= $chars) { return $splitName[0]; } diff --git a/app/Console/Commands/CreateAdmin.php b/app/Console/Commands/CreateAdmin.php index 90c1ddb1c..e67da8717 100644 --- a/app/Console/Commands/CreateAdmin.php +++ b/app/Console/Commands/CreateAdmin.php @@ -49,7 +49,7 @@ class CreateAdmin extends Command if (empty($email)) { $email = $this->ask('Please specify an email address for the new admin user'); } - if (strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) { + if (mb_strlen($email) < 5 || !filter_var($email, FILTER_VALIDATE_EMAIL)) { return $this->error('Invalid email address provided'); } @@ -61,7 +61,7 @@ class CreateAdmin extends Command if (empty($name)) { $name = $this->ask('Please specify an name for the new admin user'); } - if (strlen($name) < 2) { + if (mb_strlen($name) < 2) { return $this->error('Invalid name provided'); } @@ -69,7 +69,7 @@ class CreateAdmin extends Command if (empty($password)) { $password = $this->secret('Please specify a password for the new admin user'); } - if (strlen($password) < 5) { + if (mb_strlen($password) < 5) { return $this->error('Invalid password provided, Must be at least 5 characters'); } diff --git a/app/Entities/Book.php b/app/Entities/Book.php index 77cacf632..decdde9dc 100644 --- a/app/Entities/Book.php +++ b/app/Entities/Book.php @@ -104,7 +104,7 @@ class Book extends Entity public function getExcerpt(int $length = 100) { $description = $this->description; - return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description; + return mb_strlen($description) > $length ? mb_substr($description, 0, $length-3) . '...' : $description; } /** diff --git a/app/Entities/Bookshelf.php b/app/Entities/Bookshelf.php index 1de767fec..c8f8b990c 100644 --- a/app/Entities/Bookshelf.php +++ b/app/Entities/Bookshelf.php @@ -83,7 +83,7 @@ class Bookshelf extends Entity public function getExcerpt(int $length = 100) { $description = $this->description; - return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description; + return mb_strlen($description) > $length ? mb_substr($description, 0, $length-3) . '...' : $description; } /** diff --git a/app/Entities/Chapter.php b/app/Entities/Chapter.php index bdacb7c9d..936404758 100644 --- a/app/Entities/Chapter.php +++ b/app/Entities/Chapter.php @@ -56,7 +56,7 @@ class Chapter extends Entity public function getExcerpt(int $length = 100) { $description = $this->text ?? $this->description; - return strlen($description) > $length ? substr($description, 0, $length-3) . '...' : $description; + return mb_strlen($description) > $length ? mb_substr($description, 0, $length-3) . '...' : $description; } /** diff --git a/app/Entities/Repos/PageRepo.php b/app/Entities/Repos/PageRepo.php index 208aa5fa3..e6cb309e7 100644 --- a/app/Entities/Repos/PageRepo.php +++ b/app/Entities/Repos/PageRepo.php @@ -192,7 +192,7 @@ class PageRepo extends EntityRepo // Create an unique id for the element // Uses the content as a basis to ensure output is the same every time // the same content is passed through. - $contentId = 'bkmrk-' . substr(strtolower(preg_replace('/\s+/', '-', trim($element->nodeValue))), 0, 20); + $contentId = 'bkmrk-' . mb_substr(strtolower(preg_replace('/\s+/', '-', trim($element->nodeValue))), 0, 20); $newId = urlencode($contentId); $loopIndex = 0; @@ -424,8 +424,8 @@ class PageRepo extends EntityRepo $tree = collect($headers)->map(function($header) { $text = trim(str_replace("\xc2\xa0", '', $header->nodeValue)); - if (strlen($text) > 30) { - $text = substr($text, 0, 27) . '...'; + if (mb_strlen($text) > 30) { + $text = mb_substr($text, 0, 27) . '...'; } return [ @@ -435,7 +435,7 @@ class PageRepo extends EntityRepo 'text' => $text, ]; })->filter(function($header) { - return strlen($header['text']) > 0; + return mb_strlen($header['text']) > 0; }); // Normalise headers if only smaller headers have been used diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 79d696652..d57105b62 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -142,7 +142,7 @@ class RegisterController extends Controller if ($registrationRestrict) { $restrictedEmailDomains = explode(',', str_replace(' ', '', $registrationRestrict)); - $userEmailDomain = $domain = substr(strrchr($userData['email'], "@"), 1); + $userEmailDomain = $domain = mb_substr(mb_strrchr($userData['email'], "@"), 1); if (!in_array($userEmailDomain, $restrictedEmailDomains)) { throw new UserRegistrationException(trans('auth.registration_email_domain_invalid'), '/register'); } diff --git a/app/helpers.php b/app/helpers.php index 0fedf2e8d..8cb3fa3f4 100644 --- a/app/helpers.php +++ b/app/helpers.php @@ -123,7 +123,7 @@ function baseUrl($path, $forceAppDomain = false) // Remove non-specified domain if forced and we have a domain if ($isFullUrl && $forceAppDomain) { if (!empty($base) && strpos($path, $base) === 0) { - $path = substr($path, strlen($base)); + $path = mb_substr($path, mb_strlen($base)); } else { $explodedPath = explode('/', $path); $path = implode('/', array_splice($explodedPath, 3)); From 35f35bcba5866c288a7b22666b940aedb64fe1ed Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 25 May 2019 16:35:09 +0100 Subject: [PATCH 04/85] Updated custom home views to use tri-layout Closes #1423 --- resources/views/books/index.blade.php | 2 - resources/views/common/home-book.blade.php | 28 ++++++-------- resources/views/common/home-custom.blade.php | 38 +++++++++---------- resources/views/common/home-shelves.blade.php | 28 ++++++-------- 4 files changed, 42 insertions(+), 54 deletions(-) diff --git a/resources/views/books/index.blade.php b/resources/views/books/index.blade.php index 38286c201..61d998489 100644 --- a/resources/views/books/index.blade.php +++ b/resources/views/books/index.blade.php @@ -1,7 +1,5 @@ @extends('tri-layout') -@section('container-classes', 'mt-xl') - @section('body') @include('books.list', ['books' => $books, 'view' => $view]) @stop diff --git a/resources/views/common/home-book.blade.php b/resources/views/common/home-book.blade.php index 0efaa32ec..7644eeb88 100644 --- a/resources/views/common/home-book.blade.php +++ b/resources/views/common/home-book.blade.php @@ -1,23 +1,19 @@ -@extends('simple-layout') +@extends('tri-layout') @section('body') -
-
-
+ @include('books.list', ['books' => $books, 'view' => $view]) +@stop -
-
{{ trans('common.actions') }}
-
- @include('partials.view-toggle', ['view' => $view, 'type' => 'book']) - @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details']) -
-
+@section('left') + @include('common.home-sidebar') +@stop - @include('common.home-sidebar') -
-
- @include('books.list', ['books' => $books, 'view' => $view]) -
+@section('right') +
+
{{ trans('common.actions') }}
+
+ @include('partials.view-toggle', ['view' => $view, 'type' => 'book']) + @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
@stop \ No newline at end of file diff --git a/resources/views/common/home-custom.blade.php b/resources/views/common/home-custom.blade.php index f1133a607..c93fa1a24 100644 --- a/resources/views/common/home-custom.blade.php +++ b/resources/views/common/home-custom.blade.php @@ -1,26 +1,24 @@ -@extends('simple-layout') +@extends('tri-layout') @section('body') -
-
-
- -
-
{{ trans('common.actions') }}
-
- @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details']) -
-
- - @include('common.home-sidebar') -
-
-
-
- @include('pages.page-display', ['page' => $customHomepage]) -
-
+
+
+
+ @include('pages.page-display', ['page' => $customHomepage])
+@stop + +@section('left') + @include('common.home-sidebar') +@stop + +@section('right') +
+
{{ trans('common.actions') }}
+
+ @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details']) +
+
@stop \ No newline at end of file diff --git a/resources/views/common/home-shelves.blade.php b/resources/views/common/home-shelves.blade.php index f09bfd416..a9c585893 100644 --- a/resources/views/common/home-shelves.blade.php +++ b/resources/views/common/home-shelves.blade.php @@ -1,23 +1,19 @@ -@extends('simple-layout') +@extends('tri-layout') @section('body') -
-
-
+ @include('shelves.list', ['shelves' => $shelves, 'view' => $view]) +@stop -
-
{{ trans('common.actions') }}
-
- @include('partials.view-toggle', ['view' => $view, 'type' => 'shelf']) - @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details']) -
-
+@section('left') + @include('common.home-sidebar') +@stop - @include('common.home-sidebar') -
-
- @include('shelves.list', ['shelves' => $shelves, 'view' => $view]) -
+@section('right') +
+
{{ trans('common.actions') }}
+
+ @include('partials.view-toggle', ['view' => $view, 'type' => 'shelf']) + @include('components.expand-toggle', ['target' => '.entity-list.compact .entity-item-snippet', 'key' => 'home-details'])
@stop \ No newline at end of file From 2b7362fa946af34186fdcbf9fcc8219e793a57e5 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 25 May 2019 16:52:17 +0100 Subject: [PATCH 05/85] Added highlighting to current book-tree item Related to #1435 --- resources/assets/sass/_lists.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/assets/sass/_lists.scss b/resources/assets/sass/_lists.scss index 9c141232e..cafbfa781 100644 --- a/resources/assets/sass/_lists.scss +++ b/resources/assets/sass/_lists.scss @@ -164,15 +164,21 @@ padding-left: 1rem; padding-right: 0; } + .entity-list-item { padding-top: $-xxs; padding-bottom: $-xxs; + background-clip: content-box; + border-radius: 0 3px 3px 0; .content { padding-top: $-xs; padding-bottom: $-xs; max-width: calc(100% - 20px); } } + .entity-list-item.selected { + background-color: rgba(0, 0, 0, 0.08); + } .entity-list-item.no-hover { margin-top: -$-xs; padding-right: 0; From 3ad1b42a74a4aeb8e131404071faec4a14f270f9 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 27 May 2019 12:40:19 +0100 Subject: [PATCH 06/85] Updated page delete to handle inactive custom homepage correctly Fixes #1447 --- app/Entities/Repos/EntityRepo.php | 7 +++++-- tests/HomepageTest.php | 23 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/app/Entities/Repos/EntityRepo.php b/app/Entities/Repos/EntityRepo.php index a0934530f..4edd61723 100644 --- a/app/Entities/Repos/EntityRepo.php +++ b/app/Entities/Repos/EntityRepo.php @@ -852,10 +852,13 @@ class EntityRepo */ public function destroyPage(Page $page) { - // Check if set as custom homepage + // Check if set as custom homepage & remove setting if not used or throw error if active $customHome = setting('app-homepage', '0:'); if (intval($page->id) === intval(explode(':', $customHome)[0])) { - throw new NotifyException(trans('errors.page_custom_home_deletion'), $page->getUrl()); + if (setting('app-homepage-type') === 'page') { + throw new NotifyException(trans('errors.page_custom_home_deletion'), $page->getUrl()); + } + setting()->remove('app-homepage'); } $this->destroyEntityCommonRelations($page); diff --git a/tests/HomepageTest.php b/tests/HomepageTest.php index 286d4cf60..ada1f5aaf 100644 --- a/tests/HomepageTest.php +++ b/tests/HomepageTest.php @@ -38,10 +38,14 @@ class HomepageTest extends TestCase $name = 'My custom homepage'; $content = str_repeat('This is the body content of my custom homepage.', 20); $customPage = $this->newPage(['name' => $name, 'html' => $content]); - $this->setSettings(['app-homepage' => $customPage->id]); + $this->setSettings([ + 'app-homepage' => $customPage->id, + 'app-homepage-type' => 'page' + ]); $homeVisit = $this->get('/'); $homeVisit->assertSee($name); + $homeVisit->assertElementNotExists('#home-default'); $pageDeleteReq = $this->delete($customPage->getUrl()); $pageDeleteReq->assertStatus(302); @@ -54,6 +58,23 @@ class HomepageTest extends TestCase $homeVisit->assertStatus(200); } + public function test_custom_homepage_can_be_deleted_once_custom_homepage_no_longer_used() + { + $this->asEditor(); + $name = 'My custom homepage'; + $content = str_repeat('This is the body content of my custom homepage.', 20); + $customPage = $this->newPage(['name' => $name, 'html' => $content]); + $this->setSettings([ + 'app-homepage' => $customPage->id, + 'app-homepage-type' => 'default' + ]); + + $pageDeleteReq = $this->delete($customPage->getUrl()); + $pageDeleteReq->assertStatus(302); + $pageDeleteReq->assertSessionHas('success'); + $pageDeleteReq->assertSessionMissing('error'); + } + public function test_set_book_homepage() { $editor = $this->getEditor(); From 5aa741cb60ac8db7abf60a317d61a1a6beebc97e Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 27 May 2019 12:56:17 +0100 Subject: [PATCH 07/85] Prevented tri-layout sidebars being faded on mobile As mentoined in #1441 --- resources/assets/sass/_layout.scss | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/resources/assets/sass/_layout.scss b/resources/assets/sass/_layout.scss index 4be6edb56..d9fff3c41 100644 --- a/resources/assets/sass/_layout.scss +++ b/resources/assets/sass/_layout.scss @@ -257,10 +257,6 @@ body.flexbox { padding-left: $-m; padding-right: $-m; } - .tri-layout-right-contents > div, .tri-layout-left-contents > div { - opacity: 0.6; - z-index: 0; - } .tri-layout-left > *, .tri-layout-right > * { display: none; pointer-events: none; @@ -298,6 +294,13 @@ body.flexbox { .tri-layout-mobile-tabs { display: none; } + .tri-layout-left-contents > div, .tri-layout-right-contents > div { + opacity: 0.6; + transition: opacity ease-in-out 120ms; + &:hover { + opacity: 1; + } + } } @include smaller-than($m) { @@ -305,12 +308,4 @@ body.flexbox { margin-left: 0; margin-right: 0; } -} - -.tri-layout-left-contents > div, .tri-layout-right-contents > div { - opacity: 0.6; - transition: opacity ease-in-out 120ms; - &:hover { - opacity: 1; - } } \ No newline at end of file From a602cdf401b9d48f9b7d67de4240a3e127e51fe1 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 27 May 2019 13:10:48 +0100 Subject: [PATCH 08/85] Fixed some body card horizontal scroll and column collapse issues As mentoined in #1441 --- resources/assets/sass/_blocks.scss | 4 ++-- resources/assets/sass/_text.scss | 16 ++++++++++++++-- resources/views/books/list.blade.php | 4 ++-- resources/views/comments/comments.blade.php | 4 ++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/resources/assets/sass/_blocks.scss b/resources/assets/sass/_blocks.scss index c43ff7f78..032b1cbeb 100644 --- a/resources/assets/sass/_blocks.scss +++ b/resources/assets/sass/_blocks.scss @@ -181,7 +181,7 @@ margin-left: auto; margin-right: auto; margin-bottom: $-xl; - overflow: auto; + overflow: initial; min-height: 60vh; &.auto-height { min-height: 0; @@ -202,7 +202,7 @@ } @include smaller-than($s) { .content-wrap.card { - padding: $-m $-s; + padding: $-m $-m; } } diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index 41c99bbe5..1a613898e 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -291,15 +291,27 @@ li.checkbox-item, li.task-list-item { .text-center { text-align: center; } - .text-left { text-align: left; } - .text-right { text-align: right; } +@each $sizeLetter, $size in $screen-sizes { + @include larger-than($size) { + .text-#{$sizeLetter}-center { + text-align: center; + } + .text-#{$sizeLetter}-left { + text-align: left; + } + .text-#{$sizeLetter}-right { + text-align: right; + } + } +} + .text-bigger { font-size: 1.1em; } diff --git a/resources/views/books/list.blade.php b/resources/views/books/list.blade.php index 91a2c716e..93d927ec7 100644 --- a/resources/views/books/list.blade.php +++ b/resources/views/books/list.blade.php @@ -1,8 +1,8 @@
-
+

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

-
+
@include('partials.sort', ['options' => $sortOptions, 'order' => $order, 'sort' => $sort, 'type' => 'books']) diff --git a/resources/views/comments/comments.blade.php b/resources/views/comments/comments.blade.php index 4848977c9..cfc89340d 100644 --- a/resources/views/comments/comments.blade.php +++ b/resources/views/comments/comments.blade.php @@ -1,8 +1,8 @@
-
+
{{ trans_choice('entities.comment_count', count($page->comments), ['count' => count($page->comments)]) }}
@if (count($page->comments) === 0) -
+
From a9f983f1564d7922d1db6abd0d08d70b74797c6f Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 4 Jun 2019 10:45:44 +0100 Subject: [PATCH 09/85] Added focus and a11y attributes/functionality to custom checkboxes Closes #1476 --- .../assets/js/components/custom-checkbox.js | 34 +++++++++++++++++++ resources/assets/js/components/index.js | 2 ++ .../assets/js/components/toggle-switch.js | 7 ++-- resources/views/auth/login.blade.php | 1 + .../components/custom-checkbox.blade.php | 8 +++-- .../views/components/toggle-switch.blade.php | 7 ++-- 6 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 resources/assets/js/components/custom-checkbox.js diff --git a/resources/assets/js/components/custom-checkbox.js b/resources/assets/js/components/custom-checkbox.js new file mode 100644 index 000000000..65ce8c194 --- /dev/null +++ b/resources/assets/js/components/custom-checkbox.js @@ -0,0 +1,34 @@ + +class CustomCheckbox { + + constructor(elem) { + this.elem = elem; + this.checkbox = elem.querySelector('input[type=checkbox]'); + this.display = elem.querySelector('[role="checkbox"]'); + + this.checkbox.addEventListener('change', this.stateChange.bind(this)); + this.elem.addEventListener('keydown', this.onKeyDown.bind(this)); + } + + onKeyDown(event) { + const isEnterOrPress = event.keyCode === 32 || event.keyCode === 13; + if (isEnterOrPress) { + event.preventDefault(); + this.toggle(); + } + } + + toggle() { + this.checkbox.checked = !this.checkbox.checked; + this.checkbox.dispatchEvent(new Event('change')); + this.stateChange(); + } + + stateChange() { + const checked = this.checkbox.checked ? 'true' : 'false'; + this.display.setAttribute('aria-checked', checked); + } + +} + +export default CustomCheckbox; \ No newline at end of file diff --git a/resources/assets/js/components/index.js b/resources/assets/js/components/index.js index 355b96473..bd7432b8d 100644 --- a/resources/assets/js/components/index.js +++ b/resources/assets/js/components/index.js @@ -23,6 +23,7 @@ import listSortControl from "./list-sort-control"; import triLayout from "./tri-layout"; import breadcrumbListing from "./breadcrumb-listing"; import permissionsTable from "./permissions-table"; +import customCheckbox from "./custom-checkbox"; const componentMapping = { 'dropdown': dropdown, @@ -50,6 +51,7 @@ const componentMapping = { 'tri-layout': triLayout, 'breadcrumb-listing': breadcrumbListing, 'permissions-table': permissionsTable, + 'custom-checkbox': customCheckbox, }; window.components = {}; diff --git a/resources/assets/js/components/toggle-switch.js b/resources/assets/js/components/toggle-switch.js index 3be67d5dc..3dd1ce85c 100644 --- a/resources/assets/js/components/toggle-switch.js +++ b/resources/assets/js/components/toggle-switch.js @@ -6,12 +6,11 @@ class ToggleSwitch { this.input = elem.querySelector('input[type=hidden]'); this.checkbox = elem.querySelector('input[type=checkbox]'); - this.checkbox.addEventListener('change', this.onClick.bind(this)); + this.checkbox.addEventListener('change', this.stateChange.bind(this)); } - onClick(event) { - let checked = this.checkbox.checked; - this.input.value = checked ? 'true' : 'false'; + stateChange() { + this.input.value = (this.checkbox.checked ? 'true' : 'false'); } } diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 51b47f5c7..a0e5f716c 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -22,6 +22,7 @@ 'name' => 'remember', 'checked' => false, 'value' => 'on', + 'tabindex' => 1, 'label' => trans('auth.remember_me'), ])
diff --git a/resources/views/components/custom-checkbox.blade.php b/resources/views/components/custom-checkbox.blade.php index 73b7496f8..6ba2f457f 100644 --- a/resources/views/components/custom-checkbox.blade.php +++ b/resources/views/components/custom-checkbox.blade.php @@ -3,9 +3,13 @@ $name $value $checked $label +$tabindex --}} -
diff --git a/resources/views/settings/roles/form.blade.php b/resources/views/settings/roles/form.blade.php index a9933a7a6..20b8d65ed 100644 --- a/resources/views/settings/roles/form.blade.php +++ b/resources/views/settings/roles/form.blade.php @@ -224,7 +224,7 @@ @if (isset($role) && $role->id) id}") }}" class="button outline">{{ trans('settings.role_delete') }} @endif - +
diff --git a/resources/views/shelves/form.blade.php b/resources/views/shelves/form.blade.php index 1d152a143..fa1940948 100644 --- a/resources/views/shelves/form.blade.php +++ b/resources/views/shelves/form.blade.php @@ -66,5 +66,5 @@
{{ trans('common.cancel') }} - +
\ No newline at end of file diff --git a/resources/views/users/create.blade.php b/resources/views/users/create.blade.php index b9f404bb7..109b81225 100644 --- a/resources/views/users/create.blade.php +++ b/resources/views/users/create.blade.php @@ -20,7 +20,7 @@
{{ trans('common.cancel') }} - +
diff --git a/resources/views/users/delete.blade.php b/resources/views/users/delete.blade.php index aa9811bf5..d3349c2f3 100644 --- a/resources/views/users/delete.blade.php +++ b/resources/views/users/delete.blade.php @@ -20,7 +20,7 @@ id}") }}" class="button outline">{{ trans('common.cancel') }} - +
diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 92a36c943..9f8fba8df 100644 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -58,7 +58,7 @@ @if($authMethod !== 'system') id}/delete") }}" class="button outline">{{ trans('settings.users_delete') }} @endif - +
From cf5d51e7b8c9172906f7943d2d70b6b37801a2c4 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 25 Aug 2019 15:44:51 +0100 Subject: [PATCH 73/85] Made another mass of accessibility improvements - Set proper semantic tags for main parts of content. - Removed focus-trap from tag manager/autosuggest. - Set better accessibility labelling on tag manager. - Updated collapsible sections to be keyboard navigatable. - Improved input focus styling to better fit theme. - Updated custom styled file picker to be accessible via keyboard. Related to #1320 --- resources/assets/js/components/collapsible.js | 2 ++ .../assets/js/vues/components/autosuggest.js | 13 +++++----- resources/assets/js/vues/tag-manager.js | 4 +-- resources/assets/sass/_forms.scss | 22 ++++++++++++++++ resources/assets/sass/_layout.scss | 2 +- resources/lang/en/common.php | 1 + resources/lang/en/entities.php | 2 ++ resources/views/base.blade.php | 4 +-- resources/views/books/create.blade.php | 4 +-- resources/views/books/edit.blade.php | 4 +-- resources/views/books/form.blade.php | 10 +++---- resources/views/books/list.blade.php | 4 +-- resources/views/books/permissions.blade.php | 4 +-- resources/views/books/show.blade.php | 4 +-- resources/views/books/sort.blade.php | 4 +-- resources/views/chapters/create.blade.php | 4 +-- resources/views/chapters/edit.blade.php | 4 +-- resources/views/chapters/form.blade.php | 6 ++--- resources/views/chapters/move.blade.php | 4 +-- .../views/chapters/permissions.blade.php | 4 +-- resources/views/chapters/show.blade.php | 4 +-- resources/views/comments/comments.blade.php | 4 +-- resources/views/common/header.blade.php | 6 ++--- resources/views/common/home-custom.blade.php | 4 +-- .../views/components/image-picker.blade.php | 2 +- .../views/components/tag-manager.blade.php | 5 ++-- resources/views/pages/copy.blade.php | 4 +-- .../views/pages/detailed-listing.blade.php | 4 +-- resources/views/pages/guest-create.blade.php | 4 +-- resources/views/pages/move.blade.php | 4 +-- resources/views/pages/permissions.blade.php | 4 +-- resources/views/pages/revision.blade.php | 4 +-- resources/views/pages/revisions.blade.php | 4 +-- resources/views/pages/show.blade.php | 8 +++--- resources/views/partials/book-tree.blade.php | 4 +-- .../views/partials/breadcrumbs.blade.php | 4 +-- .../entity-dashboard-search-box.blade.php | 2 +- resources/views/settings/navbar.blade.php | 4 +-- resources/views/shelves/create.blade.php | 4 +-- resources/views/shelves/edit.blade.php | 4 +-- resources/views/shelves/form.blade.php | 10 +++---- resources/views/shelves/list.blade.php | 4 +-- resources/views/shelves/show.blade.php | 4 +-- resources/views/tri-layout.blade.php | 8 +++--- resources/views/users/create.blade.php | 4 +-- resources/views/users/edit.blade.php | 16 +++++++----- resources/views/users/index.blade.php | 4 +-- resources/views/users/profile.blade.php | 26 +++++++++---------- 48 files changed, 146 insertions(+), 119 deletions(-) diff --git a/resources/assets/js/components/collapsible.js b/resources/assets/js/components/collapsible.js index 40ab32508..464f394c1 100644 --- a/resources/assets/js/components/collapsible.js +++ b/resources/assets/js/components/collapsible.js @@ -18,11 +18,13 @@ class Collapsible { open() { this.elem.classList.add('open'); + this.trigger.setAttribute('aria-expanded', 'true'); slideDown(this.content, 300); } close() { this.elem.classList.remove('open'); + this.trigger.setAttribute('aria-expanded', 'false'); slideUp(this.content, 300); } diff --git a/resources/assets/js/vues/components/autosuggest.js b/resources/assets/js/vues/components/autosuggest.js index d76ee89f1..b809313cb 100644 --- a/resources/assets/js/vues/components/autosuggest.js +++ b/resources/assets/js/vues/components/autosuggest.js @@ -6,6 +6,7 @@ const template = ` @input="inputUpdate($event.target.value)" @focus="inputUpdate($event.target.value)" @blur="inputBlur" @keydown="inputKeydown" + :aria-label="placeholder" />
  • div, .tri-layout-right-contents > div { + .tri-layout-left-contents > *, .tri-layout-right-contents > * { opacity: 0.6; transition: opacity ease-in-out 120ms; &:hover { diff --git a/resources/lang/en/common.php b/resources/lang/en/common.php index e81cf6a52..1807217a3 100644 --- a/resources/lang/en/common.php +++ b/resources/lang/en/common.php @@ -59,6 +59,7 @@ return [ 'grid_view' => 'Grid View', 'list_view' => 'List View', 'default' => 'Default', + 'breadcrumb' => 'Breadcrumb', // Header 'profile_menu' => 'Profile Menu', diff --git a/resources/lang/en/entities.php b/resources/lang/en/entities.php index b4fdbf0e5..6bbc723b0 100644 --- a/resources/lang/en/entities.php +++ b/resources/lang/en/entities.php @@ -243,9 +243,11 @@ return [ 'shelf_tags' => 'Shelf Tags', 'tag' => 'Tag', 'tags' => 'Tags', + 'tag_name' => 'Tag Name', 'tag_value' => 'Tag Value (Optional)', 'tags_explain' => "Add some tags to better categorise your content. \n You can assign a value to a tag for more in-depth organisation.", 'tags_add' => 'Add another tag', + 'tags_remove' => 'Remove this tag', 'attachments' => 'Attachments', 'attachments_explain' => 'Upload some files or attach some links to display on your page. These are visible in the page sidebar.', 'attachments_explain_instant_save' => 'Changes here are saved instantly.', diff --git a/resources/views/base.blade.php b/resources/views/base.blade.php index c7fba7b64..075481620 100644 --- a/resources/views/base.blade.php +++ b/resources/views/base.blade.php @@ -30,9 +30,9 @@ @include('partials.notifications') @include('common.header') -
    +
    @yield('content') -
    +
@stop \ No newline at end of file diff --git a/resources/views/books/edit.blade.php b/resources/views/books/edit.blade.php index 2e51ed6e9..400fd6e81 100644 --- a/resources/views/books/edit.blade.php +++ b/resources/views/books/edit.blade.php @@ -14,12 +14,12 @@ ]])
-
+

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

@include('books.form', ['model' => $book])
-
+
@stop \ No newline at end of file diff --git a/resources/views/books/form.blade.php b/resources/views/books/form.blade.php index 110019002..8960b4135 100644 --- a/resources/views/books/form.blade.php +++ b/resources/views/books/form.blade.php @@ -11,9 +11,9 @@
-
- -
+

{{ trans('common.cover_image_description') }}

@@ -27,9 +27,9 @@
-
+
+
@include('components.tag-manager', ['entity' => isset($book)?$book:null, 'entityType' => 'chapter'])
diff --git a/resources/views/books/list.blade.php b/resources/views/books/list.blade.php index 84578e3a5..871d931f1 100644 --- a/resources/views/books/list.blade.php +++ b/resources/views/books/list.blade.php @@ -1,5 +1,5 @@ -
+

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

@@ -31,4 +31,4 @@ @icon('edit'){{ trans('entities.create_now') }} @endif @endif -
\ No newline at end of file +
\ No newline at end of file diff --git a/resources/views/books/permissions.blade.php b/resources/views/books/permissions.blade.php index 64322cf85..b387ed6c7 100644 --- a/resources/views/books/permissions.blade.php +++ b/resources/views/books/permissions.blade.php @@ -14,10 +14,10 @@ ]])
-
+

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

@include('form.entity-permissions', ['model' => $book]) -
+
@stop diff --git a/resources/views/books/show.blade.php b/resources/views/books/show.blade.php index 528eb5496..cbafdb436 100644 --- a/resources/views/books/show.blade.php +++ b/resources/views/books/show.blade.php @@ -14,7 +14,7 @@ ]])
-
+

{{$book->name}}

{!! nl2br(e($book->description)) !!}

@@ -53,7 +53,7 @@
@include('partials.entity-dashboard-search-results') -
+ @stop diff --git a/resources/views/books/sort.blade.php b/resources/views/books/sort.blade.php index 26ac8470f..642b88c87 100644 --- a/resources/views/books/sort.blade.php +++ b/resources/views/books/sort.blade.php @@ -35,12 +35,12 @@
-
+

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

@include('components.entity-selector', ['name' => 'books_list', 'selectorSize' => 'compact', 'entityTypes' => 'book', 'entityPermission' => 'update', 'showAdd' => true]) -
+
diff --git a/resources/views/chapters/create.blade.php b/resources/views/chapters/create.blade.php index fd2c82b46..c9787e634 100644 --- a/resources/views/chapters/create.blade.php +++ b/resources/views/chapters/create.blade.php @@ -13,12 +13,12 @@ ]])
-
+

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

@include('chapters.form')
-
+
@stop \ No newline at end of file diff --git a/resources/views/chapters/edit.blade.php b/resources/views/chapters/edit.blade.php index d282fe1dd..d8bb056f6 100644 --- a/resources/views/chapters/edit.blade.php +++ b/resources/views/chapters/edit.blade.php @@ -15,13 +15,13 @@ ]]) -
+

{{ 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 399d3fe36..cd240e685 100644 --- a/resources/views/chapters/form.blade.php +++ b/resources/views/chapters/form.blade.php @@ -12,9 +12,9 @@
-
- -
+
@include('components.tag-manager', ['entity' => isset($chapter)?$chapter:null, 'entityType' => 'chapter'])
diff --git a/resources/views/chapters/move.blade.php b/resources/views/chapters/move.blade.php index b7fe6cb0a..8663dca50 100644 --- a/resources/views/chapters/move.blade.php +++ b/resources/views/chapters/move.blade.php @@ -15,7 +15,7 @@ ]])
-
+

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

@@ -31,7 +31,7 @@
- + diff --git a/resources/views/chapters/permissions.blade.php b/resources/views/chapters/permissions.blade.php index cb5808e7d..48c954dc9 100644 --- a/resources/views/chapters/permissions.blade.php +++ b/resources/views/chapters/permissions.blade.php @@ -15,10 +15,10 @@ ]]) -
+

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

@include('form.entity-permissions', ['model' => $chapter]) -
+ @stop diff --git a/resources/views/chapters/show.blade.php b/resources/views/chapters/show.blade.php index c343115a9..105cda760 100644 --- a/resources/views/chapters/show.blade.php +++ b/resources/views/chapters/show.blade.php @@ -15,7 +15,7 @@ ]]) -
+

{{ $chapter->name }}

{!! nl2br(e($chapter->description)) !!}

@@ -50,7 +50,7 @@
@include('partials.entity-dashboard-search-results') -
+ @stop diff --git a/resources/views/comments/comments.blade.php b/resources/views/comments/comments.blade.php index 5bfcc31bd..fc81f13ee 100644 --- a/resources/views/comments/comments.blade.php +++ b/resources/views/comments/comments.blade.php @@ -1,4 +1,4 @@ -
+
@exposeTranslations([ 'entities.comment_updated_success', @@ -34,4 +34,4 @@ @endif @endif -
\ No newline at end of file + \ No newline at end of file diff --git a/resources/views/common/header.blade.php b/resources/views/common/header.blade.php index f9e12014e..192996950 100644 --- a/resources/views/common/header.blade.php +++ b/resources/views/common/header.blade.php @@ -15,7 +15,7 @@ diff --git a/resources/views/common/home-custom.blade.php b/resources/views/common/home-custom.blade.php index c93fa1a24..56e281dcb 100644 --- a/resources/views/common/home-custom.blade.php +++ b/resources/views/common/home-custom.blade.php @@ -2,11 +2,11 @@ @section('body')
-
+
@include('pages.page-display', ['page' => $customHomepage])
-
+
@stop diff --git a/resources/views/components/image-picker.blade.php b/resources/views/components/image-picker.blade.php index 73885aeb4..9c2661ccc 100644 --- a/resources/views/components/image-picker.blade.php +++ b/resources/views/components/image-picker.blade.php @@ -8,8 +8,8 @@
+ - @if(isset($removeName)) diff --git a/resources/views/components/tag-manager.blade.php b/resources/views/components/tag-manager.blade.php index 31585dc41..287856937 100644 --- a/resources/views/components/tag-manager.blade.php +++ b/resources/views/components/tag-manager.blade.php @@ -2,19 +2,18 @@

{!! nl2br(e(trans('entities.tags_explain'))) !!}

-
@icon('grip')
+ v-model="tag.name" @input="tagChange(tag)" @blur="tagBlur(tag)" placeholder="{{ trans('entities.tag_name') }}"/>
-
@icon('close')
+
diff --git a/resources/views/pages/copy.blade.php b/resources/views/pages/copy.blade.php index 2b5d7e74e..0f2af0476 100644 --- a/resources/views/pages/copy.blade.php +++ b/resources/views/pages/copy.blade.php @@ -29,9 +29,9 @@
-
+
+
@include('components.entity-selector', ['name' => 'entity_selection', 'selectorSize' => 'large', 'entityTypes' => 'book,chapter', 'entityPermission' => 'page-create'])
diff --git a/resources/views/pages/detailed-listing.blade.php b/resources/views/pages/detailed-listing.blade.php index eb2fab94c..c2bbdb537 100644 --- a/resources/views/pages/detailed-listing.blade.php +++ b/resources/views/pages/detailed-listing.blade.php @@ -2,7 +2,7 @@ @section('body')
-
+

{{ $title }}

@@ -12,6 +12,6 @@
{!! $pages->links() !!}
-
+
@stop \ No newline at end of file diff --git a/resources/views/pages/guest-create.blade.php b/resources/views/pages/guest-create.blade.php index 5404d8f4b..55db85144 100644 --- a/resources/views/pages/guest-create.blade.php +++ b/resources/views/pages/guest-create.blade.php @@ -15,7 +15,7 @@ ]])
-
+

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

{!! csrf_field() !!} @@ -31,7 +31,7 @@
-
+
@stop \ No newline at end of file diff --git a/resources/views/pages/move.blade.php b/resources/views/pages/move.blade.php index 7cf294f14..3bf1db5e4 100644 --- a/resources/views/pages/move.blade.php +++ b/resources/views/pages/move.blade.php @@ -16,7 +16,7 @@ ]]) -
+

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

@@ -31,7 +31,7 @@
- + @stop diff --git a/resources/views/pages/permissions.blade.php b/resources/views/pages/permissions.blade.php index 260f0e49f..de28137db 100644 --- a/resources/views/pages/permissions.blade.php +++ b/resources/views/pages/permissions.blade.php @@ -16,10 +16,10 @@ ]]) -
+

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

@include('form.entity-permissions', ['model' => $page]) -
+ @stop diff --git a/resources/views/pages/revision.blade.php b/resources/views/pages/revision.blade.php index e897522cb..0557b6b1c 100644 --- a/resources/views/pages/revision.blade.php +++ b/resources/views/pages/revision.blade.php @@ -25,10 +25,10 @@ ]]) -
+
@include('pages.page-display')
-
+ @stop \ No newline at end of file diff --git a/resources/views/pages/revisions.blade.php b/resources/views/pages/revisions.blade.php index d1491bdec..feb318077 100644 --- a/resources/views/pages/revisions.blade.php +++ b/resources/views/pages/revisions.blade.php @@ -15,7 +15,7 @@ ]]) -
+

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

@if(count($page->revisions) > 0) @@ -86,7 +86,7 @@ @else

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

@endif -
+ diff --git a/resources/views/pages/show.blade.php b/resources/views/pages/show.blade.php index 4c6b63d48..51ab5bbbe 100644 --- a/resources/views/pages/show.blade.php +++ b/resources/views/pages/show.blade.php @@ -10,12 +10,12 @@ ]]) -
+
@include('pages.pointer', ['page' => $page]) @include('pages.page-display')
-
+ @if ($commentsEnabled) -
+

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

@include('shelves.form', ['shelf' => null, 'books' => $books]) -
+ diff --git a/resources/views/shelves/edit.blade.php b/resources/views/shelves/edit.blade.php index 8c2cd4f45..5ae3638fe 100644 --- a/resources/views/shelves/edit.blade.php +++ b/resources/views/shelves/edit.blade.php @@ -14,13 +14,13 @@ ]]) -
+

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

@include('shelves.form', ['model' => $shelf])
-
+ @stop \ No newline at end of file diff --git a/resources/views/shelves/form.blade.php b/resources/views/shelves/form.blade.php index fa1940948..5125e7e19 100644 --- a/resources/views/shelves/form.blade.php +++ b/resources/views/shelves/form.blade.php @@ -40,9 +40,9 @@
-
- -
+

{{ trans('common.cover_image_description') }}

@@ -56,9 +56,9 @@
-
+
+
@include('components.tag-manager', ['entity' => $shelf ?? null, 'entityType' => 'bookshelf'])
diff --git a/resources/views/shelves/list.blade.php b/resources/views/shelves/list.blade.php index 3f8c266e9..b20b08a2c 100644 --- a/resources/views/shelves/list.blade.php +++ b/resources/views/shelves/list.blade.php @@ -1,5 +1,5 @@ -
+

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

@@ -35,4 +35,4 @@ @endif @endif -
+
diff --git a/resources/views/shelves/show.blade.php b/resources/views/shelves/show.blade.php index 3a9d59951..6bfc525a5 100644 --- a/resources/views/shelves/show.blade.php +++ b/resources/views/shelves/show.blade.php @@ -8,7 +8,7 @@ ]])
-
+

{{$shelf->name}}

{!! nl2br(e($shelf->description)) !!}

@@ -39,7 +39,7 @@
@endif
-
+ @stop diff --git a/resources/views/tri-layout.blade.php b/resources/views/tri-layout.blade.php index d869d6f13..71c546964 100644 --- a/resources/views/tri-layout.blade.php +++ b/resources/views/tri-layout.blade.php @@ -18,9 +18,9 @@
@@ -30,9 +30,9 @@
diff --git a/resources/views/users/create.blade.php b/resources/views/users/create.blade.php index 109b81225..9971eeeeb 100644 --- a/resources/views/users/create.blade.php +++ b/resources/views/users/create.blade.php @@ -8,7 +8,7 @@ @include('settings.navbar', ['selected' => 'users'])
-
+

{{ trans('settings.users_add_new') }}

@@ -25,7 +25,7 @@
-
+ @stop diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index 9f8fba8df..ff1e7cbe5 100644 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -7,7 +7,7 @@ @include('settings.navbar', ['selected' => 'users']) -
+

{{ $user->id === $currentUser->id ? trans('settings.users_edit_profile') : trans('settings.users_edit') }}

id}") }}" method="post" enctype="multipart/form-data"> {!! csrf_field() !!} @@ -61,29 +61,31 @@
- + @if($currentUser->id === $user->id && count($activeSocialDrivers) > 0) -
+

{{ trans('settings.users_social_accounts') }}

{{ trans('settings.users_social_accounts_info') }}

@foreach($activeSocialDrivers as $driver => $enabled)
-
@icon('auth/'. $driver, ['style' => 'width: 56px;height: 56px;'])
+
@icon('auth/'. $driver, ['style' => 'width: 56px;height: 56px;'])
@endforeach
-
+ @endif diff --git a/resources/views/users/index.blade.php b/resources/views/users/index.blade.php index 72db24075..da373c161 100644 --- a/resources/views/users/index.blade.php +++ b/resources/views/users/index.blade.php @@ -7,7 +7,7 @@ @include('settings.navbar', ['selected' => 'users']) -
+

{{ trans('settings.users') }}

@@ -62,7 +62,7 @@
{{ $users->links() }}
-
+
diff --git a/resources/views/users/profile.blade.php b/resources/views/users/profile.blade.php index f817e328f..4028b5c1d 100644 --- a/resources/views/users/profile.blade.php +++ b/resources/views/users/profile.blade.php @@ -7,14 +7,14 @@
-
+
{{ trans('entities.recent_activity') }}
@include('partials.activity-list', ['activity' => $activity]) -
+
-
+
@@ -54,9 +54,9 @@
-
+
-
+

{{ trans('entities.recently_created_pages') }} @if (count($recentlyCreated['pages']) > 0) @@ -68,9 +68,9 @@ @else

{{ trans('entities.profile_not_created_pages', ['userName' => $user->name]) }}

@endif -

+ -
+

{{ trans('entities.recently_created_chapters') }} @if (count($recentlyCreated['chapters']) > 0) @@ -82,9 +82,9 @@ @else

{{ trans('entities.profile_not_created_chapters', ['userName' => $user->name]) }}

@endif -

+ -
+

{{ trans('entities.recently_created_books') }} @if (count($recentlyCreated['books']) > 0) @@ -96,9 +96,9 @@ @else

{{ trans('entities.profile_not_created_books', ['userName' => $user->name]) }}

@endif -

+ -
+

{{ trans('entities.recently_created_shelves') }} @if (count($recentlyCreated['shelves']) > 0) @@ -110,13 +110,11 @@ @else

{{ trans('entities.profile_not_created_shelves', ['userName' => $user->name]) }}

@endif -

+
- - @stop \ No newline at end of file From 9fbef8cd1be72cf5ee6589c38013ce615a919f7b Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 25 Aug 2019 16:19:56 +0100 Subject: [PATCH 74/85] Re-orged readme and added a11y info - Also tweaked default theme color a tad to better fit in Level A standard. --- app/Config/setting-defaults.php | 4 +- readme.md | 51 +++++++++---------- .../js/components/setting-app-color-picker.js | 2 +- resources/assets/sass/_variables.scss | 6 +-- resources/views/settings/index.blade.php | 2 +- 5 files changed, 31 insertions(+), 34 deletions(-) diff --git a/app/Config/setting-defaults.php b/app/Config/setting-defaults.php index 43927557f..4a135573b 100644 --- a/app/Config/setting-defaults.php +++ b/app/Config/setting-defaults.php @@ -14,8 +14,8 @@ return [ 'app-logo' => '', 'app-name-header' => true, 'app-editor' => 'wysiwyg', - 'app-color' => '#1d75b6', - 'app-color-light' => 'rgba(29,117,182,0.15)', + 'app-color' => '#206ea7', + 'app-color-light' => 'rgba(32,110,167,0.15)', 'app-custom-head' => false, 'registration-enabled' => false, diff --git a/readme.md b/readme.md index 62e2aa65d..4e93607b6 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ A platform for storing and organising information and documentation. General inf * [Admin Login](https://demo.bookstackapp.com/login?email=admin@example.com&password=password) * [BookStack Blog](https://www.bookstackapp.com/blog) -## Project Definition +## 📚 Project Definition BookStack is an opinionated wiki system that provides a pleasant and simple out of the box experience. New users to an instance should find the experience intuitive and only basic word-processing skills should be required to get involved in creating content on BookStack. The platform should provide advanced power features to those that desire it but they should not interfere with the core simple user experience. @@ -21,7 +21,7 @@ BookStack is not designed as an extensible platform to be used for purposes that In regards to development philosophy, BookStack has a relaxed, open & positive approach. At the end of the day this is free software developed and maintained by people donating their own free time. -## Road Map +## 🛣️ Road Map Below is a high-level road map view for BookStack to provide a sense of direction of where the project is going. This can change at any point and does not reflect many features and improvements that will also be included as part of the journey along this road map. For more granular detail of what will be included in upcoming releases you can review the project milestones as defined in the "Release Process" section below. @@ -34,7 +34,7 @@ Below is a high-level road map view for BookStack to provide a sense of directio - **Installation & Deployment Process Revamp** - *Creation of a streamlined & secure process for users to deploy & update BookStack with reduced development requirements (No git or composer requirement).* -## Release Versioning & Process +## 🚀 Release Versioning & Process BookStack releases are each assigned a version number, such as "v0.25.2", in the format `v..`. A change only in the `patch` number indicates a fairly minor release that mainly contains fixes and therefore is very unlikely to cause breakages upon update. A change in the `feature` number indicates a release which will generally bring new features in addition to fixes and enhancements. These releases have a small chance of introducing breaking changes upon update so it's worth checking for any notes in the [update guide](https://www.bookstackapp.com/docs/admin/updates/). A change in the `phase` indicates a much large change in BookStack that will likely incur breakages requiring manual intervention. @@ -42,7 +42,7 @@ Each BookStack release will have a [milestone](https://github.com/BookStackApp/B For feature releases, and some patch releases, the release will be accompanied by a post on the [BookStack blog](https://www.bookstackapp.com/blog/) which will provide additional detail on features, changes & updates otherwise the [GitHub release page](https://github.com/BookStackApp/BookStack/releases) will show a list of changes. You can sign up to be alerted to new BookStack blogs posts (once per week maximum) [at this link](http://eepurl.com/cmmq5j). -## Development & Testing +## 🛠️ Development & Testing All development on BookStack is currently done on the master branch. When it's time for a release the master branch is merged into release with built & minified CSS & JS then tagged at its version. Here are the current development requirements: @@ -75,7 +75,11 @@ php artisan db:seed --class=DummyContentSeeder --database=mysql_testing Once done you can run `php vendor/bin/phpunit` in the application root directory to run all tests. -## Translations +### 📜 Code Standards + +PHP code within BookStack is generally to [PSR-2](http://www.php-fig.org/psr/psr-2/) standards. From the BookStack root folder you can run `./vendor/bin/phpcs` to check code is formatted correctly and `./vendor/bin/phpcbf` to auto-fix non-PSR-2 code. + +## 🌎 Translations All text strings can be found in the `resources/lang` folder where each language option has its own folder. To add a new language you should copy the `en` folder to an new folder (eg. `fr` for french) then go through and translate all text strings in those files, leaving the keys and file-names intact. If a language string is missing then the `en` translation will be used. To show the language option in the user preferences language drop-down you will need to add your language to the options found at the bottom of the `resources/lang/en/settings.php` file. A system-wide language can also be set in the `.env` file like so: `APP_LANG=en`. @@ -94,29 +98,15 @@ php resources/lang/check.php pt_BR Some strings have colon-prefixed variables in such as `:userName`. Leave these values as they are as they will be replaced at run-time. -## Contributing & Maintenance +## 🎁 Contributing, Issues & Pull Requests -Feel free to create issues to request new features or to report bugs and problems. Just please follow the template given when creating the issue. +Feel free to create issues to request new features or to report bugs & problems. Just please follow the template given when creating the issue. + +Pull requests are welcome. Unless a small tweak or language update, It may be best to open the pull request early or create an issue for your intended change to discuss how it will fit in to the project and plan out the merge. Pull requests should be created from the `master` branch since they will be merged back into `master` once done. Please do not build from or request a merge into the `release` branch as this is only for publishing releases. If you are looking to alter CSS or JavaScript content please edit the source files found in `resources/assets`. Any CSS or JS files within `public` are built from these source files and therefore should not be edited directly. The project's code of conduct [can be found here](https://github.com/BookStackApp/BookStack/blob/master/.github/CODE_OF_CONDUCT.md). -### Code Standards - -PHP code within BookStack is generally to [PSR-2](http://www.php-fig.org/psr/psr-2/) standards. From the BookStack root folder you can run `./vendor/bin/phpcs` to check code is formatted correctly and `./vendor/bin/phpcbf` to auto-fix non-PSR-2 code. - -### Pull Requests - -Pull requests are welcome. Unless a small tweak or language update, It may be best to open the pull request early or create an issue for your intended change to discuss how it will fit in to the project and plan out the merge. - -Pull requests should be created from the `master` branch since they will be merged back into `master` once done. Please do not build from or request a merge into the `release` branch as this is only for publishing releases. - -If you are looking to alter CSS or JavaScript content please edit the source files found in `resources/assets`. Any CSS or JS files within `public` are built from these source files and therefore should not be edited directly. - -## Website, Docs & Blog - -The website which contains the project docs & Blog can be found in the [BookStackApp/website](https://github.com/BookStackApp/website) repo. - -## Security +## 🔒 Security Security information for administering a BookStack instance can be found on the [documentation site here](https://www.bookstackapp.com/docs/admin/security/). @@ -124,12 +114,19 @@ If you'd like to be notified of new potential security concerns you can [sign-up If you would like to report a security concern in a more confidential manner than via a GitHub issue, You can directly email the lead maintainer [ssddanbrown](https://github.com/ssddanbrown). You will need to login to be able to see the email address on the [GitHub profile page](https://github.com/ssddanbrown). Alternatively you can send a DM via twitter to [@ssddanbrown](https://twitter.com/ssddanbrown). +## ♿ Accessibility -## License +We want BookStack to remain accessible to as many people as possible. We aim for at least WCAG 2.1 Level A standards where possible although we do not strictly test this upon each release. If you come across any accessibility issues please feel free to open an issue. -The BookStack source is provided under the MIT License. +## 🖥️ Website, Docs & Blog -## Attribution +The website which contains the project docs & Blog can be found in the [BookStackApp/website](https://github.com/BookStackApp/website) repo. + +## ⚖️ License + +The BookStack source is provided under the MIT License. The libraries used by, and included with, BookStack are provided under their own licenses. + +## 👪 Attribution The great people that have worked to build and improve BookStack can [be seen here](https://github.com/BookStackApp/BookStack/graphs/contributors). diff --git a/resources/assets/js/components/setting-app-color-picker.js b/resources/assets/js/components/setting-app-color-picker.js index ddacc4bd0..6c0c0b31d 100644 --- a/resources/assets/js/components/setting-app-color-picker.js +++ b/resources/assets/js/components/setting-app-color-picker.js @@ -10,7 +10,7 @@ class SettingAppColorPicker { this.colorInput.addEventListener('change', this.updateColor.bind(this)); this.colorInput.addEventListener('input', this.updateColor.bind(this)); this.resetButton.addEventListener('click', event => { - this.colorInput.value = '#1d75b6'; + this.colorInput.value = '#206ea7'; this.updateColor(); }); } diff --git a/resources/assets/sass/_variables.scss b/resources/assets/sass/_variables.scss index d2d25127b..f258c65ca 100644 --- a/resources/assets/sass/_variables.scss +++ b/resources/assets/sass/_variables.scss @@ -42,8 +42,8 @@ $fs-s: 12px; // Colours :root { - --color-primary: '#1d75b6'; - --color-primary-light: 'rgba(29,117,182,0.15)'; + --color-primary: '#206ea7'; + --color-primary-light: 'rgba(32,110,167,0.15)'; } $positive: #0f7d15; $negative: #ab0f0e; @@ -54,7 +54,7 @@ $warning: #cf4d03; $color-bookshelf: #af5a5a; $color-book: #009688; $color-chapter: #d7804a; -$color-page: #0288D1; +$color-page: #206ea7; $color-page-draft: #9A60DA; // Text colours diff --git a/resources/views/settings/index.blade.php b/resources/views/settings/index.blade.php index fd589e6e6..ba2b92fe7 100644 --- a/resources/views/settings/index.blade.php +++ b/resources/views/settings/index.blade.php @@ -135,7 +135,7 @@

{!! trans('settings.app_primary_color_desc') !!}

- +
From 2dfe6c2d56719e03f31c74cc1d6d65e2df686031 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 25 Aug 2019 17:21:25 +0100 Subject: [PATCH 75/85] Fixed failing test and added more accessibility improvements - Updated linked images to have obvious focus styles - Added proper role to notifications - Made dropdown list focus styles a bit nicer. - Updated book list chapter child slide down to be keyboard activatable. Related to #1320 --- resources/assets/sass/_lists.scss | 9 ++++++--- resources/assets/sass/_text.scss | 4 ++++ resources/views/chapters/child-menu.blade.php | 2 +- resources/views/chapters/list-item.blade.php | 4 +++- resources/views/partials/custom-styles.blade.php | 2 +- resources/views/partials/notifications.blade.php | 6 +++--- tests/Entity/PageRevisionTest.php | 2 +- 7 files changed, 19 insertions(+), 10 deletions(-) diff --git a/resources/assets/sass/_lists.scss b/resources/assets/sass/_lists.scss index 74c36c86c..a448266f3 100644 --- a/resources/assets/sass/_lists.scss +++ b/resources/assets/sass/_lists.scss @@ -59,6 +59,8 @@ .chapter-expansion-toggle { border-radius: 0 4px 4px 0; padding: $-xs $-m; + width: 100%; + text-align: left; } .chapter-expansion-toggle:hover { background-color: rgba(0, 0, 0, 0.06); @@ -554,14 +556,15 @@ ul.pagination { display: block; padding: $-xs $-m; color: #555; - fill: #555; + fill: currentColor; white-space: nowrap; &:hover, &:focus { text-decoration: none; - background-color: #EEE; + background-color: var(--color-primary-light); + color: var(--color-primary); } &:focus { - outline: 1px solid rgba(0, 0, 0, 0.2); + outline: 1px solid var(--color-primary); outline-offset: -2px; } svg { diff --git a/resources/assets/sass/_text.scss b/resources/assets/sass/_text.scss index f4406144d..315f08c34 100644 --- a/resources/assets/sass/_text.scss +++ b/resources/assets/sass/_text.scss @@ -106,6 +106,10 @@ a { position: relative; display: inline-block; } + &:focus img:only-child { + outline: 2px dashed var(--color-primary); + outline-offset: 2px; + } } .blended-links a { diff --git a/resources/views/chapters/child-menu.blade.php b/resources/views/chapters/child-menu.blade.php index 951825346..6137c34e8 100644 --- a/resources/views/chapters/child-menu.blade.php +++ b/resources/views/chapters/child-menu.blade.php @@ -1,5 +1,5 @@
- diff --git a/resources/views/chapters/list-item.blade.php b/resources/views/chapters/list-item.blade.php index fd463e07a..7e2e0e1c5 100644 --- a/resources/views/chapters/list-item.blade.php +++ b/resources/views/chapters/list-item.blade.php @@ -11,7 +11,9 @@
@icon('page')
-
@icon('caret-right') {{ trans_choice('entities.x_pages', $chapter->pages->count()) }}
+
@include('partials.entity-list', ['entities' => $chapter->pages]) diff --git a/resources/views/partials/custom-styles.blade.php b/resources/views/partials/custom-styles.blade.php index 34b702c51..908079082 100644 --- a/resources/views/partials/custom-styles.blade.php +++ b/resources/views/partials/custom-styles.blade.php @@ -3,4 +3,4 @@ --color-primary: {{ setting('app-color') }}; --color-primary-light: {{ setting('app-color-light') }}; } - + \ No newline at end of file diff --git a/resources/views/partials/notifications.blade.php b/resources/views/partials/notifications.blade.php index ac853a56c..526871499 100644 --- a/resources/views/partials/notifications.blade.php +++ b/resources/views/partials/notifications.blade.php @@ -1,11 +1,11 @@ -