Skip to content

Commit

Permalink
fixed html buttons and login
Browse files Browse the repository at this point in the history
  • Loading branch information
helanan committed Dec 3, 2016
1 parent 6eec9ef commit 4cc8823
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 56 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.DS_Store
.DS_Store
lib/node_modules/
lib/bower_components/
*javascripts/AppConstants.js
npm-debug.log
javascripts/AppConstants.js

3 changes: 2 additions & 1 deletion css/main.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
body {
/*body {
background-image: url("img/cork.jpg");
font-family: 'Yanone Kaffeesatz', sans-serif;
font-size: 2em;
Expand All @@ -8,3 +8,4 @@ h1 {
font-family: 'Anton', sans-serif;
font-size: 1.5em;
}
*/
10 changes: 6 additions & 4 deletions javascripts/AppConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ let isAuth = (AuthFactory) => new Promise((resolve, reject) => {
} else {
reject();
}
});
})

app.run(function($rootScope, $location, FIREBASE_CONFIG, AuthFactory){
firebase.initializeApp(FIREBASE_CONFIG);

$rootScope.$on('$routeChangeStart', function(event, currRoute, prevRoute){

let logged = AuthFactory.isAuthenticated();

let appTo;

if(currRoute.originalPath){
Expand All @@ -33,7 +33,7 @@ app.config(function($routeProvider){
$routeProvider
.when('/auth', {
templateUrl: 'partials/auth.html',
controller:'AuthCtrl'
controller:'AuthCtrl',
})
.when('/boards/list', {
templateUrl: 'partials/general-view.html',
Expand Down Expand Up @@ -61,4 +61,6 @@ app.config(function($routeProvider){
resolve: {isAuth}
})
.otherwise('/auth');
});
});

console.log("AppConfig loaded");
4 changes: 3 additions & 1 deletion javascripts/AppConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ app.constant("FIREBASE_CONFIG", {
databaseURL: "https://pinthis-fe275.firebaseio.com",
storageBucket: "pinthis-fe275.appspot.com",
messagingSenderId: "918121387819"
});
});

console.log("AppConstantsCompleted");
1 change: 1 addition & 0 deletions javascripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

var app = angular.module("PinThisApp", ["ngRoute"]);


13 changes: 7 additions & 6 deletions javascripts/controllers/AuthCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ app.controller("AuthCtrl", function($scope, $rootScope, AuthFactory, UserFactory
$scope.setRegisterContainer = false;


if($location.path() == "/logout"){
if($location.path() === "/logout"){
AuthFactory.logout();
$rootScope.user ={};
$location.url("/auth");
Expand All @@ -23,18 +23,19 @@ app.controller("AuthCtrl", function($scope, $rootScope, AuthFactory, UserFactory
});
};

$scope.setLoginContainer = function(){
$scope.loginContainer = true;
$scope.registerContainer = false;

};

$scope.setRegisterContainer = function(){
$scope.loginContainer = false;
$scope.registerContainer = true;

};

$scope.setLoginContainer = function(){
$scope.loginContainer = true;
$scope.registerContainer = false;

};

$scope.registerUser = function(registerNewUser){
AuthFactory.registerWithEmail(registerNewUser).then(function(didRegister){
registerNewUser.uid = didRegister.uid;
Expand Down
4 changes: 3 additions & 1 deletion javascripts/factories/AuthFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,6 @@ app.factory("AuthFactory", function($q, $http, $rootScope, FIREBASE_CONFIG) {
};

return {isAuthenticated:isAuthenticated, getUser:getUser, logout:logout, registerWithEmail:registerWithEmail, authenticate:authenticate, authenticateGoogle: authenticateGoogle};
});
});

console.log("AuthFactory loaded");
30 changes: 8 additions & 22 deletions partials/auth.html
Original file line number Diff line number Diff line change
@@ -1,55 +1,41 @@
<div class="container col-xs-4 col-xs-offset-3">
<div class="col-xs-6 col-xs-offset-3">
<div class="row">
<button class="btn btn-success col-xs-6" ng-click="setRegisterContainer()">Register</button>
<button class="btn btn-info col-xs-6" ng-click="setLoginContainer()">Login</button>

</div>
<button class="btn btn-success col-xs-6" ng-click="setRegisterContainer()">Register</button>
</div>
<div class="row">

<!-- start of register form -->
<form ng-show="loginContainer">

<div class="form-group">
<label>Email Address</label>
<input type="email" class="col-xs-offset-1 col-xs-10" placeholder="Email address" ng-model="login.email" required autofocus>
</div>

<div class="form-group">
<label>Password</label>
<input type="password" class="col-xs-offset-1 col-xs-10" placeholder="" ng-model="login.password" required>
</div>

<div class="form-group">
<a class="btn btn-lg btn-success col-xs-offset-1 col-xs-10" ng-click="loginUser(login)">Submit Login</a>
<a class="btn btn-lg btn-info col-xs-offset-1 col-xs-10" ng-click="loginUser(login)">Submit Login</a>
</div>

</form>
<!--end of register form -->

<!-- start of login form -->
<!-- start of login form -->
<form ng-show="registerContainer">

<div class="form-group">
<label>Email Address</label>
<input type="email" class="col-xs-offset-1 col-xs-10" placeholder="Email address" ng-model="register.email" required autofocus>
</div>

<div class="form-group">
<label>Password</label>
<input type="password" class="col-xs-offset-1 col-xs-10" placeholder="" ng-model="register.password" required>
<input type="password" class="col-xs-offset-1 col-xs-10" placeholder="Password" ng-model="register.password" required>
</div>

<div class="form-group">
<label>Username</label>
<input type="text" class="col-xs-offset-1 col-xs-10" placeholder="Username" ng-model="register.username" required>
</div>

<div class="form-group">
<a class="btn btn-lg btn-success col-xs-offset-1 col-xs-10" ng-click="registerUser(register)">Submit Registration</a>
</div>

</form>
<!-- end of login form -->

</div>
<!-- end of login form -->
</div>
</div>
17 changes: 0 additions & 17 deletions partials/login

This file was deleted.

2 changes: 1 addition & 1 deletion partials/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">Todo App</a>
<a class="navbar-brand" href="#">Pin This</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
Expand Down
Empty file removed partials/pin-new.html
Empty file.

0 comments on commit 4cc8823

Please sign in to comment.