Skip to content

Commit

Permalink
Setup base files
Browse files Browse the repository at this point in the history
  • Loading branch information
simonholmes committed Aug 11, 2015
1 parent 94a6c1e commit 03f1564
Show file tree
Hide file tree
Showing 15 changed files with 210 additions and 61 deletions.
5 changes: 5 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ app.use(express.static(path.join(__dirname, 'app_client')));
// app.use('/', routes);
// app.use('/users', users);

app.use(function(req, res) {
res.sendFile(path.join(__dirname, 'public', 'index.html'));
});


// catch 404 and forward to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
Expand Down
5 changes: 5 additions & 0 deletions app_client/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
controller: 'loginCtrl',
controllerAs: 'vm'
})
.when('/profile', {
templateUrl: '/profile/profile.view.html',
controller: 'profileCtrl',
controllerAs: 'vm'
})
.otherwise({redirectTo: '/'});

// use the HTML5 History API
Expand Down
47 changes: 47 additions & 0 deletions app_client/auth/login/login.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
(function () {

angular
.module('meanApp')
.controller('loginCtrl', loginCtrl);

loginCtrl.$inject = ['$location'];
function loginCtrl($location) {
var vm = this;

// vm.pageHeader = {
// title: 'Sign in to Loc8r'
// };

// vm.credentials = {
// email : "",
// password : ""
// };

// vm.returnPage = $location.search().page || '/';

// vm.onSubmit = function () {
// vm.formError = "";
// if (!vm.credentials.email || !vm.credentials.password) {
// vm.formError = "All fields required, please try again";
// return false;
// } else {
// vm.doLogin();
// }
// };

// vm.doLogin = function() {
// vm.formError = "";
// authentication
// .login(vm.credentials)
// .error(function(err){
// vm.formError = err;
// })
// .then(function(){
// $location.search('page', null);
// $location.path(vm.returnPage);
// });
// };

}

})();
27 changes: 27 additions & 0 deletions app_client/auth/login/login.view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<navigation></navigation>

<div class="container">

<div class="row">

<div class="col-md-6">

<h1 class="form-signin-heading">Sign in</h1>
<p class="lead">Not a member? Please <a href="register">register</a> instead.</p>

<form ng-submit="vm.onSubmit()">
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" ng-model="vm.credentials.email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" ng-model="vm.credentials.password">
</div>
<button type="submit" class="btn btn-default">Register!</button>
</form>

</div>
</div>

</div>
48 changes: 48 additions & 0 deletions app_client/auth/register/register.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
(function () {

angular
.module('meanApp')
.controller('registerCtrl', registerCtrl);

registerCtrl.$inject = ['$location'];
function registerCtrl($location) {
var vm = this;

// vm.pageHeader = {
// title: 'Create a new Loc8r account'
// };

// vm.credentials = {
// name : "",
// email : "",
// password : ""
// };

// vm.returnPage = $location.search().page || '/';

// vm.onSubmit = function () {
// vm.formError = "";
// if (!vm.credentials.name || !vm.credentials.email || !vm.credentials.password) {
// vm.formError = "All fields required, please try again";
// return false;
// } else {
// vm.doRegister();
// }
// };

// vm.doRegister = function() {
// vm.formError = "";
// authentication
// .register(vm.credentials)
// .error(function(err){
// vm.formError = err;
// })
// .then(function(){
// $location.search('page', null);
// $location.path(vm.returnPage);
// });
// };

}

})();
27 changes: 27 additions & 0 deletions app_client/auth/register/register.view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<navigation></navigation>

<div class="container">

<div class="row">
<div class="col-md-6">
<h1>Register</h1>
<p class="lead">Already a member? Please <a href="login">log in</a> instead.</p>
<form ng-submit="vm.onSubmit()">
<div class="form-group">
<label for="name">Full name</label>
<input type="text" class="form-control" id="name" placeholder="Enter your name" ng-model="vm.credentials.name">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" ng-model="vm.credentials.email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password" ng-model="vm.credentials.password">
</div>
<button type="submit" class="btn btn-default">Register!</button>
</form>
</div>
</div>

</div>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar navbar-default">
<div class="container">
<div id="navbar-main">
<ul class="nav navbar-nav">
Expand Down
8 changes: 7 additions & 1 deletion app_client/home/home.view.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
<navigation></navigation>

<h1>Hello there</h1>
<div class="container">

<h1>Hello there</h1>

<p>Won't you please <a href="login">sign in</a> or <a href="register">register</a>?</p>

</div>
12 changes: 12 additions & 0 deletions app_client/profile/profile.controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(function() {

angular
.module('meanApp')
.controller('profileCtrl', profileCtrl);

profileCtrl.$inject = ['$location'];
function profileCtrl($location) {
var vm = this;
}

})();
28 changes: 28 additions & 0 deletions app_client/profile/profile.view.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<navigation></navigation>

<div class="container">
<div class="row">

<div class="col-md-6">

<h1 class="form-signin-heading">Profile</h1>

<p class="lead">Update your profile here</p>

<form ng-submit="vm.onSubmit()">
<div class="form-group">
<label for="name">Full name</label>
<input type="text" class="form-control" id="name" placeholder="Enter your name" ng-model="vm.credentials.name">
</div>
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" id="email" placeholder="Enter email" ng-model="vm.credentials.email">
</div>
<button type="submit" class="btn btn-default">Update!</button>
</form>


</div>

</div>
</div>
20 changes: 1 addition & 19 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,10 @@ gulp.task('scripts', function() {
.pipe(gulp.dest('public'));
});

gulp.task('views', function () {
return gulp.src("./app_client/**/*.html")
.pipe(ngHtml2Js({
moduleName: function (file) {
var pathParts = file.path.split('/');
var folder = pathParts[pathParts.length - 2];
return folder.replace(/-[a-z]/g, function (match) {
return match.substr(1).toUpperCase();
});
}
}))
.pipe(concat("views.min.js"))
.pipe(gulp.dest('public'));
});

gulp.task('watch', function() {
watch('./app_client/**/*.html', function () {
gulp.start('views');
});
watch('./app_client/**/*.js', function () {
gulp.start('scripts');
});
});

gulp.task('default', ['scripts', 'views', 'watch']);
gulp.task('default', ['scripts', 'watch']);
2 changes: 1 addition & 1 deletion public/app.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion public/app.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

<script src="lib/angular/angular.min.js"></script>
<script src="lib/angular/angular-route.min.js"></script>
<script src="views.min.js"></script>
<script src="app.min.js"></script>

</body>
Expand Down
37 changes: 0 additions & 37 deletions public/views.min.js

This file was deleted.

0 comments on commit 03f1564

Please sign in to comment.