1 parent
c811107776
commit
31a7f11827
8 files changed
+65
-8
No files matched your search
@@ -10,6 +10,7 @@ const STATUS_LABEL = {
|
||||
const PER_PAGE = 60;
|
||||
const THEME_KEY = "sb.theme";
|
||||
const VIEWS_KEY = "sb.views";
|
||||
const LAYOUT_KEY = "sb.layout";
|
||||
|
||||
function defaultFilters() {
|
||||
return {
|
||||
@@ -924,6 +925,27 @@ grid.addEventListener("change", (event) => {
|
||||
if (input) setSelected(Number(input.value), input.checked);
|
||||
});
|
||||
|
||||
function applyLayout(mode) {
|
||||
const list = mode === "list";
|
||||
grid.classList.toggle("list-view", list);
|
||||
const button = $("#layoutToggle");
|
||||
button.textContent = list ? "сетка" : "список";
|
||||
button.title = list ? "Сетка карточек" : "Компактный список";
|
||||
button.setAttribute("aria-pressed", String(list));
|
||||
}
|
||||
|
||||
$("#layoutToggle").addEventListener("click", () => {
|
||||
const mode = grid.classList.contains("list-view") ? "grid" : "list";
|
||||
applyLayout(mode);
|
||||
try { localStorage.setItem(LAYOUT_KEY, mode); } catch (_) {}
|
||||
});
|
||||
|
||||
try {
|
||||
applyLayout(localStorage.getItem(LAYOUT_KEY) === "list" ? "list" : "grid");
|
||||
} catch (_) {
|
||||
applyLayout("grid");
|
||||
}
|
||||
|
||||
$("#selectMode").addEventListener("click", () => {
|
||||
state.selectionMode = !state.selectionMode;
|
||||
state.selected.clear();
|
||||
|
||||
@@ -193,6 +193,8 @@ try {
|
||||
<option value="year">по году</option>
|
||||
<option value="added">по добавлению</option>
|
||||
</select>
|
||||
<button id="layoutToggle" class="ghost toolbar-select" type="button"
|
||||
aria-pressed="false" title="Компактный список">список</button>
|
||||
<button id="selectMode" class="ghost toolbar-select" type="button">выбрать</button>
|
||||
<span class="count" id="count"></span>
|
||||
</div>
|
||||
|
||||
@@ -422,6 +422,32 @@ html[data-theme="light"] .select-box {
|
||||
gap: 18px;
|
||||
}
|
||||
|
||||
.grid.list-view { display: flex; flex-direction: column; gap: 8px; }
|
||||
.grid.list-view .card {
|
||||
display: grid;
|
||||
grid-template-columns: 76px minmax(0, 1fr);
|
||||
align-items: stretch;
|
||||
}
|
||||
.grid.list-view .cover {
|
||||
aspect-ratio: auto;
|
||||
min-height: 112px;
|
||||
height: 100%;
|
||||
border-right: 1px solid var(--border);
|
||||
}
|
||||
.grid.list-view .card-body {
|
||||
display: block;
|
||||
padding: 10px 14px;
|
||||
}
|
||||
.grid.list-view .card-title { margin-bottom: 4px; }
|
||||
.grid.list-view .card-meta { margin-bottom: 4px; }
|
||||
.grid.list-view .card-desc {
|
||||
-webkit-line-clamp: 1;
|
||||
min-height: 0;
|
||||
margin-top: 6px;
|
||||
}
|
||||
.grid.list-view .card-status { margin-top: 6px; }
|
||||
.grid.list-view .select-box { right: 6px; bottom: 6px; width: 24px; height: 24px; }
|
||||
|
||||
.card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in new issue
Block a user