aboutsummaryrefslogtreecommitdiff
path: root/src/views/sub-search.pug
blob: f2402f760d7ef0e2431fab65f36e70874bc49ee3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
include ../mixins/header
include ../mixins/head

doctype html
html
  +head("search subreddits")
  include ../mixins/subUtils
  body
    main#content
      +header(user)
      div.hero
        h1 search subreddits
        form(action="/sub-search" method="get").search-bar
          - var prefill = original_query ?? "";
          input(type="text" name="q" placeholder="type in a search term..." value=prefill required).search-input
          button(type="submit").search-button go
        if message
          div.search-message
            i #{message}
        if items
          div.search-results
            each i in items
              div.search-result
                - var subreddit = i.data.display_name
                - var isSubbed = subs.includes(subreddit)
                div.sub-title
                  h3
                    a(href=`/r/${subreddit}`) 
                      | r/#{subreddit}
                  div#button-container
                    if isSubbed
                      button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) unsubscribe
                    else
                      button(onclick=`toggleSub('${subreddit}')` id=`thinger_${subreddit}`) subscribe

                if i.data.public_description
                  p #{i.data.public_description}