#236 implement swig instead of jade

This commit is contained in:
Drew Fyock
2014-02-03 13:46:39 -05:00
parent c2330e574c
commit a0c9de3756
20 changed files with 252 additions and 219 deletions

1
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.DS_Store
.nodemonignore
.sass-cache/
.bower-*
node_modules/
public/lib
test/coverage/

26
app/views/404.html Executable file → Normal file
View File

@@ -1,13 +1,17 @@
extends layouts/default
{% extends 'layouts/default.html' %}
block main
h1 Oops something went wrong
br
span 404
block content
#error-message-box
#error-stack-trace
pre
code!= error
{% block main %}
<h1>Oops something went wrong</h1>
<br>
<span>404</span>
{% endblock %}
{% block content %}
<div id="error-message-box">
<div id="error-stack-trace">
<pre>
<code>{{error}}</code>
</pre>
</div>
</div>
{% endblock %}

25
app/views/500.html Executable file → Normal file
View File

@@ -1,12 +1,17 @@
extends layouts/default
{% extends 'layouts/default.html' %}
block main
h1 Oops something went wrong
br
span 500
{% block main %}
<h1>Oops something went wrong</h1>
<br>
<span>500</span>
{% endblock %}
block content
#error-message-box
#error-stack-trace
pre
code!= error
{% block content %}
<div id="error-message-box">
<div id="error-stack-trace">
<pre>
<code>{{error}}</code>
</pre>
</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,32 @@
<!-- Angular JS -->
<script type="text/javascript" src="/lib/angular/angular.min.js"></script>
<script type="text/javascript" src="/lib/angular-cookies/angular-cookies.min.js"></script>
<script type="text/javascript" src="/lib/angular-resource/angular-resource.min.js"></script>
<script type="text/javascript" src="/lib/angular-route/angular-route.js"></script>
<!-- Angular UI -->
<script type="text/javascript" src="/lib/angular-bootstrap/ui-bootstrap.js"></script>
<script type="text/javascript" src="/lib/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script type="text/javascript" src="/lib/angular-ui-utils/ui-utils.min.js"></script>
<!-- Application Init -->
<script type="text/javascript" src="/js/app.js"></script>
<script type="text/javascript" src="/js/config.js"></script>
<script type="text/javascript" src="/js/directives.js"></script>
<script type="text/javascript" src="/js/filters.js"></script>
<!-- Application Services -->
<script type="text/javascript" src="/js/services/global.js"></script>
<script type="text/javascript" src="/js/services/articles.js"></script>
<!-- Application Controllers -->
<script type="text/javascript" src="/js/controllers/articles.js"></script>
<script type="text/javascript" src="/js/controllers/index.js"></script>
<script type="text/javascript" src="/js/controllers/header.js"></script>
<script type="text/javascript" src="/js/init.js"></script>
{% if (process.env.NODE_ENV == 'development') %}
<!-- Livereload script rendered -->
<script type="text/javascript", src="http://" + req.host + ":35729/livereload.js"></script>
{% endif %}

View File

@@ -1,30 +0,0 @@
//AngularJS
script(type='text/javascript', src='/lib/angular/angular.js')
script(type='text/javascript', src='/lib/angular-cookies/angular-cookies.js')
script(type='text/javascript', src='/lib/angular-resource/angular-resource.js')
script(type='text/javascript', src='/lib/angular-route/angular-route.js')
//Angular UI
script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap.js')
script(type='text/javascript', src='/lib/angular-bootstrap/ui-bootstrap-tpls.js')
script(type='text/javascript', src='/lib/angular-ui-utils/ui-utils.min.js')
//Application Init
script(type='text/javascript', src='/js/app.js')
script(type='text/javascript', src='/js/config.js')
script(type='text/javascript', src='/js/directives.js')
script(type='text/javascript', src='/js/filters.js')
//Application Services
script(type='text/javascript', src='/js/services/global.js')
script(type='text/javascript', src='/js/services/articles.js')
//Application Controllers
script(type='text/javascript', src='/js/controllers/articles.js')
script(type='text/javascript', src='/js/controllers/index.js')
script(type='text/javascript', src='/js/controllers/header.js')
script(type='text/javascript', src='/js/init.js')
if (process.env.NODE_ENV == 'development')
//Livereload script rendered
script(type='text/javascript', src='http://' + req.host + ':35729/livereload.js')

View File

@@ -0,0 +1,31 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{appName}} - {{title}}</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="keywords" content="node.js, express, mongoose, mongodb, angularjs, swig">
<meta name="description" content="MEAN - A Modern Stack: MongoDB, ExpressJS, AngularJS, NodeJS. (BONUS: Passport User Support).">
<link href="/img/icons/favicon.ico" rel="shortcut icon" type="image/x-icon">
<meta property="fb:app_id" content="APP_ID">
<meta property="og:title" content="{{appName}} - {{title}}">
<meta property="og:description" content="MEAN - A Modern Stack: MongoDB, ExpressJS, AngularJS, NodeJS. (BONUS: Passport User Support).">
<meta property="og:type" content="website">
<meta property="og:url" content="APP_URL">
<meta property="og:image" content="APP_LOGO">
<meta property="og:site_name" content="MEAN - A Modern Stack">
<meta property="fb:admins" content="APP_ADMIN">
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap-responsive.css"> -->
<link rel="stylesheet" href="/css/common.css">
<link rel="stylesheet" href="/css/views/articles.css">
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>

View File

@@ -1,29 +0,0 @@
head
meta(charset='utf-8')
meta(http-equiv='X-UA-Compatible', content='IE=edge,chrome=1')
meta(name='viewport', content='width=device-width,initial-scale=1')
title= appName+' - '+title
meta(http-equiv='Content-type', content='text/html;charset=UTF-8')
meta(name="keywords", content="node.js, express, mongoose, mongodb, angularjs")
meta(name="description", content="MEAN - A Modern Stack: MongoDB, ExpressJS, AngularJS, NodeJS. (BONUS: Passport User Support).")
link(href='/img/icons/favicon.ico', rel='shortcut icon', type='image/x-icon')
meta(property='fb:app_id', content='APP_ID')
meta(property='og:title', content='#{appName} - #{title}')
meta(property='og:description', content='MEAN - A Modern Stack: MongoDB, ExpressJS, AngularJS, NodeJS. (BONUS: Passport User Support).')
meta(property='og:type', content='website')
meta(property='og:url', content='APP_URL')
meta(property='og:image', content='APP_LOGO')
meta(property='og:site_name', content='MEAN - A Modern Stack')
meta(property='fb:admins', content='APP_ADMIN')
link(rel='stylesheet', href='/lib/bootstrap/dist/css/bootstrap.min.css')
//- link(rel='stylesheet', href='/lib/bootstrap/dist/css/bootstrap-responsive.css')
link(rel='stylesheet', href='/css/common.css')
link(rel='stylesheet', href='/css/views/articles.css')
//if lt IE 9
script(src='http://html5shim.googlecode.com/svn/trunk/html5.js')

13
app/views/index.html Executable file → Normal file
View File

@@ -1,6 +1,7 @@
extends layouts/default
block content
section(data-ng-view)
script(type="text/javascript").
window.user = !{user};
{% extends 'layouts/default.html' %}
{% block content %}
<section data-ng-view />
<script type="text/javascript">
window.user = {{user|safe}};
</script>
{% endblock %}

View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="https://www.facebook.com/2008/fbml" itemscope="itemscope" itemtype="http://schema.org/Product">
{% include '../includes/head.html' %}
<body>
<div class="navbar navbar-inverse navbar-fixed-top" data-ng-include="'views/header.html'" data-role="navigation"></div>
<section class="content">
<section class="container">
{% block content %}{% endblock %}
</section>
</section>
{% include '../includes/foot.html' %}
</body>
</html>

View File

@@ -1,9 +0,0 @@
doctype html
html(lang='en', xmlns='http://www.w3.org/1999/xhtml', xmlns:fb='https://www.facebook.com/2008/fbml', itemscope='itemscope', itemtype='http://schema.org/Product')
include ../includes/head
body
.navbar.navbar-inverse.navbar-fixed-top(data-ng-include="'views/header.html'", data-role="navigation")
section.content
section.container
block content
include ../includes/foot

24
app/views/users/auth.html Normal file
View File

@@ -0,0 +1,24 @@
{% extends '../layouts/default.html' %}
{% block content %}
<div class="row">
<div class="col-md-offset-1 col-md-5">
<a href="/auth/facebook"><img src="/img/icons/facebook.png"></a>
<a href="/auth/github"><img src="/img/icons/github.png"></a>
<a href="/auth/twitter"><img src="/img/icons/twitter.png"></a>
<a href="/auth/google"><img src="/img/icons/google.png"></a>
<a href="/auth/linkedin"><img src="/img/icons/linkedin.png"></a>
</div>
<div class="col-md-6">
{% if message && message.length %}
<div class="fade in alert alert-error">
<button class="close" data-dismiss="alert">&times;</button>
<div class="strong">
{{ message }}
</div>
</div>
{% endif %}
{% block auth %}{% endblock %}
</div>
</div>
{% endblock %}

View File

@@ -1,21 +0,0 @@
extends ../layouts/default
block content
.row
.col-md-offset-1.col-md-5
a(href="/auth/facebook")
img(src="/img/icons/facebook.png")
a(href="/auth/github")
img(src="/img/icons/github.png")
a(href="/auth/twitter")
img(src="/img/icons/twitter.png")
a(href="/auth/google")
img(src="/img/icons/google.png")
a(href="/auth/linkedin")
img(src="/img/icons/linkedin.png")
.col-md-6
if message && message.length
.fade.in.alert.alert-error
button.close(type="button", data-dismiss="alert") &times;
strong #{message}
block auth

42
app/views/users/signin.html Executable file → Normal file
View File

@@ -1,20 +1,24 @@
extends auth
{% extends 'auth.html' %}
block auth
form.signin.form-horizontal(action="/users/session", method="post")
.form-group
label.col-md-4.control-label(for='email') Email
.col-md-8
input#email.form-control(type='text', name="email", placeholder='Email')
.form-group
label.col-md-4.control-label(for='password') Password
.col-md-8
input#password.form-control(type='password', name="password", placeholder='Password')
.form-group
.col-md-offset-4.col-md-8
button.btn.btn-primary(type='submit') Sign in
&nbsp;
| or&nbsp;
a.show-signup(href="/signup") Sign up
{% block auth %}
<form class="signin form-horizontal" action="/users/session" method="post">
<div class="form-group">
<label class="col-md-4 control-label" for="email">Email</label>
<div class="col-md-8">
<input id="email" class="form-control" type="text" name="email" placeholder="Email">
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="password">Password</label>
<div class="col-md-8">
<input id="password" class="form-control" type="password" name="password" placeholder="Password">
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<button class="btn btn-primary" type="submit">Sign in</button>&nbsp;
or&nbsp;<a class="show-signup" href="/signup">Sign up</a>
</div>
</div>
</form>
{% endblock %}

64
app/views/users/signup.html Executable file → Normal file
View File

@@ -1,30 +1,36 @@
extends auth
{% extends 'auth.html' %}
block auth
form.signup.form-horizontal(action="/users", method="post")
.form-group
label.col-md-4.control-label(for='name') Full Name
.col-md-8
input#name.form-control(type='text', name="name", placeholder='Full name', value=user.name)
.form-group
label.col-md-4.control-label(for='email') Email
.col-md-8
input#email.form-control(type='text', name="email", placeholder='Email', value=user.email)
.form-group
label.col-md-4.control-label(for='username') Username
.col-md-8
input#username.form-control(type='text', name="username", placeholder='Username', value=user.username)
.form-group
label.col-md-4.control-label(for='password') Password
.col-md-8
input#password.form-control(type='password', name="password", placeholder='Password')
.form-group
.col-md-offset-4.col-md-8
button.btn.btn-primary(type='submit') Sign up
&nbsp;
| or&nbsp;
a.show-login(href="/signin") login
{% block auth %}
<form class="signin form-horizontal" action="/users" method="post">
<div class="form-group">
<label class="col-md-4 control-label" for="name">Full Name</label>
<div class="col-md-8">
<input id="name" class="form-control" type="text" name="name" placeholder="Full Name" value="{{user.name}}" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="email">Email</label>
<div class="col-md-8">
<input id="email" class="form-control" type="text" name="email" placeholder="Email" value="{{user.email}}" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="username">Username</label>
<div class="col-md-8">
<input id="username" class="form-control" type="text" name="username" placeholder="Username" value="{{user.username}}" />
</div>
</div>
<div class="form-group">
<label class="col-md-4 control-label" for="password">Password</label>
<div class="col-md-8">
<input id="password" class="form-control" type="password" name="password" placeholder="Password" />
</div>
</div>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<button class="btn btn-primary" type="submit">Sign up</button>&nbsp;
or&nbsp;<a class="show-login" href="/signin">login</a>
</div>
</div>
</form>
{% endblock %}

2
config/env/all.js vendored
View File

@@ -7,7 +7,7 @@ module.exports = {
root: rootPath,
port: process.env.PORT || 3000,
db: process.env.MONGOHQ_URL,
templateEngine: 'jade',
templateEngine: 'swig',
// The secret should be set to a non-guessable string that
// is used to compute a session hash

View File

@@ -1,33 +1,33 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mean-dev",
db: 'mongodb://localhost/mean-dev',
app: {
name: "MEAN - A Modern Stack - Development"
name: 'MEAN - A Modern Stack - Development'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/github/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: "API_KEY",
clientSecret: "SECRET_KEY",
callbackURL: "http://localhost:3000/auth/linkedin/callback"
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
}
};

View File

@@ -1,33 +1,33 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mean",
db: 'mongodb://localhost/mean',
app: {
name: "MEAN - A Modern Stack - Production"
name: 'MEAN - A Modern Stack - Production'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/github/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
},
linkedin: {
clientID: "API_KEY",
clientSecret: "SECRET_KEY",
callbackURL: "http://localhost:3000/auth/linkedin/callback"
clientID: 'API_KEY',
clientSecret: 'SECRET_KEY',
callbackURL: 'http://localhost:3000/auth/linkedin/callback'
}
}
};

30
config/env/test.js vendored
View File

@@ -1,29 +1,29 @@
'use strict';
module.exports = {
db: "mongodb://localhost/mean-test",
db: 'mongodb://localhost/mean-test',
port: 3001,
app: {
name: "MEAN - A Modern Stack - Test"
name: 'MEAN - A Modern Stack - Test'
},
facebook: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/facebook/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/facebook/callback'
},
twitter: {
clientID: "CONSUMER_KEY",
clientSecret: "CONSUMER_SECRET",
callbackURL: "http://localhost:3000/auth/twitter/callback"
clientID: 'CONSUMER_KEY',
clientSecret: 'CONSUMER_SECRET',
callbackURL: 'http://localhost:3000/auth/twitter/callback'
},
github: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/github/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/github/callback'
},
google: {
clientID: "APP_ID",
clientSecret: "APP_SECRET",
callbackURL: "http://localhost:3000/auth/google/callback"
clientID: 'APP_ID',
clientSecret: 'APP_SECRET',
callbackURL: 'http://localhost:3000/auth/google/callback'
}
}
};

View File

@@ -80,7 +80,7 @@ module.exports = function(grunt) {
}
});
//Load NPM tasks
//Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-test');
@@ -97,4 +97,4 @@ module.exports = function(grunt) {
//Test task.
grunt.registerTask('test', ['env:test', 'mochaTest', 'karma:unit']);
};
};

View File

@@ -57,7 +57,8 @@
"grunt-nodemon": "0.1.2",
"grunt-contrib-watch": "~0.5.3",
"karma-coverage": "~0.1.4",
"karma": "~0.10.9"
"karma": "~0.10.9",
"swig": "~1.3.2"
},
"devDependencies": {
"supertest": "0.8.2",