diff options
Diffstat (limited to 'src/views')
-rw-r--r-- | src/views/comments.pug | 6 | ||||
-rw-r--r-- | src/views/index.pug | 33 | ||||
-rw-r--r-- | src/views/post-search.pug | 4 | ||||
-rw-r--r-- | src/views/search.pug | 6 | ||||
-rw-r--r-- | src/views/sub-search.pug | 6 | ||||
-rw-r--r-- | src/views/subs.pug | 4 |
6 files changed, 42 insertions, 17 deletions
diff --git a/src/views/comments.pug b/src/views/comments.pug index 17af45a..1caf65a 100644 --- a/src/views/comments.pug +++ b/src/views/comments.pug | |||
@@ -6,6 +6,8 @@ include ../utils | |||
6 | 6 | ||
7 | - var post = data.post | 7 | - var post = data.post |
8 | - var comments = data.comments | 8 | - var comments = data.comments |
9 | - var viewQuery = 'view=' + (query && query.view ? query.view : 'compact') | ||
10 | - var sortQuery = 'sort=' + (query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot') | ||
9 | doctype html | 11 | doctype html |
10 | html | 12 | html |
11 | +head(post.title) | 13 | +head(post.title) |
@@ -27,7 +29,7 @@ html | |||
27 | | | 29 | | |
28 | | · | 30 | | · |
29 | | | 31 | | |
30 | a(href=`/r/${post.subreddit}`) r/#{post.subreddit} | 32 | a(href=`/r/${post.subreddit}?${sortQuery}&${viewQuery}`) r/#{post.subreddit} |
31 | 33 | ||
32 | div.info-container | 34 | div.info-container |
33 | - var domain = (new URL(post.url)).hostname | 35 | - var domain = (new URL(post.url)).hostname |
@@ -65,7 +67,7 @@ html | |||
65 | 67 | ||
66 | if post.selftext_html | 68 | if post.selftext_html |
67 | div.self-text | 69 | div.self-text |
68 | != post.selftext_html | 70 | != convertInlineImageLinks(post.selftext_html) |
69 | 71 | ||
70 | hr | 72 | hr |
71 | 73 | ||
diff --git a/src/views/index.pug b/src/views/index.pug index 0f00efe..5c7d550 100644 --- a/src/views/index.pug +++ b/src/views/index.pug | |||
@@ -2,6 +2,8 @@ include ../mixins/post | |||
2 | include ../mixins/header | 2 | include ../mixins/header |
3 | include ../mixins/head | 3 | include ../mixins/head |
4 | include ../utils | 4 | include ../utils |
5 | - var viewQuery = query && query.view ? query.view : 'compact' | ||
6 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | ||
5 | doctype html | 7 | doctype html |
6 | html | 8 | html |
7 | +head("home") | 9 | +head("home") |
@@ -14,9 +16,9 @@ html | |||
14 | div.sub-title | 16 | div.sub-title |
15 | h1 | 17 | h1 |
16 | if isMulti | 18 | if isMulti |
17 | a(href=`/`) lurker | 19 | a(href=`/?${sortQuery}&${viewQuery}`) lurker |
18 | else | 20 | else |
19 | a(href=`/r/${subreddit}`) | 21 | a(href=`/r/${subreddit}?${sortQuery}&${viewQuery}`) |
20 | | r/#{subreddit} | 22 | | r/#{subreddit} |
21 | if !isMulti | 23 | if !isMulti |
22 | div#button-container | 24 | div#button-container |
@@ -32,27 +34,32 @@ html | |||
32 | a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan | 34 | a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan |
33 | |, author of lurker | 35 | |, author of lurker |
34 | hr | 36 | hr |
35 | details | 37 | details.sort-details |
36 | summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')} | 38 | summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')}, #{viewQuery} view |
37 | div.sort-opts | 39 | div.sort-opts |
38 | div | 40 | div |
39 | a(href=`/r/${subreddit}?sort=hot`) hot | 41 | a(href=`/r/${subreddit}?sort=hot&view=${viewQuery}`) hot |
40 | div | 42 | div |
41 | a(href=`/r/${subreddit}?sort=new`) new | 43 | a(href=`/r/${subreddit}?sort=new&view=${viewQuery}`) new |
42 | div | 44 | div |
43 | a(href=`/r/${subreddit}?sort=rising`) rising | 45 | a(href=`/r/${subreddit}?sort=rising&view=${viewQuery}`) rising |
44 | div | 46 | div |
45 | a(href=`/r/${subreddit}?sort=top`) top | 47 | a(href=`/r/${subreddit}?sort=top&view=${viewQuery}`) top |
46 | div | 48 | div |
47 | a(href=`/r/${subreddit}?sort=top&t=day`) top day | 49 | a(href=`/r/${subreddit}?sort=top&t=day&view=${viewQuery}`) top day |
48 | div | 50 | div |
49 | a(href=`/r/${subreddit}?sort=top&t=week`) top week | 51 | a(href=`/r/${subreddit}?sort=top&t=week&view=${viewQuery}`) top week |
50 | div | 52 | div |
51 | a(href=`/r/${subreddit}?sort=top&t=month`) top month | 53 | a(href=`/r/${subreddit}?sort=top&t=month&view=${viewQuery}`) top month |
52 | div | 54 | div |
53 | a(href=`/r/${subreddit}?sort=top&t=year`) top year | 55 | a(href=`/r/${subreddit}?sort=top&t=year&view=${viewQuery}`) top year |
54 | div | 56 | div |
55 | a(href=`/r/${subreddit}?sort=top&t=all`) top all | 57 | a(href=`/r/${subreddit}?sort=top&t=all&view=${viewQuery}`) top all |
58 | div.sort-opts | ||
59 | div | ||
60 | a(href=`/r/${subreddit}?sort=${sortQuery}&view=compact`) compact | ||
61 | div | ||
62 | a(href=`/r/${subreddit}?sort=${sortQuery}&view=card`) card | ||
56 | 63 | ||
57 | if posts | 64 | if posts |
58 | each child in posts.posts | 65 | each child in posts.posts |
diff --git a/src/views/post-search.pug b/src/views/post-search.pug index b80f9f6..8f93798 100644 --- a/src/views/post-search.pug +++ b/src/views/post-search.pug | |||
@@ -2,6 +2,8 @@ include ../mixins/post | |||
2 | include ../mixins/header | 2 | include ../mixins/header |
3 | include ../mixins/head | 3 | include ../mixins/head |
4 | 4 | ||
5 | - var viewQuery = query && query.view ? query.view : 'compact' | ||
6 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | ||
5 | doctype html | 7 | doctype html |
6 | html | 8 | html |
7 | +head("search posts") | 9 | +head("search posts") |
@@ -14,6 +16,8 @@ html | |||
14 | form(action="/post-search" method="get").search-bar | 16 | form(action="/post-search" method="get").search-bar |
15 | - var prefill = original_query ?? ""; | 17 | - var prefill = original_query ?? ""; |
16 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input | 18 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input |
19 | input(type="hidden" name="sort" value=sortQuery) | ||
20 | input(type="hidden" name="view" value=viewQuery) | ||
17 | button(type="submit").search-button go | 21 | button(type="submit").search-button go |
18 | if message | 22 | if message |
19 | div.search-message | 23 | div.search-message |
diff --git a/src/views/search.pug b/src/views/search.pug index ef9b53e..4dc5c0c 100644 --- a/src/views/search.pug +++ b/src/views/search.pug | |||
@@ -1,6 +1,8 @@ | |||
1 | include ../mixins/header | 1 | include ../mixins/header |
2 | include ../mixins/head | 2 | include ../mixins/head |
3 | 3 | ||
4 | - var viewQuery = query && query.view ? query.view : 'compact' | ||
5 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | ||
4 | doctype html | 6 | doctype html |
5 | html | 7 | html |
6 | +head("search subreddits") | 8 | +head("search subreddits") |
@@ -14,6 +16,8 @@ html | |||
14 | form(action="/sub-search" method="get").search-bar | 16 | form(action="/sub-search" method="get").search-bar |
15 | - var prefill = original_query ?? ""; | 17 | - var prefill = original_query ?? ""; |
16 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input | 18 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input |
19 | input(type="hidden" name="sort" value=sortQuery) | ||
20 | input(type="hidden" name="view" value=viewQuery) | ||
17 | button(type="submit").search-button go | 21 | button(type="submit").search-button go |
18 | 22 | ||
19 | hr | 23 | hr |
@@ -23,6 +27,8 @@ html | |||
23 | form(action="/post-search" method="get").search-bar | 27 | form(action="/post-search" method="get").search-bar |
24 | - var prefill = original_query ?? ""; | 28 | - var prefill = original_query ?? ""; |
25 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input | 29 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input |
30 | input(type="hidden" name="sort" value=sortQuery) | ||
31 | input(type="hidden" name="view" value=viewQuery) | ||
26 | button(type="submit").search-button go | 32 | button(type="submit").search-button go |
27 | p | 33 | p |
28 | | you can narrow search results using filters: | 34 | | you can narrow search results using filters: |
diff --git a/src/views/sub-search.pug b/src/views/sub-search.pug index f2402f7..cb8eeef 100644 --- a/src/views/sub-search.pug +++ b/src/views/sub-search.pug | |||
@@ -1,6 +1,8 @@ | |||
1 | include ../mixins/header | 1 | include ../mixins/header |
2 | include ../mixins/head | 2 | include ../mixins/head |
3 | 3 | ||
4 | - var viewQuery = (query && query.view) ? query.view : 'compact' | ||
5 | - var sortQuery = (query && query.sort) ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | ||
4 | doctype html | 6 | doctype html |
5 | html | 7 | html |
6 | +head("search subreddits") | 8 | +head("search subreddits") |
@@ -13,6 +15,8 @@ html | |||
13 | form(action="/sub-search" method="get").search-bar | 15 | form(action="/sub-search" method="get").search-bar |
14 | - var prefill = original_query ?? ""; | 16 | - var prefill = original_query ?? ""; |
15 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input | 17 | input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input |
18 | input(type="hidden" name="sort" value=sortQuery) | ||
19 | input(type="hidden" name="view" value=viewQuery) | ||
16 | button(type="submit").search-button go | 20 | button(type="submit").search-button go |
17 | if message | 21 | if message |
18 | div.search-message | 22 | div.search-message |
@@ -25,7 +29,7 @@ html | |||
25 | - var isSubbed = subs.includes(subreddit) | 29 | - var isSubbed = subs.includes(subreddit) |
26 | div.sub-title | 30 | div.sub-title |
27 | h3 | 31 | h3 |
28 | a(href=`/r/${subreddit}`) | 32 | a(href=`/r/${subreddit}?sort=${sortQuery}&view=${viewQuery}`) |
29 | | r/#{subreddit} | 33 | | r/#{subreddit} |
30 | div#button-container | 34 | div#button-container |
31 | if isSubbed | 35 | if isSubbed |
diff --git a/src/views/subs.pug b/src/views/subs.pug index 8fca12d..aff8258 100644 --- a/src/views/subs.pug +++ b/src/views/subs.pug | |||
@@ -1,6 +1,8 @@ | |||
1 | include ../mixins/header | 1 | include ../mixins/header |
2 | include ../mixins/head | 2 | include ../mixins/head |
3 | 3 | ||
4 | - var viewQuery = query && query.view ? query.view : 'compact' | ||
5 | - var sortQuery = query && query.sort ? query.sort + (query.t ? '&t=' + query.t : '') : 'hot' | ||
4 | doctype html | 6 | doctype html |
5 | html | 7 | html |
6 | +head("subscriptions") | 8 | +head("subscriptions") |
@@ -16,7 +18,7 @@ html | |||
16 | - var isSubbed = true | 18 | - var isSubbed = true |
17 | div.sub-title | 19 | div.sub-title |
18 | h4 | 20 | h4 |
19 | a(href=`/r/${subreddit}`) | 21 | a(href=`/r/${subreddit}?sort=${sortQuery}&view=${viewQuery}`) |
20 | | r/#{subreddit} | 22 | | r/#{subreddit} |
21 | div#button-container | 23 | div#button-container |
22 | if isSubbed | 24 | if isSubbed |