teddit-reddit-frontend-alte.../views/search.pug

121 lines
5.1 KiB
Plaintext
Raw Normal View History

2020-11-17 21:44:32 +01:00
doctype html
html
head
title search results for #{q}
include includes/head.pug
2020-11-21 13:50:12 +01:00
body(class=""+ user_preferences.theme +"")
2020-11-17 21:44:32 +01:00
include includes/topbar.pug
2020-12-01 18:56:54 +01:00
#search.sr.search-page
2020-11-17 21:44:32 +01:00
form(action="/r/" + subreddit + "/search", method="GET")
input(type="text", name="q", id="q", placeholder="search", value=""+ q +"")
div
label(for="restrict_sr") limit my search to r/#{subreddit}
if restrict_sr === 'on'
input(type="checkbox", name="restrict_sr", id="restrict_sr", checked="checked")
else
input(type="checkbox", name="restrict_sr", id="restrict_sr")
div
label(for="nsfw") include NSFW results
if nsfw === 'on'
input(type="checkbox", name="nsfw", id="nsfw", checked="checked")
else
input(type="checkbox", name="nsfw", id="nsfw")
2020-11-19 20:53:29 +01:00
div
//- Let me know if there's a better way to add selected attribute!
label(for="sort") sorted by:
select(name="sort", id="sort")
if sortby === 'relevance' || !sortby
option(value="relevance", selected="selected") relevance
option(value="top") top
option(value="new") new
option(value="comments") comments
if sortby === 'top'
option(value="relevance") relevance
option(value="top", selected="selected") top
option(value="new") new
option(value="comments") comments
if sortby === 'new'
option(value="relevance") relevance
option(value="top") top
option(value="new", selected="selected") new
option(value="comments") comments
if sortby === 'comments'
option(value="relevance") relevance
option(value="top") top
option(value="new") new
option(value="comments", selected="selected") comments
div
//- Let me know if there's a better way to add selected attribute!
label(for="t") links from:
select(name="t", id="t")
if past === 'hour'
option(value="hour", selected="selected") hour
option(value="day") 24 hours
option(value="week") week
option(value="month") month
option(value="year") year
option(value="all") all time
if past === 'day'
option(value="hour") hour
option(value="day", selected="selected") 24 hours
option(value="week") week
option(value="month") month
option(value="year") year
option(value="all") all time
if past === 'week'
option(value="hour") hour
option(value="day") 24 hours
option(value="week", selected="selected") week
option(value="month") month
option(value="year") year
option(value="all") all time
if past === 'month'
option(value="hour") hour
option(value="day") 24 hours
option(value="week") week
option(value="month", selected="selected") month
option(value="year") year
option(value="all") all time
if past === 'year'
option(value="hour") hour
option(value="day") 24 hours
option(value="week") week
option(value="month") month
option(value="year", selected="selected") year
option(value="all") all time
if past === 'all' || !past
option(value="hour") hour
option(value="day") 24 hours
option(value="week") week
option(value="month") month
option(value="year") year
option(value="all", selected="selected") all time
2020-11-17 21:44:32 +01:00
input(type="submit", value="search")
#links.search
2020-11-19 20:53:29 +01:00
if json.posts.length <= 0
h1 no results
else
each post in json.posts
.link
.upvotes
div.arrow
span #{kFormatter(post.ups)}
div.arrow.down
.image
a(href="" + post.permalink + "")
div.no-image
.title
2020-12-02 17:02:32 +01:00
a(href="" + post.permalink + "") #{cleanTitle(post.title)}
2020-11-19 20:53:29 +01:00
.meta
p.submitted(title="" + toUTCString(post.created) + "") submitted #{timeDifference(post.created)} by
a(href="/u/" + post.author + "") #{post.author}
| to
a(href="/r/" + post.subreddit + "", class="subreddit") r/#{post.subreddit}
a.comments(href="" + post.permalink + "") #{post.num_comments} comments
2020-11-17 21:44:32 +01:00
if json.before || json.after
p view more:
if json.before && !json.search_firstpage
a(href="?q=" + q + "&restrict_sr=" + restrict_sr + "&before=" + json.before + "") prev
if json.after
a(href="?q=" + q + "&restrict_sr=" + restrict_sr + "&after=" + json.after + "") next