diff options
Diffstat (limited to 'internal/web')
| -rw-r--r-- | internal/web/handlers_sections.go | 2 | ||||
| -rw-r--r-- | internal/web/static/blog.css | 14 | ||||
| -rw-r--r-- | internal/web/templates/dashboard/section_form.html | 2 | ||||
| -rw-r--r-- | internal/web/templates/dashboard/sections.html | 2 | ||||
| -rw-r--r-- | internal/web/templates/layouts/blog.html | 4 | ||||
| -rw-r--r-- | internal/web/theme.go | 1 |
6 files changed, 21 insertions, 4 deletions
diff --git a/internal/web/handlers_sections.go b/internal/web/handlers_sections.go index 8d6c9c9..04ba764 100644 --- a/internal/web/handlers_sections.go +++ b/internal/web/handlers_sections.go @@ -53,7 +53,7 @@ func (s *Server) handleSectionForm(w http.ResponseWriter, r *http.Request) { // normalizeSection clamps the enum fields so templates and CSS class names can trust them. func normalizeSection(sec *store.Section) { sec.Placement = pick(sec.Column(), "main", "left", "right") + "-" + pick(sec.Position(), "top", "bottom") - sec.Style = pick(sec.Style, "note", "plain", "warning") + sec.Style = pick(sec.Style, "note", "plain", "warning", "gizmo") } func (s *Server) handleSectionSave(w http.ResponseWriter, r *http.Request) { diff --git a/internal/web/static/blog.css b/internal/web/static/blog.css index ace5e5a..eabb314 100644 --- a/internal/web/static/blog.css +++ b/internal/web/static/blog.css @@ -48,7 +48,19 @@ img { max-width: 100%; height: auto; } .notice-title { margin: 0 0 0.3em; font-size: 1em; text-transform: uppercase; letter-spacing: 0.05em; } .notice-body > :first-child { margin-top: 0; } .notice-body > :last-child { margin-bottom: 0; } -.content > .notice:last-child { margin: 1.5em 0 0; } +.content > .notices:last-child { margin-top: 1.5em; } +.content > .notices:last-child > .notice:last-child { margin-bottom: 0; } +/* gizmo: a box framed in the link colour (set by the theme CSS). On wide + screens the flex wrapper puts up to three headed gizmo boxes in one row + (they start at 30% and grow); a gizmo box without a heading, like every + plain/note/warning box, takes the whole row */ +.notice-gizmo { padding: 1em 1.2em; border: 1px solid; background: none; } +.notice-gizmo .notice-title { font-size: 1.15em; font-style: italic; text-transform: none; letter-spacing: 0; margin-bottom: 0.6em; } +@media (min-width: 701px) { + .notices { display: flex; flex-wrap: wrap; gap: 0 1em; align-items: stretch; } + .notices .notice { flex: 1 1 100%; } + .notices .notice-gizmo.headed { flex: 1 1 30%; } +} .pager { margin-top: 2em; padding-top: 1em; border-top: 1px solid rgba(0,0,0,0.1); text-align: center; } .pager a, .pager span { margin: 0 0.8em; } .muted { opacity: 0.7; } diff --git a/internal/web/templates/dashboard/section_form.html b/internal/web/templates/dashboard/section_form.html index 0171aaa..0a0e4ea 100644 --- a/internal/web/templates/dashboard/section_form.html +++ b/internal/web/templates/dashboard/section_form.html @@ -20,8 +20,10 @@ <option value="note"{{if eq $s.Style "note"}} selected{{end}}>{{t "Highlighted"}}</option> <option value="warning"{{if eq $s.Style "warning"}} selected{{end}}>{{t "Warning"}}</option> <option value="plain"{{if eq $s.Style "plain"}} selected{{end}}>{{t "Plain"}}</option> + <option value="gizmo"{{if eq $s.Style "gizmo"}} selected{{end}}>{{t "Gizmo"}}</option> </select></label> </div> + <p class="muted small">{{t "Gizmo is a box framed in your link colour. Gizmo boxes with a heading share a row on wide screens (up to three); one without a heading takes the whole row."}}</p> <p class="muted small">{{t "“Top” of a side column means above its modules, “bottom” below them. If that column is not shown on your blog (see"}} <a href="/b/{{.Blog.Subdomain}}/design#columns">{{t "Design"}}</a>) {{t "the announcement moves to the main content instead."}}</p> <label for="ed-body">{{t "Text"}}</label> {{template "editor" (dict "name" "body" "value" $s.BodyMD "format" $s.Format "rows" 10 "tall" false "upload" (print "/b/" .Blog.Subdomain "/files/upload") "preview" (print "/b/" .Blog.Subdomain "/preview") "csrf" .CSRF)}} diff --git a/internal/web/templates/dashboard/sections.html b/internal/web/templates/dashboard/sections.html index 4d62f29..9f0e314 100644 --- a/internal/web/templates/dashboard/sections.html +++ b/internal/web/templates/dashboard/sections.html @@ -17,7 +17,7 @@ </td> <td><a href="{{$u}}/{{.ID}}/edit">{{if .Title}}{{.Title}}{{else}}({{t "untitled"}}){{end}}</a>{{if not .Enabled}}<span class="tag off">{{t "hidden"}}</span>{{end}}</td> <td>{{if eq .Column "main"}}{{t "Main content"}}{{else if eq .Column "left"}}{{t "Left column"}}{{else}}{{t "Right column"}}{{end}}, {{t .Position}}</td> - <td>{{if eq .Style "note"}}{{t "Highlighted"}}{{else if eq .Style "warning"}}{{t "Warning"}}{{else}}{{t "Plain"}}{{end}}</td> + <td>{{if eq .Style "note"}}{{t "Highlighted"}}{{else if eq .Style "warning"}}{{t "Warning"}}{{else if eq .Style "gizmo"}}{{t "Gizmo"}}{{else}}{{t "Plain"}}{{end}}</td> <td class="nowrap"> <form method="post" action="{{$u}}/{{.ID}}/toggle" class="inline"><input type="hidden" name="_csrf" value="{{$.CSRF}}"><button class="mini">{{if .Enabled}}{{t "Hide"}}{{else}}{{t "Show"}}{{end}}</button></form> <a class="danger" href="{{$u}}/{{.ID}}/delete">{{t "delete"}}</a> diff --git a/internal/web/templates/layouts/blog.html b/internal/web/templates/layouts/blog.html index 6e8b819..76475b9 100644 --- a/internal/web/templates/layouts/blog.html +++ b/internal/web/templates/layouts/blog.html @@ -43,10 +43,12 @@ </body> </html>{{end}} -{{define "notices"}}{{range .}}<aside class="notice notice-{{.Style}}"> +{{define "notices"}}{{if .}}<div class="notices"> +{{range .}}<aside class="notice notice-{{.Style}}{{if .Title}} headed{{end}}"> {{if .Title}}<h3 class="notice-title">{{.Title}}</h3>{{end}} <div class="notice-body">{{html .BodyHTML}}</div> </aside> +{{end}}</div> {{end}}{{end}} {{/* One layout module. .m is the store.Module, .root the page data; the same diff --git a/internal/web/theme.go b/internal/web/theme.go index 1fc78ad..df2c613 100644 --- a/internal/web/theme.go +++ b/internal/web/theme.go @@ -448,6 +448,7 @@ a:hover {{"{"}}{{if .LinkHover}} color:{{.LinkHover}};{{end}}{{if eq .LinkUnderl {{- end}} .content, .mod { background:{{.ContentBg}};{{if eq .ContentStyle "flat"}} border-radius:0; box-shadow:none;{{end}} } .content {{"{"}}{{with .PaddingDesktop}} padding:{{.}};{{end}} } +.notice-gizmo { border-color:{{.LinkColor}}; } .logo { max-height:{{.LogoMaxHeight}}; } @media (min-width: 701px) { .col-left { width:{{.LeftWidth}}%; } .col-right { width:{{.RightWidth}}%; } |
