Initial Commit
This commit is contained in:
commit
f54d97e4a9
30 changed files with 2532 additions and 0 deletions
30
views/adminSettings.pug
Normal file
30
views/adminSettings.pug
Normal file
|
@ -0,0 +1,30 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
h2 Users
|
||||
each user in users
|
||||
span.is-size-6.inline= user.id
|
||||
if !user.doc.admin
|
||||
a(href=`/admin-settings/remove/${user.id}`)
|
||||
span.is-size-7.icon.has-text-danger
|
||||
i.fas.fa-times
|
||||
span.is-sr-only
|
||||
Remove
|
||||
br
|
||||
h3 Add user
|
||||
form(action='/admin-settings/add', method='POST')
|
||||
.field
|
||||
label.label Username
|
||||
.control.has-icons-left
|
||||
input.input(type='text', name='newUserUsername', placeholder='john')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-user
|
||||
.field
|
||||
label.label Password
|
||||
.control.has-icons-left
|
||||
input.input(type='password', name='newUserPassword', placeholder='pa$$word!')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-lock
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Add User')
|
6
views/includes/messages.pug
Normal file
6
views/includes/messages.pug
Normal file
|
@ -0,0 +1,6 @@
|
|||
if successes
|
||||
each success in successes
|
||||
p.has-text-success= success
|
||||
if errors
|
||||
each error in errors
|
||||
p.has-text-danger= error
|
36
views/includes/navbar.pug
Normal file
36
views/includes/navbar.pug
Normal file
|
@ -0,0 +1,36 @@
|
|||
mixin navBarLink(href, title)
|
||||
if href === req.path
|
||||
a.is-active.navbar-item(href=href)= title
|
||||
else
|
||||
a.navbar-item(href=href)= title
|
||||
nav.navbar(role='navigation', aria-label='main navigation')
|
||||
.navbar-brand
|
||||
if '/' === req.path
|
||||
a.is-active.navbar-item(href='/')
|
||||
img(src='/img/logo.png', alt='')
|
||||
span #{config.siteTitle}
|
||||
else
|
||||
a.navbar-item(href='/')
|
||||
img(src='/img/logo.png', alt='')
|
||||
span #{config.siteTitle}
|
||||
a.navbar-burger#navBarBurger(role='button', aria-label='menu', aria-expanded='false')
|
||||
span(aria-hidden='true')
|
||||
span(aria-hidden='true')
|
||||
span(aria-hidden='true')
|
||||
.navbar-menu#navBarMenu
|
||||
.navbar-start
|
||||
.navbar-end
|
||||
if req.isAuthenticated()
|
||||
.navbar-item.has-dropdown.is-hoverable
|
||||
a.navbar-link= req.user._id
|
||||
.navbar-dropdown
|
||||
+navBarLink(`/wishlist/${req.user._id}`, 'My Wishlist')
|
||||
+navBarLink('/profile', 'Profile')
|
||||
if req.user.admin
|
||||
+navBarLink('/admin-settings', 'Admin settings')
|
||||
hr.navbar-divider
|
||||
.navbar-item
|
||||
form#logoutForm(action='/logout', method='POST')
|
||||
button.linkButton(type='submit') Log Out
|
||||
//-+navBarLink('javascript:document.getElementById("logoutForm").submit()', 'Log Out')
|
||||
script(src="/js/nav.js")
|
28
views/layout.pug
Normal file
28
views/layout.pug
Normal file
|
@ -0,0 +1,28 @@
|
|||
doctype html
|
||||
html(lang='en')
|
||||
head
|
||||
meta(name='viewport', content='width=device-width, initial-scale=1')
|
||||
if title
|
||||
title #{config.siteTitle} - #{title}
|
||||
else
|
||||
title #{config.siteTitle}
|
||||
link(rel='stylesheet', href='/css/main.css')
|
||||
noscript
|
||||
link(
|
||||
rel='stylesheet',
|
||||
href='https://use.fontawesome.com/releases/v5.0.10/css/all.css',
|
||||
integrity='sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg',
|
||||
crossorigin='anonymous'
|
||||
)
|
||||
script(defer, src='https://use.fontawesome.com/releases/v5.0.7/js/all.js')
|
||||
body
|
||||
include includes/navbar.pug
|
||||
div.content#pageContent
|
||||
section.section
|
||||
div.container
|
||||
if title
|
||||
h1= config.siteTitle + ' - ' + title
|
||||
else if title !== false
|
||||
h1 #{config.siteTitle}
|
||||
include includes/messages.pug
|
||||
block content
|
20
views/login.pug
Normal file
20
views/login.pug
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
form(method='POST')
|
||||
.field
|
||||
label.label Username
|
||||
.control.has-icons-left
|
||||
input.input(type='text', name='username', placeholder='john')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-user
|
||||
.field
|
||||
label.label Password
|
||||
.control.has-icons-left
|
||||
input.input(type='password', name='password', placeholder='pa$$word!')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-lock
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Log In')
|
||||
|
7
views/logout.pug
Normal file
7
views/logout.pug
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
form(method='POST')
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Log Out')
|
20
views/profile.pug
Normal file
20
views/profile.pug
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
form(method='POST')
|
||||
.field
|
||||
label.label Old Password (Required if changing password)
|
||||
.control.has-icons-left
|
||||
input.input(type='password', name='oldPassword', placeholder='pa$$word!')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-lock
|
||||
.field
|
||||
label.label New Password (Leave blank if not changing password)
|
||||
.control.has-icons-left
|
||||
input.input(type='password', name='newPassword', placeholder='pa$$word!')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-lock
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Save')
|
||||
|
7
views/remove.pug
Normal file
7
views/remove.pug
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
form(method='POST')
|
||||
.field
|
||||
.control
|
||||
input.button.is-danger(type='submit' value=`Remove user ${userToRemove}`)
|
20
views/setup.pug
Normal file
20
views/setup.pug
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
h2 Admin User
|
||||
form(action='/setup', method='POST')
|
||||
.field
|
||||
label.label Username
|
||||
.control.has-icons-left
|
||||
input.input(type='text', name='adminUsername', placeholder='john')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-user
|
||||
.field
|
||||
label.label Password
|
||||
.control.has-icons-left
|
||||
input.input(type='password', name='adminPassword', placeholder='pa$$word!')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-lock
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Set up!')
|
36
views/wishlist.pug
Normal file
36
views/wishlist.pug
Normal file
|
@ -0,0 +1,36 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
for item in wishlist
|
||||
if req.user._id === item.addedBy || req.params.user !== req.user._id
|
||||
.box
|
||||
if item.url
|
||||
span
|
||||
a(href=item.url, rel='noopener noreferrer', target='_blank')= (item.name ? item.name : item.url)
|
||||
if req.params.user !== req.user._id && !item.pledgedBy
|
||||
form(method='POST', action=`/wishlist/${req.params.user}/pledge/${item.id}`)
|
||||
.field
|
||||
.control
|
||||
input.button.is-primary(type='submit' value='Pledge')
|
||||
if item.pledgedBy === req.user._id
|
||||
form(method='POST', action=`/wishlist/${req.params.user}/unpledge/${item.id}`)
|
||||
.field
|
||||
.control
|
||||
input.button(type='submit' value='Unpledge')
|
||||
if req.user._id === req.params.user
|
||||
form(method='POST', action=`/wishlist/${req.params.user}/remove/${item.id}`)
|
||||
.field
|
||||
.control
|
||||
input.button.is-warning(type='submit' value='Remove')
|
||||
else
|
||||
span= item.name
|
||||
form(method='POST')
|
||||
.field
|
||||
label.label Item URL or Name
|
||||
.control.has-icons-left
|
||||
input.input(type='text', name='itemUrlOrName', placeholder='https://www.amazon.com/dp/B00ZV9RDKK')
|
||||
span.icon.is-small.is-left
|
||||
i.fas.fa-gift
|
||||
.field
|
||||
.control
|
||||
input.button(type='submit' value=(req.user._id === req.params.user ? 'Add item to wishlist' : 'Pledge item'))
|
12
views/wishlists.pug
Normal file
12
views/wishlists.pug
Normal file
|
@ -0,0 +1,12 @@
|
|||
extends layout.pug
|
||||
|
||||
block content
|
||||
ul.noStyle
|
||||
each user in users
|
||||
if req.user._id !== user.id
|
||||
li
|
||||
a(href=`/wishlist/${user.id}`)
|
||||
.box
|
||||
span= user.id
|
||||
span= `: ${totals(user.doc.wishlist).pledged}/${user.doc.wishlist.length}`
|
||||
progress.progress.is-info(value=totals(user.doc.wishlist).pledged, max=user.doc.wishlist.length)
|
Loading…
Add table
Add a link
Reference in a new issue