Skip to content

Commit ca08ce7

Browse files
committed
style(app): use 4-space indents
1 parent 77c315b commit ca08ce7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+2052
-2090
lines changed

templates/app/client/app/account(auth)/account.module.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ import { SignupComponent } from './signup/signup.component';
1414

1515
<%_ if(filters.ngroute) { -%>
1616
const accountRoutes: Routes = [{
17-
path: 'login',
18-
component: LoginComponent,
17+
path: 'login',
18+
component: LoginComponent,
1919
}, {
20-
path: 'settings',
21-
component: SettingsComponent,
20+
path: 'settings',
21+
component: SettingsComponent,
2222
}, {
23-
path: 'signup',
24-
component: SignupComponent,
23+
path: 'signup',
24+
component: SignupComponent,
2525
}];<% } %>
2626

2727
@NgModule({

templates/app/client/app/account(auth)/login/login.component.js

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,62 +8,62 @@ import { AuthService } from '../../../components/auth/auth.service';
88
// @flow
99
<%_ if(filters.flow) { -%>
1010
type User = {
11-
name: string;
12-
email: string;
13-
password: string;
11+
name: string;
12+
email: string;
13+
password: string;
1414
};
1515
<%_ } -%>
1616
<%_ if(filters.ts) { -%>
1717
interface User {
18-
name: string;
19-
email: string;
20-
password: string;
18+
name: string;
19+
email: string;
20+
password: string;
2121
}
2222
<%_ } -%>
2323

2424
@Component({
25-
selector: 'login',
26-
template: require('./login.<%=templateExt%>'),
25+
selector: 'login',
26+
template: require('./login.<%=templateExt%>'),
2727
})
2828
export class LoginComponent {
29-
user: User = {
30-
name: '',
31-
email: '',
32-
password: '',
33-
};
34-
errors = {login: undefined};
35-
submitted = false;
36-
AuthService;
37-
<%_ if(filters.ngroute) { -%>
38-
Router;<% } %>
39-
<%_ if(filters.uirouter) { -%>
40-
StateService;<% } %>
41-
42-
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
43-
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
44-
this.AuthService = _AuthService_;
29+
user: User = {
30+
name: '',
31+
email: '',
32+
password: '',
33+
};
34+
errors = {login: undefined};
35+
submitted = false;
36+
AuthService;
4537
<%_ if(filters.ngroute) { -%>
46-
this.Router = router;<% } %>
38+
Router;<% } %>
4739
<%_ if(filters.uirouter) { -%>
48-
this.StateService = _StateService_;<% } %>
49-
}
50-
51-
login() {
52-
this.submitted = true;
40+
StateService;<% } %>
5341

54-
return this.AuthService.login({
55-
email: this.user.email,
56-
password: this.user.password
57-
})
58-
.then(() => {
59-
// Logged in, redirect to home
42+
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
43+
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
44+
this.AuthService = _AuthService_;
6045
<%_ if(filters.ngroute) { -%>
61-
this.Router.navigateByUrl('/home');<% } %>
46+
this.Router = router;<% } %>
6247
<%_ if(filters.uirouter) { -%>
63-
this.StateService.go('main');<% } %>
64-
})
65-
.catch(err => {
66-
this.errors.login = err.message;
67-
});
68-
}
48+
this.StateService = _StateService_;<% } %>
49+
}
50+
51+
login() {
52+
this.submitted = true;
53+
54+
return this.AuthService.login({
55+
email: this.user.email,
56+
password: this.user.password
57+
})
58+
.then(() => {
59+
// Logged in, redirect to home
60+
<%_ if(filters.ngroute) { -%>
61+
this.Router.navigateByUrl('/home');<% } %>
62+
<%_ if(filters.uirouter) { -%>
63+
this.StateService.go('main');<% } %>
64+
})
65+
.catch(err => {
66+
this.errors.login = err.message;
67+
});
68+
}
6969
}

templates/app/client/app/account(auth)/settings/settings.component.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,52 +4,52 @@ import { AuthService } from '../../../components/auth/auth.service';
44
// @flow
55
<%_ if(filters.flow) { -%>
66
type User = {
7-
oldPassword: string;
8-
newPassword: string;
9-
confirmPassword: string;
7+
oldPassword: string;
8+
newPassword: string;
9+
confirmPassword: string;
1010
};
1111
<%_ } -%>
1212
<%_ if(filters.ts) { -%>
1313
interface User {
14-
oldPassword: string;
15-
newPassword: string;
16-
confirmPassword: string;
14+
oldPassword: string;
15+
newPassword: string;
16+
confirmPassword: string;
1717
}
1818
<%_ } -%>
1919

2020
@Component({
21-
selector: 'settings',
22-
template: require('./settings.<%=templateExt%>'),
21+
selector: 'settings',
22+
template: require('./settings.<%=templateExt%>'),
2323
})
2424
export class SettingsComponent {
25-
user: User = {
26-
oldPassword: '',
27-
newPassword: '',
28-
confirmPassword: ''
29-
};
30-
errors = {other: undefined};
31-
message = '';
32-
submitted = false;
33-
AuthService;
25+
user: User = {
26+
oldPassword: '',
27+
newPassword: '',
28+
confirmPassword: ''
29+
};
30+
errors = {other: undefined};
31+
message = '';
32+
submitted = false;
33+
AuthService;
3434

35-
static parameters = [AuthService];
36-
constructor(_AuthService_: AuthService) {
37-
this.AuthService = _AuthService_;
38-
}
35+
static parameters = [AuthService];
36+
constructor(_AuthService_: AuthService) {
37+
this.AuthService = _AuthService_;
38+
}
3939

40-
changePassword(form) {
41-
if(form.invalid) return;
40+
changePassword(form) {
41+
if(form.invalid) return;
4242

43-
this.submitted = true;
43+
this.submitted = true;
4444

45-
return this.AuthService.changePassword(this.user.oldPassword, this.user.newPassword)
46-
.then(() => {
47-
this.message = 'Password successfully changed.';
48-
})
49-
.catch(() => {
50-
// form.password.$setValidity('mongoose', false);
51-
this.errors.other = 'Incorrect password';
52-
this.message = '';
53-
});
54-
}
45+
return this.AuthService.changePassword(this.user.oldPassword, this.user.newPassword)
46+
.then(() => {
47+
this.message = 'Password successfully changed.';
48+
})
49+
.catch(() => {
50+
// form.password.$setValidity('mongoose', false);
51+
this.errors.other = 'Incorrect password';
52+
this.message = '';
53+
});
54+
}
5555
}

templates/app/client/app/account(auth)/signup/signup.component.js

Lines changed: 55 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -8,76 +8,72 @@ import { AuthService } from '../../../components/auth/auth.service';
88

99
<%_ if(filters.flow) { -%>
1010
type User = {
11-
name: string;
12-
email: string;
13-
password: string;
11+
name: string;
12+
email: string;
13+
password: string;
1414
};<% } %>
1515
<%_ if(filters.ts) { -%>
1616
interface User {
17-
name: string;
18-
email: string;
19-
password: string;
17+
name: string;
18+
email: string;
19+
password: string;
2020
}<% } %>
2121

2222
@Component({
23-
selector: 'signup',
24-
template: require('./signup.<%=templateExt%>')
23+
selector: 'signup',
24+
template: require('./signup.<%=templateExt%>')
2525
})
2626
export class SignupComponent {
27-
user: User = {
28-
name: '',
29-
email: '',
30-
password: ''
31-
};
32-
errors = {};
33-
submitted = false;
34-
AuthService;
35-
<%_ if(filters.ngroute) { -%>
36-
Router;<% } %>
37-
<%_ if(filters.uirouter) { -%>
38-
StateService;<% } %>
39-
40-
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
41-
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
42-
this.AuthService = _AuthService_;
27+
user: User = {
28+
name: '',
29+
email: '',
30+
password: ''
31+
};
32+
errors = {};
33+
submitted = false;
34+
AuthService;
4335
<%_ if(filters.ngroute) { -%>
44-
this.Router = router;<% } -%>
36+
Router;<% } %>
4537
<%_ if(filters.uirouter) { -%>
46-
this.StateService = _StateService_;<% } -%>
47-
}
38+
StateService;<% } %>
39+
40+
static parameters = [AuthService, <% if(filters.ngroute) { %>Router<% } else { %>StateService<% } %>];
41+
constructor(_AuthService_: AuthService, <% if(filters.ngroute) { %>router: Router<% } else { %>_StateService_: StateService<% } %>) {
42+
this.AuthService = _AuthService_;
43+
<%_ if(filters.ngroute) { -%>
44+
this.Router = router;<% } -%>
45+
<%_ if(filters.uirouter) { -%>
46+
this.StateService = _StateService_;<% } -%>
47+
}
4848

49-
register(form) {
50-
if(form.invalid) return;
49+
register(form) {
50+
if(form.invalid) return;
5151

52-
this.submitted = true;
52+
this.submitted = true;
5353

54-
return this.AuthService.createUser({
55-
name: this.user.name,
56-
email: this.user.email,
57-
password: this.user.password
58-
})
59-
.then(() => {
60-
// Account created, redirect to home
61-
<% if(filters.ngroute) { %>this.Router.navigateByUrl('/home');<% } -%>
62-
<% if(filters.uirouter) { %>this.StateService.go('main');<% } -%>
63-
})
64-
.catch(err => {
65-
err = err.data;
66-
this.errors = {};
67-
<%_ if(filters.mongooseModels) { -%>
68-
// Update validity of form fields that match the mongoose errors
69-
err.errors.forEach((error, field) => {
70-
// form[field].$setValidity('mongoose', false);
71-
this.errors[field] = error.message;
72-
});<% } %>
73-
<%_ if(filters.sequelizeModels) { -%>
74-
// Update validity of form fields that match the sequelize errors
75-
if(err.name) {
76-
err.fields.forEach(field => {
77-
// form[field].$setValidity('mongoose', false);
78-
this.errors[field] = err.message;
79-
});
80-
}<% } %>
81-
});
82-
}
54+
return this.AuthService.createUser({
55+
name: this.user.name,
56+
email: this.user.email,
57+
password: this.user.password
58+
})
59+
.then(() => {
60+
// Account created, redirect to home
61+
<% if(filters.ngroute) { %>this.Router.navigateByUrl('/home');<% } -%>
62+
<% if(filters.uirouter) { %>this.StateService.go('main');<% } -%>
63+
})
64+
.catch(err => {
65+
err = err.data;
66+
this.errors = {};<% if(filters.mongooseModels) { %>
67+
// Update validity of form fields that match the mongoose errors
68+
err.errors.forEach((error, field) => {
69+
this.errors[field] = error.message;
70+
});<% } %><% if(filters.sequelizeModels) { %>
71+
// Update validity of form fields that match the sequelize errors
72+
if(err.name) {
73+
err.fields.forEach(field => {
74+
this.errors[field] = err.message;
75+
});
76+
}<% } %>
77+
});
78+
}
8379
}

templates/app/client/app/admin(auth)/admin.component.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import { Component } from '@angular/core';
22
import { UserService } from '../../components/auth/user.service';
33

44
@Component({
5-
selector: 'admin',
6-
template: require('./admin.<%=templateExt%>'),
7-
styles: [require('./admin.<%=styleExt%>')],
5+
selector: 'admin',
6+
template: require('./admin.<%=templateExt%>'),
7+
styles: [require('./admin.<%=styleExt%>')],
88
})
99
export class AdminComponent {
10-
<%_ if(filters.ts || filters.flow) { -%>
11-
users: Object[];
10+
<%_ if(filters.ts || filters.flow) { -%>
11+
users: Object[];
1212

13-
<%_ } _%>
14-
static parameters = [UserService];
15-
constructor(<%= private() %>userService: UserService) {
16-
this.userService = userService;
17-
// Use the user service to fetch all users
18-
this.userService.query().subscribe(users => {
19-
this.users = users;
20-
});
21-
}
13+
<%_ } _%>
14+
static parameters = [UserService];
15+
constructor(<%= private() %>userService: UserService) {
16+
this.userService = userService;
17+
// Use the user service to fetch all users
18+
this.userService.query().subscribe(users => {
19+
this.users = users;
20+
});
21+
}
2222

23-
delete(user) {
24-
this.userService.remove(user).subscribe(deletedUser => {
25-
this.users.splice(this.users.indexOf(deletedUser), 1);
26-
});
27-
}
23+
delete(user) {
24+
this.userService.remove(user).subscribe(deletedUser => {
25+
this.users.splice(this.users.indexOf(deletedUser), 1);
26+
});
27+
}
2828
}

0 commit comments

Comments
 (0)