client/posts: support content aware post flow option

This commit is contained in:
Shyam Sunder 2020-09-27 15:11:34 -04:00
parent afe4c5c847
commit eaa6107a6c
6 changed files with 29 additions and 1 deletions

View file

@ -134,6 +134,22 @@
.thumbnail .thumbnail
outline: 4px solid $main-color !important outline: 4px solid $main-color !important
.post-flow
ul
li
min-width: inherit
width: inherit
&:not(.flexbox-dummy)
height: 14vw
.thumbnail
outline-offset: -1px
.thumbnail-wrapper.no-tags
.thumbnail
outline: 2px solid $post-thumbnail-no-tags-border-color
&:hover a, a:active, a:focus
.thumbnail
outline: 2px solid $main-color !important
.post-list-header .post-list-header
white-space: nowrap white-space: nowrap
text-align: left text-align: left

View file

@ -1,4 +1,4 @@
<div class='post-list'> <% if (ctx.postFlow) { %><div class='post-list post-flow'><% } else { %><div class='post-list'><% } %>
<% if (ctx.response.results.length) { %> <% if (ctx.response.results.length) { %>
<ul> <ul>
<% for (let post of ctx.response.results) { %> <% for (let post of ctx.response.results) { %>

View file

@ -47,6 +47,15 @@
<p class='hint'>Rather than using a paged navigation, smoothly scrolls through the content.</p> <p class='hint'>Rather than using a paged navigation, smoothly scrolls through the content.</p>
</li> </li>
<li>
<%= ctx.makeCheckbox({
text: 'Use post flow',
name: 'post-flow',
checked: ctx.browsingSettings.postFlow,
}) %>
<p class='hint'>Use a content-aware flow for thumbnails on the post search page.</p>
</li>
<li> <li>
<%= ctx.makeCheckbox({ <%= ctx.makeCheckbox({
text: 'Enable transparency grid', text: 'Enable transparency grid',

View file

@ -120,6 +120,7 @@ class PostListController {
bulkEdit: { bulkEdit: {
tags: this._bulkEditTags, tags: this._bulkEditTags,
}, },
postFlow: settings.get().postFlow,
}); });
const view = new PostsPageView(pageCtx); const view = new PostsPageView(pageCtx);
view.addEventListener("tag", (e) => this._evtTag(e)); view.addEventListener("tag", (e) => this._evtTag(e));

View file

@ -18,6 +18,7 @@ const defaultSettings = {
postsPerPage: 42, postsPerPage: 42,
tagUnderscoresAsSpaces: false, tagUnderscoresAsSpaces: false,
darkTheme: false, darkTheme: false,
postFlow: false,
}; };
class Settings extends events.EventTarget { class Settings extends events.EventTarget {

View file

@ -45,6 +45,7 @@ class SettingsView extends events.EventTarget {
tagUnderscoresAsSpaces: this._find("underscores-as-spaces") tagUnderscoresAsSpaces: this._find("underscores-as-spaces")
.checked, .checked,
darkTheme: this._find("dark-theme").checked, darkTheme: this._find("dark-theme").checked,
postFlow: this._find("post-flow").checked,
}, },
}) })
); );