Permalink
Browse files

Beautify

add bootstrap, angular-toastr, bootstrap-social, font-awsome
  • Loading branch information...
1 parent d8093fb commit ffac9bbe9ddc7598b701e8892568c1bf3a74cfc1 @nguyenkims committed Dec 6, 2015
Showing with 75 additions and 25 deletions.
  1. +1 −1 app.py
  2. +4 −0 static/bower.json
  3. +8 −4 static/index.html
  4. +4 −0 static/main.css
  5. +11 −5 static/main.js
  6. +5 −1 static/partials/home.tpl.html
  7. +26 −6 static/partials/login.tpl.html
  8. +16 −8 static/partials/secret.tpl.html
View
@@ -137,4 +137,4 @@ def index():
if __name__ == '__main__':
- app.run(debug=True)
+ app.run(debug=True, port=5002)
View
@@ -20,7 +20,11 @@
],
"dependencies": {
"angular": "angularjs#~1.4.8",
+ "angular-toastr": "~1.6.0",
"angular-ui-router": "~0.2.15",
+ "bootstrap": "~3.3.6",
+ "bootstrap-social": "~4.11.0",
+ "components-font-awesome": "~4.5.0",
"satellizer": "~0.13.1"
}
}
View
@@ -3,18 +3,22 @@
<head>
<meta charset="UTF-8">
<title>Demo Satellizer</title>
+
+ <link rel="stylesheet" type="text/css" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
+ <link rel="stylesheet" type="text/css" href="bower_components/components-font-awesome/css/font-awesome.min.css">
+ <link rel="stylesheet" type="text/css" href="bower_components/bootstrap-social/bootstrap-social.css">
+ <link rel="stylesheet" type="text/css" href="bower_components/angular-toastr/dist/angular-toastr.css">
+ <link rel="stylesheet" type="text/css" href="main.css">
</head>
-<body ng-app="DemoApp">
-<a ui-sref="home">Home</a>
-<a ui-sref="login">Login</a>
-<a ui-sref="secret">Secret</a>
+<body ng-app="DemoApp" class="container">
<div ui-view></div>
<script src="bower_components/angular/angular.min.js"></script>
<script src="bower_components/angular-ui-router/release/angular-ui-router.min.js"></script>
<script src="bower_components/satellizer/satellizer.min.js"></script>
+<script src="bower_components/angular-toastr/dist/angular-toastr.tpls.js"></script>
<script src="main.js"></script>
</body>
View
@@ -0,0 +1,4 @@
+body {
+ margin-top: 4em;
+ max-width: 600px;
+}
View
@@ -1,4 +1,4 @@
-var app = angular.module('DemoApp', ['ui.router', 'satellizer']);
+var app = angular.module('DemoApp', ['ui.router', 'satellizer', 'toastr']);
app.config(function ($stateProvider, $urlRouterProvider, $authProvider) {
@@ -24,7 +24,7 @@ app.config(function ($stateProvider, $urlRouterProvider, $authProvider) {
$authProvider.facebook({
clientId: '413108255566242',
// by default, the redirect URI is http://localhost:5000
- redirectUri: 'http://localhost:5000/static/index.html'
+ redirectUri: location.origin + location.pathname
});
});
@@ -44,7 +44,7 @@ app.run(function ($rootScope, $state, $auth) {
});
-app.controller('LoginSignupCtrl', function ($scope, $auth, $state) {
+app.controller('LoginSignupCtrl', function ($scope, $auth, $state, toastr) {
$scope.signUp = function () {
$auth
@@ -54,7 +54,10 @@ app.controller('LoginSignupCtrl', function ($scope, $auth, $state) {
$state.go('secret');
})
.catch(function (response) {
- console.log("error response", response);
+ toastr.error(
+ 'Error!',
+ {closeButton: true}
+ );
})
};
@@ -66,7 +69,10 @@ app.controller('LoginSignupCtrl', function ($scope, $auth, $state) {
$state.go('secret');
})
.catch(function (response) {
- console.log("error response", response);
+ toastr.error(
+ 'Email or password not correct!',
+ {closeButton: true}
+ );
})
};
@@ -1 +1,5 @@
-Home
+<div class="text-center">
+ <button class="btn btn-success" ui-sref="secret">
+ See secret
+ </button>
+</div>
@@ -1,7 +1,27 @@
-Login
+<div class="row">
+ <button ng-click="auth('facebook')" class="btn btn-block btn-social btn-facebook" type="button">
+ <span class="fa fa-facebook"></span> Sign in with Facebook
+ </a>
+</div>
+<div class="row">
+ <div class="text-center">
+ <hr>
+ Or
+ <hr>
+ </div>
+</div>
-<input type="text" ng-model="email" placeholder="Email">
-<input type="password" ng-model="password" placeholder="Password">
-<button ng-click="signUp()">Sign up</button>
-<button ng-click="login()">Login</button>
-<button ng-click="auth('facebook')">Connect with Facebook</button>
+
+<div class="row">
+ <input type="text" ng-model="email" placeholder="Email" class="form-control">
+ <input type="password" ng-model="password" placeholder="Password" class="form-control">
+ <br>
+
+ <div class="text-center">
+ <div class="btn-group btn-group-lg">
+ <button class="btn btn-default" ng-click="login()">Login</button>
+ <button class="btn btn-default" ng-click="signUp()">Register</button>
+ </div>
+ </div>
+
+</div>
@@ -1,10 +1,18 @@
-Secret
+<div class="row">
+ <button ng-click="logout()" class="btn btn-default btn-danger pull-right">
+ Log out
+ </button>
+</div>
+<div class="row text-center">
+ <h1>
+ Secret
+ </h1>
-<button ng-click="logout()">Log out</button>
+ <p>
+ user email: {{ user.email }}
+ </p>
-<p>
- user email: {{ user.email }}
-</p>
-<p>
- user id: {{ user.id }}
-</p>
+ <p>
+ user id: {{ user.id }}
+ </p>
+</div>

0 comments on commit ffac9bb

Please sign in to comment.