refactor: views consolidation + css fixes

This commit is contained in:
Nicolas Giard
2018-08-11 18:16:56 -04:00
parent a78c6505f0
commit 453c1beab3
47 changed files with 189 additions and 1055 deletions

View File

@@ -34,7 +34,7 @@ const bruteforce = new ExpressBrute(EBstore, {
* Login form
*/
router.get('/login', function (req, res, next) {
res.render('main/login')
res.render('login')
})
router.post('/login', bruteforce.prevent, function (req, res, next) {

View File

@@ -5,35 +5,35 @@ const router = express.Router()
* Create/Edit document
*/
router.get(['/e', '/e/*'], (req, res, next) => {
res.render('main/editor')
res.render('editor')
})
/**
* Administration
*/
router.get(['/a', '/a/*'], (req, res, next) => {
res.render('main/admin')
res.render('admin')
})
/**
* Profile
*/
router.get(['/p', '/p/*'], (req, res, next) => {
res.render('main/profile')
res.render('profile')
})
/**
* View document
*/
router.get('/', (req, res, next) => {
res.render('main/welcome')
res.render('welcome')
})
/**
* View document
*/
router.get('/*', (req, res, next) => {
res.render('main/page')
res.render('page')
})
module.exports = router

5
server/views/admin.pug Normal file
View File

@@ -0,0 +1,5 @@
extends master.pug
block body
#root
admin

View File

@@ -1,65 +0,0 @@
extends ../../layout.pug
block rootNavCenter
h2.nav-item= t('nav.settings')
block rootNavRight
loading-spinner
.nav-item
a.button.btn-edit-discard(href='/')
i.nc-icon-outline.ui-1_home-minimal
span= t('nav.root')
block content
#page-type-account
.container.is-fluid
.columns.is-gapless
.column.is-narrow.is-hidden-touch.sidebar
aside
.sidebar-label
span= t('sidebar.navigation')
ul.sidebar-menu
li
a(href='/')
i.nc-icon-outline.ui-1_home-minimal
span= t('nav.root')
aside
.sidebar-label
span= t('nav.account')
ul.sidebar-menu
li
a(href='/admin/profile')
i.nc-icon-outline.business_business-contact-86
span= t('nav.myprofile')
li
a(href='/admin/stats')
i.nc-icon-outline.ui-3_chart-bars
span= t('nav.stats')
if rights.manage
li
a(href='/admin/users')
i.nc-icon-outline.users_multiple-19
span= t('nav.users')
li
a(href='/admin/theme')
i.nc-icon-outline.ui-1_drop
span= t('nav.theme')
//-li
a(href='/admin/settings')
i.nc-icon-outline.ui-1_settings-gear-63
span= t('nav.syssettings')
li
a(href='/admin/system')
i.nc-icon-outline.objects_planet
span= t('nav.sysinfo')
li
a(href='/logout')
i.nc-icon-outline.arrows-1_log-out
span= t('nav.logout')
.column
block adminContent

View File

@@ -1,62 +0,0 @@
extends ./_layout.pug
block adminContent
.hero
h1.title#title= t('nav.myprofile')
h2.subtitle= t('admin:profile.subtitle')
i.pageicon.nc-icon-outline.business_business-contact-86
.form-sections
.columns.is-gapless
.column.is-two-thirds
admin-profile(inline-template, email=user.email, name=user.name, provider=user.provider)
div
section
label.label= t('admin:profile.email')
p.control.is-fullwidth
input.input(type='text', placeholder=t('admin:profile.email'), value=user.email, disabled)
if user.provider === 'local'
section
label.label= t('admin:profile.password')
p.control.is-fullwidth
input.input(type='password', placeholder=t('admin:profile.password'), value='********', v-model='password')
section
label.label= t('admin:profile.passwordverify')
p.control.is-fullwidth
input.input(type='password', placeholder=t('admin:profile.password'), value='********', v-model='passwordVerify')
section
label.label= t('admin:profile.displayname')
p.control.is-fullwidth
input.input(type='text', placeholder=t('admin:profile.displaynameexample'), v-model='name')
//-section
label.label #{t('admin:profile.tfa')}: #[strong.is-red(v-cloak) {{ tfaStatus }}]
button.button.is-blue(@click='$store.dispatch("modalProfile2fa/open")', :disabled='tfaIsActive')
i.nc-icon-outline.ui-1_circle-add
span= t('admin:profile.tfaenable')
button.button.is-blue(@click='saveUser', :disabled='!tfaIsActive')
i.nc-icon-outline.ui-1_circle-delete
span= t('admin:profile.tfadisable')
section
button.button.is-green(@click='saveUser')
i.nc-icon-outline.ui-1_check
span= t('admin:profile.savechanges')
.column
.panel-aside
label.label= t('admin:profile.provider')
p.control.account-profile-provider
case user.provider
when 'local': i.nc-icon-outline.ui-1_database
when 'windowslive': i.icon-windows2.is-blue
when 'azure': i.icon-windows2.is-blue
when 'google': i.icon-google.is-blue
when 'facebook': i.icon-facebook.is-indigo
when 'github': i.icon-github.is-grey
when 'slack': i.icon-slack.is-purple
when 'ldap': i.icon-arrow-repeat-outline
default: i.icon-warning
= t('auth:providers.' + user.provider)
label.label= t('admin:profile.membersince')
p.control= moment(user.createdAt).format('LL')
label.label= t('admin:profile.lastprofileupdate')
p.control= moment(user.updatedAt).format('LL')
//-modal-profile-2fa

View File

@@ -1,9 +0,0 @@
extends ./_layout.pug
block adminContent
.hero
h1.title#title= t('nav.syssettings')
h2.subtitle= t('admin:settings.subtitle')
i.pageicon.nc-icon-outline.ui-1_settings-gear-63
.form-sections
section Coming soon

View File

@@ -1,15 +0,0 @@
extends ./_layout.pug
block adminContent
.hero
h1.title#title= t('nav.stats')
h2.subtitle= t('admin:stats.subtitle')
i.pageicon.nc-icon-outline.ui-3_chart-bars
.form-sections
section
label.label= t('admin:stats.entries')
p.control= totalEntries
label.label= t('admin:stats.uploads')
p.control= totalUploads
label.label= t('admin:stats.users')
p.control= totalUsers

View File

@@ -1,47 +0,0 @@
extends ./_layout.pug
block adminContent
.hero
h1.title#title= t('nav.sysinfo')
h2.subtitle= t('admin:system.subtitle')
i.pageicon.nc-icon-outline.objects_planet
admin-settings(inline-template)
.form-sections
section
img(src='/images/logo.png', style={width:'200px', float:'right'})
label.label= t('admin:system.systemversion')
.section-block
p #{t('admin:system.currentversion')}: #[strong= sysversion.current]
if sysversion.latest
p #{t('admin:system.latestversion')}: #[strong= sysversion.latest] #[em (Published #{moment(sysversion.latestPublishedAt).fromNow()})]
p
if sysversion.current !== sysversion.latest
button.button.is-deep-orange(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "upgrade"})')= t('admin:system.upgrade')
else
button.button.is-disabled= t('admin:system.upgrade')
button.button.is-deep-orange.is-outlined(@click='$store.dispatch("modalUpgradeSystem/open", { mode: "reinstall"})')= t('admin:system.reinstall')
else
p: em= t('admin:system.versioncheckfailed')
section
label.label= t('admin:system.hostinfo')
.section-block
p #{t('admin:system.os')}: #[strong= hostInfo.os]
p #{t('admin:system.nodeversion')}: #[strong= hostInfo.nodeversion]
p #{t('admin:system.hostname')}: #[strong= hostInfo.hostname]
p #{t('admin:system.cores')}: #[strong= hostInfo.cpus.length]
p #{t('admin:system.totalmem')}: #[strong= hostInfo.totalmem]
p #{t('admin:system.cwd')}: #[strong= hostInfo.cwd]
section
label.label= t('admin:system.administrativetools')
.section-block
h6 #{t('admin:system.flushcache')}:
p.is-small= t('admin:system.flushcachetext')
p: button.button.is-teal.is-outlined(v-on:click='flushcache')= t('admin:system.flushcachebtn')
h6 #{t('admin:system.resetaccounts')}:
p.is-small= t('admin:system.resetaccountstext')
p: button.button.is-teal.is-outlined(v-on:click='resetaccounts')= t('admin:system.resetaccountsbtn')
h6 #{t('admin:system.flushsessions')}:
p.is-small= t('admin:system.flushsessionstext')
p: button.button.is-teal.is-outlined(v-on:click='flushsessions')= t('admin:system.flushsessionsbtn')
modal-upgrade-system

View File

@@ -1,32 +0,0 @@
extends ./_layout.pug
block adminContent
.hero
h1.title#title= t('nav.theme')
h2.subtitle= t('admin:theme.subtitle')
i.pageicon.nc-icon-outline.ui-1_drop
admin-theme(inline-template, themedata=JSON.stringify(appconfig.theme))
.form-sections
section
label.label= t('admin:theme.primarycolor')
color-picker(v-model='primary')
span.desc= t('admin:theme.primarycolordesc')
section
label.label= t('admin:theme.altcolor')
color-picker(v-model='alt')
span.desc= t('admin:theme.altcolordesc')
section
label.label= t('admin:theme.footercolor')
color-picker(v-model='footer')
span.desc= t('admin:theme.footercolordesc')
section
label.label= t('admin:theme.codeblock.title')
toggle(v-model='codedark', desc=t('admin:theme.codeblock.dark'))
toggle(v-model='codecolorize', desc=t('admin:theme.codeblock.colorize'))
section
button.button.is-grey(@click='resetTheme')
i.nc-icon-outline.design_paint-37
span= t('admin:theme.reset')
button.button.is-green(@click='saveTheme')
i.nc-icon-outline.ui-1_check
span= t('admin:theme.savechanges')

View File

@@ -1,122 +0,0 @@
extends ./_layout.pug
block rootNavRight
loading-spinner
.nav-item
a.button(href='/admin/users')
i.nc-icon-outline.arrows-2_corner-left-round
span= t('admin:users.returntousers')
block adminContent
admin-edit-user(inline-template, usrdata=JSON.stringify(usr))
div
.hero
h1.title= t('admin:users.edituser')
h2.subtitle= usr.email
i.pageicon.nc-icon-outline.users_single-05
table.table
thead
tr
th= t('admin:users.uniqueid')
th= t('admin:users.provider')
th= t('admin:users.createdon')
th= t('admin:users.updatedon')
tbody
tr
td.is-centered= usr._id
td.is-centered.has-icons
case usr.provider
when 'local': i.nc-icon-outline.ui-1_database
when 'windowslive': i.icon-windows2.is-blue
when 'azure': i.icon-windows2.is-blue
when 'google': i.icon-google.is-blue
when 'facebook': i.icon-facebook.is-indigo
when 'github': i.icon-github.is-grey
when 'slack': i.icon-slack.is-purple
when 'ldap': i.icon-arrow-repeat-outline
default: i.icon-warning
= t('auth:providers.' + usr.provider)
td.is-centered= moment(usr.createdAt).format('lll')
td.is-centered= moment(usr.updatedAt).format('lll')
.form-sections
section
label.label= t('admin:profile.email')
p.control.is-fullwidth
input.input(type='text', placeholder='john.smith@example.com', v-model='email', disabled=!usrOpts.canChangeEmail)
section
label.label= t('admin:profile.displayname')
p.control.is-fullwidth
input.input(type='text', placeholder=t('admin:profile.displaynameexample'), v-model='name', disabled=!usrOpts.canChangeName)
if usrOpts.canChangePassword
section
label.label= t('admin:profile.password')
p.control.is-fullwidth
input.input(type='password', placeholder=t('admin:profile.password'), v-model='password', value='********')
section
label.label Access Rights
table.table
thead.is-teal
tr
th
th(style={width: '200px'}) Permission(s)
th Path
th(style={width: '150px'}) Access
th(style={width: '50px'})
tbody
tr(v-for='(right, idx) in rights', v-cloak)
td.is-icon
i.nc-icon-outline.ui-2_square-add-08.is-green(v-if='right.deny === false || right.deny === "false"')
i.nc-icon-outline.ui-2_square-delete-10.is-red(v-if='right.deny === true || right.deny === "true"')
td
p.control.is-fullwidth
select(v-model='right.role')
option(value='write') Read and Write
option(value='read') Read Only
td
.columns
.column.is-narrow
p.control
select(v-model='right.exact')
option(value='false') Path starts with:
option(value='true') Path match exactly:
.column
p.control.is-fullwidth
input.input(type='text', placeholder='/', v-model='right.path')
td
p.control.is-fullwidth
select(v-model='right.deny')
option(value='false') Allow
option(value='true') Deny
td.is-centered.has-action-icons
i.icon-delete.is-red(v-on:click='removeRightsRow(idx)')
tr(v-if='rights.length < 1', v-cloak)
td.is-icon
td.is-centered(colspan='3'): em No additional access rights
td.is-centered.has-action-icons
.table-actions
button.button.is-blue(v-on:click='addRightsRow')
i.nc-icon-outline.ui-1_simple-add
span Add New Row
section
label.label Role Override
p.control.is-fullwidth
select(v-model='roleoverride', disabled=!usrOpts.canChangeRole)
option(value='none') None
option(value='admin') Global Administrator
.columns.is-gapless
.column
section
button.button.is-green(v-on:click='saveUser')
i.nc-icon-outline.ui-1_check
span Save Changes
a.button.button.is-grey.is-outlined(href='/admin/users')
i.nc-icon-outline.ui-1_simple-remove
span Discard
.column.is-narrow
section
if usrOpts.canBeDeleted
button.button.is-red(v-on:click='$store.dispatch("modalDeleteUser/open")')
i.nc-icon-outline.ui-1_trash
span Delete Account
modal-delete-user(current-user=usr._id)

View File

@@ -1,47 +0,0 @@
extends ./_layout.pug
block rootNavRight
loading-spinner
.nav-item
a.button(v-on:click='$store.dispatch("modalCreateUser/open")')
i.nc-icon-outline.ui-1_simple-add
span= t('admin:users.createauthorize')
block adminContent
.hero
h1.title#title= t('nav.users')
h2.subtitle= t('admin:users.subtitle')
i.pageicon.nc-icon-outline.users_multiple-19
table.table
thead
tr
th
th= t('admin:users.name')
th= t('admin:users.email')
th= t('admin:users.provider')
th= t('admin:users.createdon')
th= t('admin:users.updatedon')
tbody
each usr in usrs
tr
td.is-icon
i.nc-icon-outline.users_single-05.is-grey
td
a(href='/admin/users/' + usr._id)= usr.name
td= usr.email
td.is-centered.has-icons
case usr.provider
when 'local': i.nc-icon-outline.ui-1_database
when 'windowslive': i.icon-windows2.is-blue
when 'azure': i.icon-windows2.is-blue
when 'google': i.icon-google.is-blue
when 'facebook': i.icon-facebook.is-indigo
when 'github': i.icon-github.is-grey
when 'slack': i.icon-slack.is-purple
when 'ldap': i.icon-arrow-repeat-outline
default: i.icon-warning
= t('auth:providers.' + usr.provider)
td.is-centered= moment(usr.createdAt).format('lll')
td.is-centered= moment(usr.updatedAt).format('lll')
modal-create-user

View File

@@ -1,14 +0,0 @@
#alerts
ul
template(v-for='aItem in children', track-by='_uid')
li(v-bind:class='aItem.class')
button(v-on:click='acknowledge(aItem._uid)')
strong {{ aItem.title }}
span {{ aItem.message }}
if appflash.length > 0
script(type='text/javascript').
var alertsData = !{JSON.stringify(appflash)};
else
script(type='text/javascript').
var alertsData = [];

View File

@@ -1,8 +0,0 @@
footer.footer(class=['is-' + appconfig.theme.footer], ref='footer')
span
= t('footer.poweredby') + ' '
a(href='https://github.com/Requarks/wiki') Wiki.js
| .
ul
li: a(href='/')= t('footer.home')
li: a(href='#root')= t('footer.top')

View File

@@ -1,19 +0,0 @@
#header-container
nav.nav#header(class=['is-' + appconfig.theme.primary], ref='header')
.nav-left
block rootNavLeft
a.nav-item(href='/')
h1
i.nc-icon-outline.ui-2_layers
= appconfig.title
.nav-center
block rootNavCenter
search
span.nav-toggle
span
span
span
.nav-right
block rootNavRight
loading-spinner

View File

@@ -1,6 +1,6 @@
extends ../master.pug
extends master.pug
block body
#app
#root
v-app
editor

View File

@@ -1,7 +1,7 @@
extends ./master.pug
extends master.pug
block body
#app.is-fullscreen
#root.is-fullscreen
v-app(dark)
.app-error
v-container

View File

@@ -1,30 +0,0 @@
doctype html
html(data-logic='error')
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
meta(name='viewport', content='width=device-width, initial-scale=1')
meta(name='theme-color', content='#009688')
meta(name='msapplication-TileColor', content='#009688')
meta(name='msapplication-TileImage', content=appconfig.host + '/favicons/ms-icon-144x144.png')
title= appconfig.title
// Favicon
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href=appconfig.host + '/favicons/apple-icon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes='192x192', href=appconfig.host + '/favicons/android-icon-192x192.png')
each favsize in [32, 96, 16]
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href=appconfig.host + '/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href=appconfig.host + '/manifest.json')
// JS / CSS
script(type='text/javascript', src=appconfig.host + '/js/vendor.js')
script(type='text/javascript', src=appconfig.host + '/js/app.js')
body(class='is-forbidden')
.container
a(href='/'): img(src=appconfig.host + '/images/logo.png')
h1= t('errors:forbidden')
h2= t('errors:forbiddendetail')
a.button.is-amber.is-inverted(href=appconfig.host + '/')= t('errors:actions.gohome')
a.button.is-amber.is-inverted(href=appconfig.host + '/login')= t('errors:actions.loginas')

View File

@@ -1,30 +0,0 @@
doctype html
html(data-logic='error')
head
meta(http-equiv='X-UA-Compatible', content='IE=edge')
meta(charset='UTF-8')
meta(name='viewport', content='width=device-width, initial-scale=1')
meta(name='theme-color', content='#009688')
meta(name='msapplication-TileColor', content='#009688')
meta(name='msapplication-TileImage', content=appconfig.host + '/favicons/ms-icon-144x144.png')
title= appconfig.title
// Favicon
each favsize in [57, 60, 72, 76, 114, 120, 144, 152, 180]
link(rel='apple-touch-icon', sizes=favsize + 'x' + favsize, href=appconfig.host + '/favicons/apple-icon-' + favsize + 'x' + favsize + '.png')
link(rel='icon', type='image/png', sizes='192x192', href=appconfig.host + '/favicons/android-icon-192x192.png')
each favsize in [32, 96, 16]
link(rel='icon', type='image/png', sizes=favsize + 'x' + favsize, href=appconfig.host + '/favicons/favicon-' + favsize + 'x' + favsize + '.png')
link(rel='manifest', href=appconfig.host + '/manifest.json')
// JS / CSS
script(type='text/javascript', src=appconfig.host + '/js/vendor.js')
script(type='text/javascript', src=appconfig.host + '/js/app.js')
body(class='is-notexist')
.container
a(href='/'): img(src=appconfig.host + '/images/logo.png')
h1 !{message}
h2= t('errors:notexistdetail')
a.button.is-amber.is-inverted.is-featured(href=appconfig.host + '/create/' + newpath)= t('errors:actions.create')
a.button.is-amber.is-inverted(href=appconfig.host + '/')= t('errors:actions.gohome')

View File

@@ -1,11 +0,0 @@
extends ./master.pug
block body
body
#app
navigator
main
block content
footer
block outside

5
server/views/login.pug Normal file
View File

@@ -0,0 +1,5 @@
extends master.pug
block body
#root.is-fullscreen
login

View File

@@ -1,5 +0,0 @@
extends ../master.pug
block body
#app
admin

View File

@@ -1,5 +0,0 @@
extends ../master.pug
block body
#app.is-fullscreen
login

View File

@@ -1,5 +0,0 @@
extends ../master.pug
block body
#app
profile

View File

@@ -1,9 +1,9 @@
extends ../master.pug
extends master.pug
block head
block body
#app
#root
page(title='Planet Earth', description='The 3rd planet of the solar system')
template(slot='contents')
p Earth is the third planet from the Sun and the only astronomical object known to harbor life. According to radiometric dating and other sources of evidence, Earth formed over 4.5 billion years ago.[24][25][26] Earth's gravity interacts with other objects in space, especially the Sun and the Moon, Earth's only natural satellite. Earth revolves around the Sun in 365.26 days, a period known as an Earth year. During this time, Earth rotates about its axis about 366.26 times.[n 5]

5
server/views/profile.pug Normal file
View File

@@ -0,0 +1,5 @@
extends master.pug
block body
#root
profile

View File

@@ -1,5 +1,5 @@
extends ../master.pug
extends master.pug
block body
#app
#root
setup(telemetry-id=telemetryClientID, wiki-version=packageObj.version)

View File

@@ -1,7 +1,7 @@
extends ../master.pug
extends master.pug
block body
#app.is-fullscreen
#root.is-fullscreen
v-app
.onboarding
img.animated.fadeIn(src='/svg/logo-wikijs.svg', alt='Wiki.js')