Compare commits

...

5 Commits

Author SHA1 Message Date
00801f1d2b Merge branch 'master' into master2 2025-01-30 21:01:28 -06:00
Cinder
9e2396eb5f
[CI] Upgrade to actions/upload-artifact@4 (#871) 2025-01-30 07:44:40 -08:00
Cinder
4547da2fa6
[Posts] Posts searchbar and layout fixes (#868)
* Remove the strange search button styles on the posts/show page
* Remove debug console output
* Tweak the searchbar styles to be consistent across the pages
2025-01-29 13:37:11 -08:00
Cinder
e80f06d028
[UI] Minor fixes to the navbar (#867)
* Fix the incorrect layered icons in the nav menu on low-resolution screens
* Move the wiki and help buttons higher up in the menu
* Prevent the buttons in the mobile menu from breaking into a new line
* Prevent the secondary nav buttons from expanding the menu vertically
* Fix the navbar height to avoid having it shift around
* Rework the mobile menu offsets
* Add back the forum update notification
2025-01-29 13:25:39 -08:00
Cinder
90c7248e2e
[Favorites] Add the missing methods (#866) 2025-01-29 12:54:18 -08:00
9 changed files with 122 additions and 50 deletions

View File

@ -68,7 +68,7 @@ jobs:
run: $DOCKER_RUN tests
- name: Upload Test Results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: test-results

View File

@ -1,8 +1,8 @@
const Navigation = {};
Navigation.init = function () {
const wrapper = $("body");
$("#nav-toggle").on("click", (event) => {
const wrapper = $("html");
$("#nav-toggle, .nav-offset-left, .nav-offset-bottom").on("click", (event) => {
event.preventDefault();
wrapper.toggleClass("nav-toggled");

View File

@ -19,25 +19,28 @@ PostSearch.initialize_input = function ($form) {
// Adjust the number of rows based on input length
$textarea
.on("input", () => {
$textarea.css("height", 0);
$textarea.css("height", element.scrollHeight + "px");
})
.on("input", recalculateInputHeight)
.on("keypress", function (event) {
if (event.which !== 13 || event.shiftKey) return;
event.preventDefault();
$textarea.closest("form").submit();
});
$(window).on("resize", recalculateInputHeight);
// Reset default height
$textarea.trigger("input");
recalculateInputHeight();
function recalculateInputHeight () {
$textarea.css("height", 0);
$textarea.css("height", element.scrollHeight + "px");
}
};
PostSearch.initialize_wiki_preview = function ($preview) {
let visible = LStorage.Posts.WikiExcerpt;
if (visible)
$preview.removeClass("hidden");
console.log("init", visible);
$($preview.find("a.wiki-excerpt-toggle")).on("click", (event) => {
event.preventDefault();
@ -45,7 +48,6 @@ PostSearch.initialize_wiki_preview = function ($preview) {
visible = !visible;
$preview.toggleClass("hidden", !visible);
LStorage.Posts.WikiExcerpt = visible;
console.log("state", visible);
return false;
});

View File

@ -2,14 +2,11 @@ nav.navigation {
display: grid;
grid-template-areas: "logo logo controls";
grid-template-columns: min-content auto;
grid-template-rows: min-content auto min-content min-content;
grid-template-rows: min-content min-content min-content min-content auto;
width: 100%; // otherwise narrow when fixed
z-index: 20; // otherwise post labels layered above
pointer-events: none; // allow clicking through offset
& > menu { pointer-events: auto; }
/* Top bar, always visible */
.nav-logo {
@ -20,6 +17,9 @@ nav.navigation {
a.nav-logo-link {
display: flex;
// Height: 3.75rem
// - padding 0.25 * 2 = 0.5
// - image 3.25
height: 3.25rem;
width: 3.25rem;
margin: 0.25rem;
@ -43,6 +43,12 @@ nav.navigation {
padding-right: 0.5em;
background-color: themed("color-background");
// Height: 3.75rem
// - wrapper padding 0.875 * 2 = 1.75
// - link padding 0.25 * 2 = 0.5
// - font size 1.5
padding: 0.875rem;
& > a {
display: flex;
gap: 0.25em;
@ -59,10 +65,16 @@ nav.navigation {
}
/* Prevent toggled menus from being too wide */
.nav-offset {
grid-area: offset;
pointer-events: none;
.nav-offset-left {
grid-area: offleft;
display: none; // flex
background: #00000050;
}
.nav-offset-bottom {
grid-area: offbott;
display: none; // flex
background: #00000050;
}
/* Toggled menus, hidden by default */
@ -81,6 +93,9 @@ nav.navigation {
border-bottom: 1px solid themed("color-foreground");
padding: 0.5em;
// "Comments" is usually the longest and might wrap
white-space: nowrap;
i {
width: 1.5rem;
color: themed("color-link-active");
@ -89,6 +104,22 @@ nav.navigation {
}
&.current a { background-color: themed("color-foreground"); }
&.forum-updated {
position: relative;
&::after {
content: "";
width: 6px;
height: 6px;
border-radius: 3px;
background: var(--palette-text-red);
position: absolute;
right: 0.2em;
top: 1em;
}
}
}
}
@ -99,6 +130,11 @@ nav.navigation {
background-color: themed("color-foreground");
font-size: 1.35em;
height: 440px;
// Prevent the tools / help buttons from being pushed
// way too low on pages with a lot of secondary links
overflow: scroll;
li {
padding: 0;
@ -116,6 +152,11 @@ nav.navigation {
form input[type="text"] {
width: 100%;
box-sizing: border-box;
// Reduced font size to make the search
// box less claustrophobic
font-size: 1em;
padding: 0.25em 0.5em;
}
}
}
@ -195,6 +236,13 @@ nav.navigation {
margin: -0.5em 0;
}
}
// Hack to put the wiki/help links before discord/sstar on mobile
// but still have "more" at the end on desktop
&#nav-more {
grid-row: 1;
grid-column: 3;
}
}
}
}
@ -208,26 +256,30 @@ body[data-th-sheader="true"] nav.navigation {
// Mobile toggle
body.nav-toggled {
padding-top: 4rem;
html.nav-toggled {
height: 100%;
overflow: hidden;
body { padding-top: 3.75rem; }
nav.navigation {
grid-template-areas:
"logo logo controls"
"offset primary secondary "
"offset tools tools "
"offset help help ";
"offleft primary secondary "
"offleft tools tools "
"offleft help help "
"offbott offbott offbott ";
grid-template-columns: auto minmax(auto, 180px) minmax(auto, 180px);
position: fixed;
top: 0;
height: 100vh;
max-height: 800px;
max-width: 100vw; // prevent bug when page overflows viewport
// Allow scrolling when the menu is too long
overflow-y: scroll;
.nav-primary, .nav-secondary, .nav-offset {
.nav-primary, .nav-secondary, .nav-offset-left, .nav-offset-bottom {
display: flex;
}
.nav-tools, .nav-help {
@ -241,7 +293,7 @@ body.nav-toggled {
// Desktop
nav.navigation, body.nav-toggled nav.navigation {
nav.navigation, html.nav-toggled nav.navigation {
@include window-larger-than(800px) {
grid-template-areas:
"logo primary help tools "
@ -261,7 +313,7 @@ nav.navigation, body.nav-toggled nav.navigation {
a.nav-logo-link { margin: 0.25rem 0.5rem 0 0; }
}
.nav-offset, .nav-controls { display: none; }
.nav-offset-left, .nav-offset-bottom, .nav-controls { display: none; }
.nav-primary {
display: flex;
@ -281,12 +333,17 @@ nav.navigation, body.nav-toggled nav.navigation {
padding: 0 0.75em;
i { display: none; }
}
&.forum-updated::after {
top: 0.2em;
}
}
}
.nav-secondary {
display: flex;
flex-flow: row;
height: unset;
padding: 0 0.25em;
font-size: 1.05em;
@ -348,6 +405,12 @@ nav.navigation, body.nav-toggled nav.navigation {
}
.nav-tools {
// Otherwise help gets layered above it
// When the viewport is narrow (but not mobile)
z-index: 1;
background: var(--color-background);
li {
a {
i { color: themed("color-link"); }
@ -377,5 +440,8 @@ body.c-static.a-home {
nav.navigation, menu.nav-logo, menu.nav-secondary {
background: unset;
}
menu.nav-tools {
background: var(--bg-color);
}
}
}

View File

@ -14,7 +14,9 @@
// Override default texarea styles
font-family: Verdana, sans-serif;
font-size: 1.05em;
font-size: 1rem;
line-height: 1rem;
padding: 0.5rem 0 0.5rem 0.5rem;
// Remove old styles from z_responsive
vertical-align: unset;
@ -28,11 +30,9 @@
// Disable manual resizing
resize: none;
flex: 1;
padding: 0.5em;
border-radius: 3px 0 0 3px;
box-sizing: border-box;
flex: 1;
&:focus, &:focus + button[type="submit"] { background: #FFC; }
}
@ -43,13 +43,20 @@
font-size: unset;
max-width: unset;
font-size: 1em;
padding: 0.5em;
font-size: 1rem;
line-height: 1rem;
padding: 0.5rem;
border-radius: 0 3px 3px 0;
background: white;
span { display: none; }
}
@include window-larger-than(800px) {
textarea, button[type="submit"] {
font-size: 0.85rem;
}
}
}
}

View File

@ -67,22 +67,6 @@
}
}
div#page aside#sidebar {
padding: 5px;
input#tags {
width: 80%;
}
button[type=submit] {
font-size: 1.2em;
background-color: #EEE;
height: 42px;
padding: 2px 10px;
border: 1px solid rgb(197, 197, 197);
}
}
div#page {
> div /* div#c-$controller */

View File

@ -28,10 +28,22 @@ module PostSets
end
end
def has_explicit?
!CurrentUser.safe_mode?
end
def hidden_posts
@hidden_posts ||= posts.reject(&:visible?)
end
def login_blocked_posts
@login_blocked_posts ||= posts.select(&:loginblocked?)
end
def safe_posts
@safe_posts ||= posts.select { |p| p.safeblocked? && !p.deleteblocked? }
end
def api_posts
result = posts
fill_children(result)

View File

@ -7,7 +7,8 @@
<%= render "layouts/main_links" %>
</menu>
<menu class="nav-offset"></menu>
<menu class="nav-offset-left"></menu>
<menu class="nav-offset-bottom"></menu>
<menu class="nav-secondary <%= "empty" unless content_for(:secondary_links) %>">
<%= yield :secondary_links %>

View File

@ -8,5 +8,5 @@
</div>
<% content_for(:page_title) do %>
Subscribestar
SubscribeStar
<% end %>