Skip to content

Commit 11e1ffd

Browse files
committed
added jade templates
1 parent 7554382 commit 11e1ffd

File tree

7 files changed

+118
-28
lines changed

7 files changed

+118
-28
lines changed

Diff for: app/index.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,6 @@ Generator.prototype.askForModules = function askForModules() {
233233
angMods.push("'ngRoute'");
234234
this.env.options.ngRoute = true;
235235
}
236-
if (this.mongo && this.mongoPassportUser) {
237-
angMods.push("'http-auth-interceptor'");
238-
}
239236

240237
if (angMods.length) {
241238
this.env.options.angularDeps = "\n " + angMods.join(",\n ") +"\n";
@@ -256,7 +253,7 @@ Generator.prototype.askForMongo = function askForMongo() {
256253
}, {
257254
type: 'confirm',
258255
name: 'mongoPassportUser',
259-
message: 'Would you like to include passport authentication for a user model?',
256+
message: 'Would you like to include a Passport authentication boilerplate?',
260257
default: false,
261258
when: function (props) {
262259
return props.mongo;
@@ -377,7 +374,7 @@ Generator.prototype.appJs = function appJs() {
377374
};
378375

379376
// only reference authentication controllers when required
380-
if (this.mongo && this.mongoPassportUser) {
377+
if (this.mongoPassportUser) {
381378
appendOptions.sourceFileList.push('scripts/controllers/login.js');
382379
appendOptions.sourceFileList.push('scripts/controllers/signup.js');
383380
appendOptions.sourceFileList.push('scripts/controllers/settings.js');
@@ -407,9 +404,10 @@ Generator.prototype.addJadeViews = function addHtmlJade() {
407404
if(this.jade) {
408405
this.copy('../../templates/views/jade/partials/main.jade', 'app/views/partials/main.jade');
409406
this.copy('../../templates/views/jade/partials/navbar.jade', 'app/views/partials/navbar.jade');
410-
if(this.mongo && this.mongoPassportUser) {
407+
if(this.mongoPassportUser) {
411408
this.copy('../../templates/views/jade/partials/login.jade', 'app/views/partials/login.jade');
412409
this.copy('../../templates/views/jade/partials/signup.jade', 'app/views/partials/signup.jade');
410+
this.copy('../../templates/views/jade/partials/settings.jade', 'app/views/partials/settings.jade');
413411
}
414412
this.copy('../../templates/views/jade/404.jade', 'app/views/404.jade');
415413
}
@@ -419,7 +417,7 @@ Generator.prototype.addHtmlViews = function addHtmlViews() {
419417
if(!this.jade) {
420418
this.copy('../../templates/views/html/partials/main.html', 'app/views/partials/main.html');
421419
this.copy('../../templates/views/html/partials/navbar.html', 'app/views/partials/navbar.html');
422-
if(this.mongo && this.mongoPassportUser) {
420+
if(this.mongoPassportUser) {
423421
this.copy('../../templates/views/html/partials/login.html', 'app/views/partials/login.html');
424422
this.copy('../../templates/views/html/partials/signup.html', 'app/views/partials/signup.html');
425423
this.copy('../../templates/views/html/partials/settings.html', 'app/views/partials/settings.html');

Diff for: templates/views/html/partials/main.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div ng-include="'partials/navbar'"></div>
22

33
<div class="jumbotron">
4-
<h1>'Allo, 'Allo<% if(mongo && mongoPassportUser) { %> <span ng-show="currentUser">{{ currentUser.name }}</span><% } %>!</h1>
4+
<h1>'Allo, 'Allo<% if(mongoPassportUser) { %><span ng-show="currentUser">{{ currentUser.name }}</span><% } %>!</h1>
55
<p class="lead">
66
<img src="images/yeoman.png" alt="I'm Yeoman"><br>
77
Always a pleasure scaffolding your apps.

Diff for: templates/views/jade/partials/login.jade

+34-16
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,37 @@
11
div(ng-include='\'partials/navbar.html\'')
2-
form.form-horizontal(ng-submit='login()', role='form')
2+
3+
.row
4+
.col-sm-12
5+
h1 Login
6+
p
7+
| Accounts are reset on server restart from
8+
code dummydata.js
9+
| . Default account is
10+
11+
| /
12+
code test
13+
14+
.col-sm-12
15+
form.form(name='form', ng-submit='login(form)', novalidate='novalidate')
16+
317
.form-group
4-
label.col-sm-2.control-label(for='username') Email
5-
.col-sm-10
6-
input#email.form-control(ng-model='email', type='email', placeholder='Email')
18+
label Email
19+
input.form-control(type='text', name='email', ng-model='user.email')
20+
721
.form-group
8-
label.col-sm-2.control-label(for='password') Password
9-
.col-sm-10
10-
input#password.form-control(ng-model='password', type='password', placeholder='')
11-
.form-group
12-
.col-sm-offset-2.col-sm-10
13-
.checkbox
14-
label
15-
input(type='checkbox')
16-
| Remember me
17-
.form-group
18-
.col-sm-offset-2.col-sm-10
19-
button.btn.btn-default(type='submit') Sign in
22+
label Password
23+
input.form-control(type='password', name='password', ng-model='user.password')
24+
25+
.form-group.has-error
26+
p.help-block(ng-show='form.email.$error.required && form.password.$error.required && submitted')
27+
| Please enter your email and password.
28+
p.help-block {{ errors.other }}
29+
30+
button.btn.btn-lg.btn-primary(type='submit') Sign in
31+
span.clearfix
32+
33+
.row
34+
.col-sm-12
35+
hr
36+
| Not registered?
37+
a.text-center.new-account(href='/signup') Create an account.

Diff for: templates/views/jade/partials/main.jade

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
1-
div(ng-include="'partials/navbar.html'")
1+
div(ng-include='\'partials/navbar\'')
22

33
.jumbotron
4-
h1 'Allo, 'Allo!
4+
h1
5+
| 'Allo, 'Allo<% if(mongoPassportUser) { %>
6+
span(ng-show='currentUser') {{ currentUser.name }}
7+
| <% } %>!
8+
59
p.lead
610
<img src="images/yeoman.png" alt="I'm Yeoman">
711
br
812
| Always a pleasure scaffolding your apps.
913
p
1014
a.btn.btn-lg.btn-success(ng-href='#') Splendid!
15+
1116
.row.marketing
1217
div(ng-repeat='thing in awesomeThings')
1318
h4 {{thing.name}}
1419
p {{thing.info}}
20+
1521
.footer
1622
p ♥ from the Yeoman team

Diff for: templates/views/jade/partials/navbar.jade

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
.header(ng-controller='NavbarCtrl')
22
ul.nav.nav-pills.pull-right
33
li(ng-repeat='item in menu', ng-class='{active: isActive(item.link)}')
4-
a(ng-href='{{item.link}}') {{item.title}}
5-
h3.text-muted <%= scriptAppName %>
4+
a(ng-href='{{item.link}}') {{item.title}}<% if(mongoPassportUser) { %>
5+
li(ng-hide='currentUser', ng-class='{active: isActive("/login")}')
6+
a(href='/login') Login
7+
li(ng-hide='currentUser', ng-class='{active: isActive("/signup")}')
8+
a(href='/signup') Sign up
9+
li(ng-show='currentUser', ng-class='{active: isActive("/logout")}')
10+
a(href='', ng-click='logout()') Logout<% } %>
11+
h3.text-muted <%= appname %>

Diff for: templates/views/jade/partials/settings.jade

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
div(ng-include='\'partials/navbar.html\'')
2+
3+
.row
4+
.col-sm-12
5+
h1 Change Password
6+
7+
.col-sm-12
8+
form.form(name='form', ng-submit='changePassword(form)', novalidate='')
9+
10+
.form-group
11+
label Current Password
12+
input.form-control(type='password', name='password', ng-model='user.oldPassword', mongoose-error='')
13+
p.help-block(ng-show='form.password.$error.mongoose')
14+
| {{ errors.other }}
15+
16+
.form-group
17+
label New Password
18+
input.form-control(type='password', name='newPassword', ng-model='user.newPassword', ng-minlength='3', required='')
19+
p.help-block(ng-show='(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || submitted)')
20+
| Password must be at least 3 characters.
21+
22+
p.help-block {{ message }}
23+
24+
button.btn.btn-lg.btn-primary(type='submit') Save changes

Diff for: templates/views/jade/partials/signup.jade

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
div(ng-include='\'partials/navbar.html\'')
2+
3+
.row
4+
.col-sm-12
5+
h1 Sign up
6+
7+
.col-sm-12
8+
form.form(name='form', ng-submit='register(form)', novalidate='')
9+
.form-group(ng-class='{ \'has-success\': form.name.$valid && submitted, \'has-error\': form.name.$invalid && submitted }')
10+
label Name
11+
input.form-control(type='text', name='name', ng-model='user.name', required='')
12+
p.help-block(ng-show='form.name.$error.required && submitted')
13+
| A name is required
14+
15+
.form-group(ng-class='{ \'has-success\': form.email.$valid && submitted, \'has-error\': form.email.$invalid && submitted }')
16+
label Email
17+
input.form-control(type='email', name='email', ng-model='user.email', required='', mongoose-error='')
18+
p.help-block(ng-show='form.email.$error.email && submitted')
19+
| Doesn't look like a valid email.
20+
p.help-block(ng-show='form.email.$error.required && submitted')
21+
| What's your email address?
22+
p.help-block(ng-show='form.email.$error.mongoose')
23+
| {{ errors.email }}
24+
25+
.form-group(ng-class='{ \'has-success\': form.password.$valid && submitted, \'has-error\': form.password.$invalid && submitted }')
26+
label Password
27+
input.form-control(type='password', name='password', ng-model='user.password', ng-minlength='3', required='', mongoose-error='')
28+
p.help-block(ng-show='(form.password.$error.minlength || form.password.$error.required) && submitted')
29+
| Password must be at least 3 characters.
30+
p.help-block(ng-show='form.password.$error.mongoose')
31+
| {{ errors.password }}
32+
33+
button.btn.btn-lg.btn-primary(type='submit') Sign up
34+
.row
35+
.col-sm-12
36+
hr
37+
| Have an account?
38+
a.text-center.new-account(href='/login') Log in.

0 commit comments

Comments
 (0)