diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/routes/index.js | 4 | ||||
-rw-r--r-- | src/views/index.pug | 1 | ||||
-rw-r--r-- | src/views/sub-search.pug | 4 | ||||
-rw-r--r-- | src/views/subs.pug | 14 |
4 files changed, 16 insertions, 7 deletions
diff --git a/src/routes/index.js b/src/routes/index.js index c56b73e..6e54ef3 100644 --- a/src/routes/index.js +++ b/src/routes/index.js | |||
@@ -106,7 +106,7 @@ router.get("/subs", authenticateToken, async (req, res) => { | |||
106 | // GET /search-subreddits | 106 | // GET /search-subreddits |
107 | router.get("/search", authenticateToken, async (req, res) => { | 107 | router.get("/search", authenticateToken, async (req, res) => { |
108 | if (!req.query || !req.query.q) { | 108 | if (!req.query || !req.query.q) { |
109 | res.render("sub-search", {}); | 109 | res.render("sub-search", { user: req.user }); |
110 | } else { | 110 | } else { |
111 | const { q, options } = req.query.q.split(/\s+/).reduce( | 111 | const { q, options } = req.query.q.split(/\s+/).reduce( |
112 | (acc, word) => { | 112 | (acc, word) => { |
@@ -131,7 +131,7 @@ router.get("/search", authenticateToken, async (req, res) => { | |||
131 | items.length === 0 | 131 | items.length === 0 |
132 | ? "no results found" | 132 | ? "no results found" |
133 | : `showing ${items.length} results`; | 133 | : `showing ${items.length} results`; |
134 | res.render("sub-search", { items, subs, after, message }); | 134 | res.render("sub-search", { items, subs, after, message, user: req.user }); |
135 | } | 135 | } |
136 | }); | 136 | }); |
137 | 137 | ||
diff --git a/src/views/index.pug b/src/views/index.pug index 636f9ac..a3bcd84 100644 --- a/src/views/index.pug +++ b/src/views/index.pug | |||
@@ -31,6 +31,7 @@ html | |||
31 | | consider donating to | 31 | | consider donating to |
32 | a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan | 32 | a(href="https://donate.stripe.com/dR62bTaZH1295Da4gg") oppiliappan |
33 | |, author of readit | 33 | |, author of readit |
34 | hr | ||
34 | details | 35 | details |
35 | summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')} | 36 | summary.sorting sorting by #{query.sort + (query.t?' '+query.t:'')} |
36 | div.sort-opts | 37 | div.sort-opts |
diff --git a/src/views/sub-search.pug b/src/views/sub-search.pug index 4fa707e..da33214 100644 --- a/src/views/sub-search.pug +++ b/src/views/sub-search.pug | |||
@@ -14,8 +14,8 @@ html | |||
14 | input(type="text" name="q" placeholder="search subreddits (add +nsfw to include over-18 results)" required).search-input | 14 | input(type="text" name="q" placeholder="search subreddits (add +nsfw to include over-18 results)" required).search-input |
15 | button(type="submit").search-button go | 15 | button(type="submit").search-button go |
16 | if message | 16 | if message |
17 | div.search-message | 17 | div.search-message |
18 | | #{message} | 18 | i #{message} |
19 | if items | 19 | if items |
20 | div.search-results | 20 | div.search-results |
21 | each i in items | 21 | each i in items |
diff --git a/src/views/subs.pug b/src/views/subs.pug index 41f29ce..eba1961 100644 --- a/src/views/subs.pug +++ b/src/views/subs.pug | |||
@@ -4,6 +4,7 @@ include ../mixins/head | |||
4 | doctype html | 4 | doctype html |
5 | html | 5 | html |
6 | +head("subscriptions") | 6 | +head("subscriptions") |
7 | include ../mixins/subUtils | ||
7 | body | 8 | body |
8 | main#content | 9 | main#content |
9 | +header(user) | 10 | +header(user) |
@@ -11,6 +12,13 @@ html | |||
11 | h1 subscriptions | 12 | h1 subscriptions |
12 | p | 13 | p |
13 | each s in subs | 14 | each s in subs |
14 | a(href=`/r/${s.subreddit}`) | 15 | - var subreddit = s.subreddit |
15 | | r/#{s.subreddit} | 16 | div.sub-title |
16 | br | 17 | h4 |
18 | a(href=`/r/${subreddit}`) | ||
19 | | r/#{subreddit} | ||
20 | div#button-container | ||
21 | if isSubbed | ||
22 | button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) unsubscribe | ||
23 | else | ||
24 | button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) subscribe | ||