summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-07-10 11:00:04 -0400
committerJune McEnroe <june@causal.agency>2020-07-10 11:00:04 -0400
commit1f6eacb77c39a7e53acb43b032c4bf3f5de03505 (patch)
tree29b7230d208d6f1dacf2a97c8dcf2c935c2259ab
parentAdd meta viewport tag (diff)
downloadscooper-1f6eacb77c39a7e53acb43b032c4bf3f5de03505.tar.gz
scooper-1f6eacb77c39a7e53acb43b032c4bf3f5de03505.zip
Move search help to footer
-rw-r--r--contexts.c4
-rw-r--r--default.css10
-rw-r--r--events.c4
-rw-r--r--html.c41
-rw-r--r--networks.c4
-rw-r--r--server.h1
6 files changed, 45 insertions, 19 deletions
diff --git a/contexts.c b/contexts.c
index b81c515..77774ae 100644
--- a/contexts.c
+++ b/contexts.c
@@ -107,5 +107,7 @@ enum kcgi_err pageContexts(struct kreq *req) {
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
 	sqlite3_reset(stmt.contexts);
 
-	return error || khtml_close(&html);
+	return error
+		|| htmlFooter(&html)
+		|| khtml_close(&html);
 }
diff --git a/default.css b/default.css
index 5ed641e..449132f 100644
--- a/default.css
+++ b/default.css
@@ -21,7 +21,7 @@ nav {
 }
 
 nav ol {
-	margin: 1em 0 0;
+	margin: 1em 1ch 0 0;
 	padding: 0;
 	list-style-type: none;
 }
@@ -35,7 +35,13 @@ nav ol li::before {
 nav form {
 	margin-top: 1em;
 }
-nav form span[title] {
+
+footer {
+	display: flex;
+	flex-wrap: wrap;
+	justify-content: space-between;
+}
+footer span[title] {
 	text-decoration: underline;
 	text-decoration-style: dotted;
 	cursor: help;
diff --git a/events.c b/events.c
index deedc59..7962ab3 100644
--- a/events.c
+++ b/events.c
@@ -131,5 +131,7 @@ enum kcgi_err pageEvents(struct kreq *req) {
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
 	sqlite3_reset(events);
 
-	return error || khtml_close(&html);
+	return error
+		|| htmlFooter(&html)
+		|| khtml_close(&html);
 }
diff --git a/html.c b/html.c
index 35b9d82..6141514 100644
--- a/html.c
+++ b/html.c
@@ -46,13 +46,6 @@ enum kcgi_err htmlHead(struct khtmlreq *html, const char *title) {
 		|| khtml_closeelem(html, 1);
 }
 
-static const char *SyntaxURL = {
-	"https://www.sqlite.org/fts5.html#full_text_query_syntax"
-};
-static const char *Columns = {
-	"network, channel, query, nick, user, target, message"
-};
-
 enum kcgi_err
 htmlNav(struct khtmlreq *html, const char *network, const char *context) {
 	enum kcgi_err error = 0
@@ -121,13 +114,6 @@ htmlNav(struct khtmlreq *html, const char *network, const char *context) {
 			KATTR_VALUE, label,
 			KATTR__MAX
 		)
-		|| khtml_putc(html, ' ')
-		|| khtml_attr(html, KELEM_A, KATTR_HREF, SyntaxURL, KATTR__MAX)
-		|| khtml_puts(html, "Syntax")
-		|| khtml_closeelem(html, 1)
-		|| khtml_putc(html, ' ')
-		|| khtml_attr(html, KELEM_SPAN, KATTR_TITLE, Columns, KATTR__MAX)
-		|| khtml_puts(html, "Columns")
 		|| khtml_closeelem(html, 1);
 	if (error) return error;
 
@@ -155,3 +141,30 @@ htmlNav(struct khtmlreq *html, const char *network, const char *context) {
 
 	return khtml_closeelem(html, 2);
 }
+
+static const char *SourceURL = "https://git.causal.agency/scooper";
+static const char *SyntaxURL = {
+	"https://www.sqlite.org/fts5.html#full_text_query_syntax"
+};
+static const char *Columns = {
+	"network, channel, query, nick, user, target, message"
+};
+
+enum kcgi_err htmlFooter(struct khtmlreq *html) {
+	return 0
+		|| khtml_closeto(html, 0)
+		|| khtml_elem(html, KELEM_FOOTER)
+		|| khtml_elem(html, KELEM_SPAN)
+		|| khtml_attr(html, KELEM_A, KATTR_HREF, SourceURL, KATTR__MAX)
+		|| khtml_puts(html, "scooper is AGPLv3+")
+		|| khtml_closeelem(html, 2)
+		|| khtml_putc(html, ' ')
+		|| khtml_elem(html, KELEM_SPAN)
+		|| khtml_attr(html, KELEM_A, KATTR_HREF, SyntaxURL, KATTR__MAX)
+		|| khtml_puts(html, "Search syntax")
+		|| khtml_closeelem(html, 1)
+		|| khtml_putc(html, ' ')
+		|| khtml_attr(html, KELEM_SPAN, KATTR_TITLE, Columns, KATTR__MAX)
+		|| khtml_puts(html, "Columns")
+		|| khtml_closeto(html, 0);
+}
diff --git a/networks.c b/networks.c
index d1e292d..f397bab 100644
--- a/networks.c
+++ b/networks.c
@@ -96,5 +96,7 @@ enum kcgi_err pageNetworks(struct kreq *req) {
 	if (result != SQLITE_DONE) errx(EX_SOFTWARE, "%s", sqlite3_errmsg(db));
 	sqlite3_reset(stmt.networks);
 
-	return error || khtml_close(&html);
+	return error
+		|| htmlFooter(&html)
+		|| khtml_close(&html);
 }
diff --git a/server.h b/server.h
index d07631e..5d37176 100644
--- a/server.h
+++ b/server.h
@@ -141,3 +141,4 @@ enum kcgi_err htmlHead(struct khtmlreq *html, const char *title);
 enum kcgi_err htmlNav(
 	struct khtmlreq *html, const char *network, const char *context
 );
+enum kcgi_err htmlFooter(struct khtmlreq *html);