Browse Source

hbs->jade

windhamdavid 3 years ago
parent
commit
3c8267b6c1

+ 1 - 1
app.js

@@ -52,7 +52,7 @@ app.engine('.hbs', exphbs({
   layoutsDir:'app/views/layouts',
   partialsDir:'app/views/partials'
 }));
-app.set('view engine', '.hbs');
+app.set('view engine', 'jade');
 app.set('views', path.join(__dirname, 'app/views'));
 
 

+ 0 - 26
src/views/account/login.hbs

@@ -1,26 +0,0 @@
-<form method="POST" class="form-horizontal">
-   <input type="hidden" name="_csrf" value="KcUHwvO1V3HzvKe3AfVh0s7Xrxl7mvKXJbXk0=">
-   <div class="form-group">
-      <label for="email" class="col-sm-3 control-label">Email</label>
-      <div class="col-sm-7">
-         <input type="email" name="email" id="email" placeholder="Email" autofocus class="form-control">
-      </div>
-   </div>
-   <div class="form-group">
-      <label for="password" class="col-sm-3 control-label">Password</label>
-      <div class="col-sm-7">
-         <input type="password" name="password" id="password" placeholder="Password" class="form-control">
-      </div>
-   </div>
-   <div class="form-group">
-      <div class="col-sm-offset-3 col-sm-7">
-         <button type="submit" class="col-sm-3 btn btn-primary"><i class="fa fa-user"></i>Login</button>
-         <a href="/forgot" class="btn btn-link">Forgot your password?</a>
-      </div>
-   </div>
-   <div class="form-group">
-      <div class="col-sm-offset-3 col-sm-7">
-         <hr>
-      </div>
-   </div>
-</form>

+ 21 - 0
src/views/account/login.jade

@@ -0,0 +1,21 @@
+extends ../layout
+
+block content
+  .page-header
+    h3 Sign in
+  form.form-horizontal(method='POST')
+    input(type='hidden', name='_csrf', value=_csrf)
+    .form-group
+      label.col-sm-3.control-label(for='email') Email
+      .col-sm-7
+        input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus=true)
+    .form-group
+      label.col-sm-3.control-label(for='password') Password
+      .col-sm-7
+        input.form-control(type='password', name='password', id='password', placeholder='Password')
+    .form-group
+      .col-sm-offset-3.col-sm-7
+        button.col-sm-3.btn.btn-primary(type='submit')
+          i.fa.fa-user
+          | Login
+        a.btn.btn-link(href='/forgot') Forgot your password?

+ 0 - 26
src/views/account/register.hbs

@@ -1,26 +0,0 @@
-<form id="signup-form" method="POST" class="form-horizontal">
-   <input type="hidden" name="_csrf" value="_csrf">
-   <div class="form-group">
-      <label for="email" class="col-sm-3 control-label">Email</label>
-      <div class="col-sm-7">
-         <input type="email" name="email" id="email" placeholder="Email" autofocus class="form-control">
-      </div>
-   </div>
-   <div class="form-group">
-      <label for="password" class="col-sm-3 control-label">Password</label>
-      <div class="col-sm-7">
-         <input type="password" name="password" id="password" placeholder="Password" class="form-control">
-      </div>
-   </div>
-   <div class="form-group">
-      <label for="confirmPassword" class="col-sm-3 control-label">Confirm Password</label>
-      <div class="col-sm-7">
-         <input type="password" name="confirmPassword" id="confirmPassword" placeholder="Confirm Password" class="form-control">
-      </div>
-   </div>
-   <div class="form-group">
-      <div class="col-sm-offset-3 col-sm-7">
-         <button type="submit" class="btn btn-success"><i class="fa fa-user-plus"></i>Signup</button>
-      </div>
-   </div>
-</form>

+ 24 - 0
src/views/account/register.jade

@@ -0,0 +1,24 @@
+extends ../layout
+
+block content
+  .page-header
+    h3 Sign up
+  form.form-horizontal(id='signup-form', method='POST')
+    input(type='hidden', name='_csrf', value=_csrf)
+    .form-group
+      label.col-sm-3.control-label(for='email') Email
+      .col-sm-7
+        input.form-control(type='email', name='email', id='email', placeholder='Email', autofocus)
+    .form-group
+      label.col-sm-3.control-label(for='password') Password
+      .col-sm-7
+        input.form-control(type='password', name='password', id='password', placeholder='Password')
+    .form-group
+      label.col-sm-3.control-label(for='confirmPassword') Confirm Password
+      .col-sm-7
+        input.form-control(type='password', name='confirmPassword', id='confirmPassword', placeholder='Confirm Password')
+    .form-group
+      .col-sm-offset-3.col-sm-7
+        button.btn.btn-success(type='submit')
+          i.fa.fa-user-plus
+          | Signup

src/views/partials/flash.hbs → src/views/contact.jade


src/views/account/user.hbs → src/views/home.jade


+ 27 - 0
src/views/layout.jade

@@ -0,0 +1,27 @@
+doctype html
+html
+  head
+    meta(charset='utf-8')
+    meta(http-equiv='X-UA-Compatible', content='IE=edge')
+    meta(name='viewport', content='width=device-width, initial-scale=1.0')
+    meta(name='csrf-token', content=_csrf)
+    title #{title} - Juryd
+    meta(name='description', content='Juryd Judging Everything')
+    link(rel='stylesheet', href='/css/style.min.css')
+  body
+    include partials/header
+
+    section#partial
+          .container
+            .row
+              .col-sm-8.col-sm-offset-2
+              include partials/flash
+              block content
+
+    include partials/footer
+
+    script(src='/js/lib.min.js')
+    script(src='/js/main.min.js')
+    //if lt IE 9
+          script(src='js/html5shiv.min.js')
+          script(src='js/respond.min.js')

+ 0 - 79
src/views/layouts/main.hbs

@@ -1,79 +0,0 @@
-<!DOCTYPE html>
-<head>
-   <meta charset="utf-8">
-   <meta http-equiv="x-ua-compatible" content="ie=edge">
-   <meta name="viewport" content="width=device-width, initial-scale=1">
-   <title></title>
-   <meta name="description" content="Juryd Judging Everything">
-   <link rel="stylesheet" href="css/style.min.css">
-</head>
-<body>
-
- <nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
-     <div class="container">
-         <div class="navbar-header">
-             <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse">
-                 <span class="sr-only">Toggle navigation</span>
-                 <span class="icon-bar"></span>
-                 <span class="icon-bar"></span>
-                 <span class="icon-bar"></span>
-             </button>
-             <a class="navbar-brand page-scroll" href="/">Juryd</a>
-         </div>
-
-         <div class="collapse navbar-collapse" id="navbar-collapse">
-             <ul class="nav navbar-nav navbar-right">
-                 <li><a class="btn page-scroll" href="login">Sign In</a></li>
-                 <li><a class="btn page-scroll" href="register">Register</a></li>
-             </ul>
-         </div>
-     </div>
- </nav>
-
-<section id="partial">
-   <div class="container">
-      <div class="row">
-         <h1>{{Title}}</h1>
-         <div class="col-sm-8 col-sm-offset-2">
-            {{{body}}}
-         </div>
-      </div>
-   </div>
-</section>
-
-
-
-
-<footer class="bg-dark">
-   <div class="container bg-dark">
-      <div class="row">
-         <div class="col-sm-3 col-sm-offset-2">
-            <h5>About</h5>
-            <p>Documentation</p>
-            <p>History</p>
-            <p>About Us</p>
-         </div>
-         <div class="col-sm-3">
-            <h5>Support</h5>
-            <p>System Status</p>
-            <p>Support Ticket</p>
-            <p>Account Preferences</p>
-         </div>
-         <div class="col-sm-3">
-            <h5>About</h5>
-            <p>Contact</p>
-            <p>Privacy Policy</p>
-            <p>Terms of Use</p>
-         </div>
-      </div>
-   </div>
-</footer>
-   
-<script src="js/lib.min.js"></script>
-<script src="js/main.min.js"></script>
- <!--[if lt IE 9]>
-   <script src="js/html5shiv.min.js"></script>
-   <script src="js/respond.min.js"></script>
- <![endif]-->
-</body>
-</html>

+ 18 - 0
src/views/partials/flash.jade

@@ -0,0 +1,18 @@
+if messages.errors
+  .alert.alert-danger.fade.in
+    button.close(type='button', data-dismiss='alert')
+      i.fa.fa-times-circle-o
+    for error in messages.errors
+      div= error.msg
+if messages.info
+  .alert.alert-info.fade.in
+    button.close(type='button', data-dismiss='alert')
+      i.fa.fa-times-circle-o
+    for info in messages.info
+      div= info.msg
+if messages.success
+  .alert.alert-success.fade.in
+    button.close(type='button', data-dismiss='alert')
+      i.fa.fa-times-circle-o
+    for success in messages.success
+      div= success.msg

+ 18 - 0
src/views/partials/footer.jade

@@ -0,0 +1,18 @@
+footer.bg-dark
+  .container.bg-dark
+    .row
+      .col-sm-3.col-sm-offset-2
+        h5 About
+        p Documentation
+        p History
+        p About Us
+      .col-sm-3
+        h5 Support
+        p System Status
+        p Support Ticket
+        p Account Preferences
+      .col-sm-3
+        h5 About
+        p Contact
+        p Privacy Policy
+        p Terms of Use

+ 36 - 0
src/views/partials/header.jade

@@ -0,0 +1,36 @@
+nav#mainNav.navbar.navbar-default.navbar-fixed-top
+  .container
+    .navbar-header
+      button.navbar-toggle(type='button', data-toggle='collapse', data-target='.navbar-collapse')
+        span.sr-only Toggle navigation
+        span.icon-bar
+        span.icon-bar
+        span.icon-bar
+      a.navbar-brand(href='/')
+        i.fa.fa-cube
+        | Juryd
+    .collapse.navbar-collapse
+      ul.nav.navbar-nav
+
+      ul.nav.navbar-nav.navbar-right
+        if !user
+          li(class=title=='Login'?'active':undefined)
+            a(href='/login') Login
+          li(class=title=='Create Account'?'active':undefined)
+            a(href='/register') Register
+            
+        else
+          li.dropdown(class=title=='Account Management'?'active':undefined)
+            a.dropdown-toggle(href='#', data-toggle='dropdown')
+              if user.profile.picture
+                img(src='#{user.profile.picture}')
+              else
+                img(src='#{user.gravatar(60)}')
+              | #{user.profile.name || user.email || user.id}&nbsp;
+              i.caret
+            ul.dropdown-menu
+              li
+                a(href='/account') My Account
+              li.divider
+              li
+                a(href='/logout') Logout