- Fixes multi-select functionality.
- Updated other books to be sticky.
- Added some general intro/desc text.
- Updated sort boxes to be collapsible.
- Cleaned up other books styling.
-import Sortable from "sortablejs";
+import Sortable, {MultiDrag} from "sortablejs";
import {Component} from "./component";
import {htmlToDom} from "../services/dom";
this.sortContainer = this.$refs.sortContainer;
this.input = this.$refs.input;
+ Sortable.mount(new MultiDrag());
+
const initialSortBox = this.container.querySelector('.sort-box');
this.setupBookSortable(initialSortBox);
this.setupSortPresets();
}
/**
- * Setup the given book container element to have sortable items.
+ * Set up the given book container element to have sortable items.
* @param {Element} bookContainer
*/
setupBookSortable(bookContainer) {
}
};
- for (let sortElem of sortElems) {
- new Sortable(sortElem, {
+ for (const sortElem of sortElems) {
+ Sortable.create(sortElem, {
group: sortElem.classList.contains('sort-list') ? bookGroupConfig : chapterGroupConfig,
animation: 150,
fallbackOnBody: true,
dragClass: 'bg-white',
ghostClass: 'primary-background-light',
multiDrag: true,
- multiDragKey: 'CTRL',
+ multiDragKey: 'Control',
selectedClass: 'sortable-selected',
});
}
'books_search_this' => 'Search this book',
'books_navigation' => 'Book Navigation',
'books_sort' => 'Sort Book Contents',
+ 'books_sort_desc' => 'Move chapters and pages within a book to reorganise its contents. Other books can be added which allows easy moving of chapters and pages between books.',
'books_sort_named' => 'Sort Book :bookName',
'books_sort_name' => 'Sort by Name',
'books_sort_created' => 'Sort by Created Date',
'books_sort_chapters_first' => 'Chapters First',
'books_sort_chapters_last' => 'Chapters Last',
'books_sort_show_other' => 'Show Other Books',
+ 'books_sort_show_other_desc' => 'Add other books here to include them in the sort operation, and allow easy cross-book reorganisation.',
'books_sort_save' => 'Save New Order',
'books_copy' => 'Copy Book',
'books_copy_success' => 'Book successfully copied',
}
}
+.sticky-top-m {
+ position: sticky;
+ top: $-m;
+}
+
/**
* Visibility
*/
.sortable-page-list li.placeholder:before {
position: absolute;
}
+.sort-box summary {
+ list-style: none;
+ font-size: .9rem;
+ cursor: pointer;
+}
+.sort-box summary::-webkit-details-marker {
+ display: none;
+}
+details.sort-box summary .caret-container svg {
+ transition: transform ease-in-out 120ms;
+}
+details.sort-box[open] summary .caret-container svg {
+ transform: rotate(90deg);
+}
.activity-list-item {
padding: $-s 0;
.entity-item-snippet {
display: none;
}
+ h4 {
+ font-size: 14px;
+ }
}
}
-<div class="sort-box" data-type="book" data-id="{{ $book->id }}">
- <h5 class="text-book entity-list-item no-hover py-xs pl-none">
- <span>@icon('book')</span>
- <span>{{ $book->name }}</span>
- </h5>
+<details class="sort-box" data-type="book" data-id="{{ $book->id }}" open>
+ <summary>
+ <h5 class="flex-container-row items-center justify-flex-start gap-xs">
+ <div class="text-book text-bigger caret-container">
+ @icon('caret-right')
+ </div>
+ <div class="entity-list-item no-hover py-s text-book px-none">
+ <span>@icon('book')</span>
+ <span>{{ $book->name }}</span>
+ </div>
+ </h5>
+ </summary>
<div class="sort-box-options pb-sm">
<button type="button" data-sort="name" class="button outline small">{{ trans('entities.books_sort_name') }}</button>
<button type="button" data-sort="created" class="button outline small">{{ trans('entities.books_sort_created') }}</button>
@endforeach
</ul>
-</div>
\ No newline at end of file
+</details>
\ No newline at end of file
<div class="grid left-focus gap-xl">
<div>
- <div component="book-sort" class="card content-wrap">
- <h1 class="list-heading mb-l">{{ trans('entities.books_sort') }}</h1>
+ <div component="book-sort" class="card content-wrap auto-height">
+ <h1 class="list-heading">{{ trans('entities.books_sort') }}</h1>
+ <p class="text-muted">{{ trans('entities.books_sort_desc') }}</p>
+
<div refs="book-sort@sortContainer">
@include('books.parts.sort-box', ['book' => $book, 'bookChildren' => $bookChildren])
</div>
</div>
<div>
- <main class="card content-wrap">
- <h2 class="list-heading mb-m">{{ trans('entities.books_sort_show_other') }}</h2>
+ <main class="card content-wrap auto-height sticky-top-m">
+ <h2 class="list-heading">{{ trans('entities.books_sort_show_other') }}</h2>
+ <p class="text-muted">{{ trans('entities.books_sort_show_other_desc') }}</p>
@include('entities.selector', ['name' => 'books_list', 'selectorSize' => 'compact', 'entityTypes' => 'book', 'entityPermission' => 'update', 'showAdd' => true])