[Misc] Add a subscribestar static page (#856)

This commit is contained in:
Cinder 2025-01-26 06:26:23 -08:00 committed by GitHub
parent 0dfcb4710d
commit 0db551db62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 51 additions and 8 deletions

View File

@ -21,6 +21,10 @@ class StaticController < ApplicationController
@page = format_wiki_page("e621:avoid_posting_notice")
end
def subscribestar
@page = format_wiki_page("e621:subscribestar")
end
def not_found
render "static/404", formats: [:html], status: 404
end

View File

@ -8,7 +8,6 @@ module ApplicationHelper
cookies[:nmm].present?
end
def diff_list_html(new, old, latest)
diff = SetDiff.new(new, old, latest)
render "diff_list", diff: diff
@ -32,6 +31,24 @@ module ApplicationHelper
end
end
def custom_image_nav_link_to(text, image, url, **options)
klass = options.delete(:class)
if nav_link_match(params[:controller], url)
klass = "#{klass} current"
end
id = "nav-#{text.downcase.gsub(/[^a-z ]/, '').parameterize}"
tag.li(id: id, class: klass) do
link_to(url, id: "#{id}-link", **options) do
concat image_pack_tag(image)
concat " "
concat tag.span(text)
end
end
end
def nav_link_to(text, url, **options)
klass = options.delete(:class)

View File

@ -172,19 +172,28 @@ nav.navigation {
li {
padding: 0;
&.nav-help-discord { grid-column: 1 / -1; }
&.nav-help-discord,
&.nav-help-subscribestar {
grid-column: 1 / -1;
}
& > a {
display: block;
display: flex;
background: themed("color-section-darken-5");
border-radius: 6px;
font-size: 125%;
padding: 0.5rem 1rem;
text-align: center;
i { color: themed("color-link-active"); }
justify-content: center;
align-items: center;
gap: 0.25em;
img {
height: 1.25em;
margin: -0.5em 0;
}
}
}
}
@ -351,11 +360,10 @@ nav.navigation, body.nav-toggled nav.navigation {
}
}
.nav-help {
overflow: hidden;
li a img { display: none; }
li.current a {
background-color: themed("color-foreground");
i { display: none; }
}
}

View File

@ -42,8 +42,9 @@
<menu class="nav-help <%= CurrentUser.is_anonymous? ? "anonymous" : "" %>">
<% if !CurrentUser.is_anonymous? %>
<%= nav_link_to("Discord", discord_get_path, class: "nav-help-discord") %>
<%= custom_image_nav_link_to("Discord", "discord.com.png", discord_get_path, class: "nav-help-discord") %>
<% end %>
<%= custom_image_nav_link_to("Subscribestar", "subscribestar.adult.png", subscribestar_path, class: "nav-help-subscribestar") %>
<%= nav_link_to("Wiki", wiki_pages_path(title: "help:home"), class: "nav-help-wiki") %>
<%= nav_link_to("Help", help_pages_path, class: "nav-help-help") %>
<%= nav_link_to("More", site_map_path, class: "nav-help-map") %>

View File

@ -0,0 +1,12 @@
<div id="c-static">
<div id="a-subscribestar">
<div class="dtext-container">
<%= format_text(@page.body, allow_color: true) %>
</div>
</div>
</div>
<% content_for(:page_title) do %>
Subscribestar
<% end %>

View File

@ -476,6 +476,7 @@ Rails.application.routes.draw do
get "/static/toggle_mobile_mode" => "static#disable_mobile_mode", as: "disable_mobile_mode"
get "/static/theme" => "static#theme", as: "theme"
get "/static/avoid_posting" => "static#avoid_posting", as: "avoid_posting_static"
get "/static/subscribestar" => "static#subscribestar", as: "subscribestar"
get "/meta_searches/tags" => "meta_searches#tags", :as => "meta_searches_tags"
root :to => "static#home"