diff options
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/post-search.pug | 23 | ||||
-rw-r--r-- | src/views/search.pug | 54 | ||||
-rw-r--r-- | src/views/sub-search.pug | 4 |
3 files changed, 79 insertions, 2 deletions
diff --git a/src/views/post-search.pug b/src/views/post-search.pug new file mode 100644 index 0000000..441d939 --- /dev/null +++ b/src/views/post-search.pug | |||
@@ -0,0 +1,23 @@ | |||
1 | include ../mixins/post | ||
2 | include ../mixins/header | ||
3 | include ../mixins/head | ||
4 | |||
5 | doctype html | ||
6 | html | ||
7 | +head("search posts") | ||
8 | include ../mixins/subUtils | ||
9 | body | ||
10 | main#content | ||
11 | +header(user) | ||
12 | div.hero | ||
13 | h1 search posts | ||
14 | form(action="/post-search" method="get").search-bar | ||
15 | - var prefill = original_query ?? ""; | ||
16 | input(type="text" name="q" placeholder="search posts" value=prefill required).search-input | ||
17 | button(type="submit").search-button go | ||
18 | if message | ||
19 | div.search-message | ||
20 | i #{message} | ||
21 | if items | ||
22 | each item in items | ||
23 | +post(item.data) | ||
diff --git a/src/views/search.pug b/src/views/search.pug new file mode 100644 index 0000000..216875f --- /dev/null +++ b/src/views/search.pug | |||
@@ -0,0 +1,54 @@ | |||
1 | include ../mixins/header | ||
2 | include ../mixins/head | ||
3 | |||
4 | doctype html | ||
5 | html | ||
6 | +head("search subreddits") | ||
7 | include ../mixins/subUtils | ||
8 | body | ||
9 | main#content | ||
10 | +header(user) | ||
11 | div.hero | ||
12 | h1 search subreddits | ||
13 | |||
14 | form(action="/sub-search" method="get").search-bar | ||
15 | - var prefill = original_query ?? ""; | ||
16 | input(type="text" name="q" placeholder="search subreddits" value=prefill required).search-input | ||
17 | button(type="submit").search-button go | ||
18 | |||
19 | h1 search posts | ||
20 | |||
21 | form(action="/post-search" method="get").search-bar | ||
22 | - var prefill = original_query ?? ""; | ||
23 | input(type="text" name="q" placeholder="search posts" value=prefill required).search-input | ||
24 | button(type="submit").search-button go | ||
25 | |||
26 | hr | ||
27 | |||
28 | h3 tips | ||
29 | p | ||
30 | | you can narrow search results using filters: | ||
31 | br | ||
32 | - | ||
33 | var triples = [ | ||
34 | ["subreddit", "ohio", "find submissions in 'r/ohio'"], | ||
35 | ["author", "spez", "find submissions by 'u/spez'"], | ||
36 | ["site", "x.com", "find submissions from 'x.com'"], | ||
37 | ["url", "text", "search for 'text' in url"], | ||
38 | ["selftext", "text", "search for 'text' in post contents"], | ||
39 | ["self", "yes/no", "include/exclude selftext posts"], | ||
40 | ["nsfw", "yes/no", "include/exclude over-18 posts"], | ||
41 | ] | ||
42 | |||
43 | ul | ||
44 | each triple in triples | ||
45 | li | ||
46 | strong | ||
47 | | #{triple[0]}: | ||
48 | em #{triple[1]} | ||
49 | | #{triple[2]} | ||
50 | | example: | ||
51 | br | ||
52 | | | ||
53 | code subreddit:iowa site:x.com elections | ||
54 | |||
diff --git a/src/views/sub-search.pug b/src/views/sub-search.pug index bf0d402..76d72a8 100644 --- a/src/views/sub-search.pug +++ b/src/views/sub-search.pug | |||
@@ -10,9 +10,9 @@ html | |||
10 | +header(user) | 10 | +header(user) |
11 | div.hero | 11 | div.hero |
12 | h1 search subreddits | 12 | h1 search subreddits |
13 | form(action="/search" method="get").search-bar | 13 | form(action="/sub-search" method="get").search-bar |
14 | - var prefill = original_query ?? ""; | 14 | - var prefill = original_query ?? ""; |
15 | input(type="text" name="q" placeholder="search subreddits (add +nsfw to include over-18 results)" value=prefill required).search-input | 15 | input(type="text" name="q" placeholder="search subreddits" value=prefill required).search-input |
16 | button(type="submit").search-button go | 16 | button(type="submit").search-button go |
17 | if message | 17 | if message |
18 | div.search-message | 18 | div.search-message |