@@ -9,8 +9,7 @@ |
||
9 | 9 |
<!-- build:css(.) styles/vendor.css --> |
10 | 10 |
<!-- bower:css --> |
11 | 11 |
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" /> |
12 |
- |
|
13 |
- <link rel="stylesheet" href="bower_components/ladda/dist/ladda-themeless.min.css"> |
|
12 |
+ <link rel="stylesheet" href="bower_components/ladda/dist/ladda.min.css" /> |
|
14 | 13 |
<!-- endbower --> |
15 | 14 |
<!-- endbuild --> |
16 | 15 |
<!-- build:css(.tmp) styles/main.css --> |
@@ -43,7 +42,8 @@ |
||
43 | 42 |
<ul class="nav navbar-nav" > |
44 | 43 |
<li ng-class="{ active: isActive('/')}"><a href="#/">Home</a></li> |
45 | 44 |
<li ng-class="{ active: isActive('/domains')}"><a href="#/domains">domains</a></li> |
46 |
- <li ng-class="{ active: isActive('/sign_in')}"><a href="#/sign_in">Sign in</a></li> |
|
45 |
+ <li ng-class="{ active: isActive('/sign_in')}" ng-show="!isAuthenticated"><a href="#/sign_in">Sign in</a></li> |
|
46 |
+ <li ng-class="{ active: isActive('/addPost')}" ng-show="isAuthenticated"><a href="#/addPost">Add Post</a></li> |
|
47 | 47 |
</ul> |
48 | 48 |
</div> |
49 | 49 |
</div> |
@@ -57,7 +57,7 @@ |
||
57 | 57 |
<div footer></div> |
58 | 58 |
|
59 | 59 |
|
60 |
- <!-- Google Analytics: change UA-XXXXX-X to be your site's ID --> |
|
60 |
+ <!-- Google Analytics: change UA-XXXXX-X to be your site's ID |
|
61 | 61 |
<script> |
62 | 62 |
!function(A,n,g,u,l,a,r){A.GoogleAnalyticsObject=l,A[l]=A[l]||function(){ |
63 | 63 |
(A[l].q=A[l].q||[]).push(arguments)},A[l].l=+new Date,a=n.createElement(g), |
@@ -67,6 +67,7 @@ |
||
67 | 67 |
ga('create', 'UA-XXXXX-X'); |
68 | 68 |
ga('send', 'pageview'); |
69 | 69 |
</script> |
70 |
+ --> |
|
70 | 71 |
|
71 | 72 |
<!-- build:js(.) scripts/vendor.js --> |
72 | 73 |
<!-- bower:js --> |
@@ -79,6 +80,7 @@ |
||
79 | 80 |
<script src="bower_components/angular-route/angular-route.js"></script> |
80 | 81 |
<script src="bower_components/angular-sanitize/angular-sanitize.js"></script> |
81 | 82 |
<script src="bower_components/angular-touch/angular-touch.js"></script> |
83 |
+ <script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script> |
|
82 | 84 |
<script src="bower_components/firebase/firebase.js"></script> |
83 | 85 |
<script src="bower_components/angularfire/dist/angularfire.js"></script> |
84 | 86 |
<script src="bower_components/spin.js/spin.js"></script> |
@@ -89,11 +91,14 @@ |
||
89 | 91 |
|
90 | 92 |
<!-- build:js({.tmp,app}) scripts/scripts.js --> |
91 | 93 |
<script src="scripts/app.js"></script> |
94 |
+ <script src="scripts/services/userData.js"></script> |
|
92 | 95 |
<script src="scripts/controllers/main.js"></script> |
93 | 96 |
<script src="scripts/controllers/domainsList.js"></script> |
94 | 97 |
<script src="scripts/controllers/signin.js"></script> |
98 |
+ <script src="scripts/controllers/addPost.js"></script> |
|
95 | 99 |
<script src="scripts/controllers/header.js"></script> |
96 | 100 |
<script src="scripts/directives/footer.js"></script> |
101 |
+ |
|
97 | 102 |
<!-- endbuild --> |
98 | 103 |
<scriptsrc="https://cdn.firebase.com/js/simple-login/1.6.2/firebase-simple-login.js"></script> |
99 | 104 |
</body> |
@@ -18,9 +18,11 @@ angular |
||
18 | 18 |
'ngTouch', |
19 | 19 |
'firebase', |
20 | 20 |
'angular-ladda', |
21 |
+ 'domainManagerApp.header', |
|
21 | 22 |
'domainManagerApp.main', |
22 | 23 |
'domainManagerApp.signin', |
23 |
- 'domainManagerApp.domains' |
|
24 |
+ 'domainManagerApp.domains', |
|
25 |
+ 'domainManagerApp.addPost' |
|
24 | 26 |
]) |
25 | 27 |
.config(['$routeProvider', function($routeProvider) { |
26 | 28 |
$routeProvider |
@@ -36,6 +38,10 @@ angular |
||
36 | 38 |
templateUrl: 'views/signin.html', |
37 | 39 |
controller: 'SignInController' |
38 | 40 |
}) |
41 |
+ .when('/addPost', { |
|
42 |
+ templateUrl: 'views/addPost.html', |
|
43 |
+ controller: 'AddPostController' |
|
44 |
+ }) |
|
39 | 45 |
.otherwise({ |
40 | 46 |
redirectTo: '/' |
41 | 47 |
}); |
@@ -0,0 +1,13 @@ |
||
1 |
+'use strict'; |
|
2 |
+ |
|
3 |
+/** |
|
4 |
+ * @ngdoc function |
|
5 |
+ * @name domainManagerApp.controller:MainCtrl |
|
6 |
+ * @description |
|
7 |
+ * # MainCtrl |
|
8 |
+ * Controller of the domainManagerApp |
|
9 |
+ */ |
|
10 |
+ angular.module('domainManagerApp.addPost', ['firebase', 'domainManagerApp.userData']) |
|
11 |
+ .controller('AddPostController', ['$scope', 'UserData', function ($scope, UserData) { |
|
12 |
+ |
|
13 |
+ }]); |
@@ -7,12 +7,29 @@ |
||
7 | 7 |
* # AboutCtrl |
8 | 8 |
* Controller of the domainManagerApp |
9 | 9 |
*/ |
10 |
-angular.module('domainManagerApp.domains', []) |
|
10 |
+angular.module('domainManagerApp.domains', ['ui.bootstrap']) |
|
11 | 11 |
.controller('DomainsListController', function ($scope, $http) { |
12 | 12 |
$http({ |
13 | 13 |
method: 'GET', |
14 | 14 |
url: '/scripts/data.json' |
15 | 15 |
}).success(function(data) { |
16 | 16 |
$scope.domains = data.domains; |
17 |
- }) |
|
17 |
+ |
|
18 |
+ |
|
19 |
+ }); |
|
20 |
+ |
|
21 |
+ $scope.oneAtATime = false; |
|
22 |
+ $scope.isOpen = false; |
|
23 |
+ |
|
24 |
+ $scope.labelColor = function(status) { |
|
25 |
+ if (status == "OK"){ |
|
26 |
+ var color = "label-success"; |
|
27 |
+ } else if (status == "DEAD") { |
|
28 |
+ var color = "label-danger"; |
|
29 |
+ } else { |
|
30 |
+ var color = "label-default"; |
|
31 |
+ } |
|
32 |
+ return color; |
|
33 |
+ } |
|
34 |
+ |
|
18 | 35 |
}); |
@@ -7,9 +7,18 @@ |
||
7 | 7 |
* # MainCtrl |
8 | 8 |
* Controller of the domainManagerApp |
9 | 9 |
*/ |
10 |
-angular.module('domainManagerApp') |
|
11 |
- .controller('HeaderController', function ($scope, $location) { |
|
10 |
+angular.module('domainManagerApp.header', ['domainManagerApp.userData']) |
|
11 |
+ .controller('HeaderController', ['$scope', '$rootScope', '$location', 'UserData', function ($scope, $rootScope, $location, UserData) { |
|
12 | 12 |
$scope.isActive = function (viewLocation) { |
13 | 13 |
return viewLocation === $location.path(); |
14 | 14 |
}; |
15 |
- }); |
|
15 |
+ $scope.isAuthenticated = UserData.isAuthenticated(); |
|
16 |
+ console.log($scope.isAuthenticated) |
|
17 |
+ |
|
18 |
+ $rootScope.$on('user:isAuthenticated', function(data, isAuthenticated) { |
|
19 |
+ // you could inspect the data to see if what you care about changed, or just update your own scope |
|
20 |
+ $scope.isAuthenticated = isAuthenticated; |
|
21 |
+ console.log($scope.isAuthenticated) |
|
22 |
+ }); |
|
23 |
+ |
|
24 |
+ }]); |
@@ -7,11 +7,8 @@ |
||
7 | 7 |
* # MainCtrl |
8 | 8 |
* Controller of the domainManagerApp |
9 | 9 |
*/ |
10 |
- angular.module('domainManagerApp.main', ['firebase']) |
|
11 |
- .controller('MainCtrl', function ($scope) { |
|
12 |
- $scope.awesomeThings = [ |
|
13 |
- 'HTML5 Boilerplate', |
|
14 |
- 'AngularJS', |
|
15 |
- 'Karma' |
|
16 |
- ]; |
|
17 |
- }); |
|
10 |
+ angular.module('domainManagerApp.main', ['firebase', 'domainManagerApp.userData']) |
|
11 |
+ .controller('MainCtrl', ['$scope', 'UserData', function ($scope, UserData) { |
|
12 |
+ $scope.username = UserData.getUser(); |
|
13 |
+ $scope.isAuthenticated = UserData.isAuthenticated(); |
|
14 |
+ }]); |
@@ -7,8 +7,8 @@ |
||
7 | 7 |
* # MainCtrl |
8 | 8 |
* Controller of the domainManagerApp |
9 | 9 |
*/ |
10 |
- angular.module('domainManagerApp.signin', ['firebase', 'angular-ladda']) |
|
11 |
- .controller('SignInController', ['$scope', '$firebaseAuth', '$timeout', function ($scope, $firebaseAuth, $timeout) { |
|
10 |
+ angular.module('domainManagerApp.signin', ['firebase', 'domainManagerApp.userData', 'angular-ladda']) |
|
11 |
+ .controller('SignInController', ['$scope', 'UserData', '$location', '$firebaseAuth', '$timeout', function ($scope, UserData, $location, $firebaseAuth, $timeout) { |
|
12 | 12 |
|
13 | 13 |
$scope.loading = false; |
14 | 14 |
var firebaseObj = new Firebase("https://j1x-cpanel.firebaseio.com"); |
@@ -28,6 +28,8 @@ |
||
28 | 28 |
console.log("Logged in as:", authData.uid); |
29 | 29 |
$timeout(function() { |
30 | 30 |
$scope.loading = false; // stop loading |
31 |
+ UserData.set($scope.user.email, true); |
|
32 |
+ $location.path('/main'); |
|
31 | 33 |
}, 1000); |
32 | 34 |
}).catch(function(error) { |
33 | 35 |
console.error("Authentication failed:", error); |
@@ -37,4 +39,20 @@ |
||
37 | 39 |
}); |
38 | 40 |
} |
39 | 41 |
|
42 |
+ $scope.EmailCheck = function() { |
|
43 |
+ if($scope.signinForm.email.$invalid && $scope.signinForm.email.$dirty) { |
|
44 |
+ return true; |
|
45 |
+ } else { |
|
46 |
+ return false; |
|
47 |
+ } |
|
48 |
+ } |
|
49 |
+ |
|
50 |
+ $scope.PasswordCheck = function() { |
|
51 |
+ if($scope.signinForm.password.$error.minlength && $scope.signinForm.password.$dirty) { |
|
52 |
+ return true; |
|
53 |
+ } else { |
|
54 |
+ return false; |
|
55 |
+ } |
|
56 |
+ } |
|
57 |
+ |
|
40 | 58 |
}]); |
@@ -4,33 +4,46 @@ |
||
4 | 4 |
"name" : "jamesperet.com", |
5 | 5 |
"status" : "OK", |
6 | 6 |
"owner" : "James Peret", |
7 |
- "registrart" : "NT10", |
|
8 |
- "registration_date" : "", |
|
9 |
- "expiration_date" : "" |
|
7 |
+ "registrar" : "NT10", |
|
8 |
+ "registration_date" : "01/01/2001", |
|
9 |
+ "expiration_date" : "01/01/20016", |
|
10 |
+ "description" : "My personal global domain. Used for my portfolio and blog in english" |
|
10 | 11 |
}, |
11 | 12 |
{ |
12 | 13 |
"name" : "jamesperet.com.br", |
13 | 14 |
"status" : "OK", |
14 | 15 |
"owner" : "James Peret", |
15 |
- "registrart" : "NT10", |
|
16 |
- "registration_date" : "", |
|
17 |
- "expiration_date" : "" |
|
16 |
+ "registrar" : "NT10", |
|
17 |
+ "registration_date" : "01/01/2001", |
|
18 |
+ "expiration_date" : "01/01/2016", |
|
19 |
+ "description" : "My personal brasilian domain. Used for my portfolio and blog in portuguese" |
|
18 | 20 |
}, |
19 | 21 |
{ |
20 | 22 |
"name" : "higheffects.com", |
21 | 23 |
"status" : "OK", |
22 | 24 |
"owner" : "James Peret", |
23 |
- "registrart" : "NT10", |
|
24 |
- "registration_date" : "", |
|
25 |
- "expiration_date" : "" |
|
25 |
+ "registrar" : "NT10", |
|
26 |
+ "registration_date" : "01/01/2004", |
|
27 |
+ "expiration_date" : "01/01/2016", |
|
28 |
+ "description" : "Company global domain." |
|
26 | 29 |
}, |
27 | 30 |
{ |
28 | 31 |
"name" : "higheffects.com.br", |
29 | 32 |
"status" : "OK", |
30 | 33 |
"owner" : "James Peret", |
31 |
- "registrart" : "NT10", |
|
32 |
- "registration_date" : "", |
|
33 |
- "expiration_date" : "" |
|
34 |
+ "registrar" : "NT10", |
|
35 |
+ "registration_date" : "01/01/2004", |
|
36 |
+ "expiration_date" : "01/01/2016", |
|
37 |
+ "description" : "Company brasilian domain." |
|
38 |
+ }, |
|
39 |
+ { |
|
40 |
+ "name" : "vertentes.tv", |
|
41 |
+ "status" : "DEAD", |
|
42 |
+ "owner" : "James Peret", |
|
43 |
+ "registrar" : "NT10", |
|
44 |
+ "registration_date" : "01/01/2005", |
|
45 |
+ "expiration_date" : "01/01/2012", |
|
46 |
+ "description" : "Project domain. Not in use anymore." |
|
34 | 47 |
} |
35 | 48 |
] |
36 | 49 |
} |
@@ -1,3 +1,5 @@ |
||
1 |
+"use strict" |
|
2 |
+ |
|
1 | 3 |
angular.module('domainManagerApp') |
2 | 4 |
.directive('footer', function () { |
3 | 5 |
return { |
@@ -0,0 +1,22 @@ |
||
1 |
+"use strict" |
|
2 |
+ |
|
3 |
+angular.module('domainManagerApp.userData', []) |
|
4 |
+.service('UserData', [ '$rootScope', function($rootScope) { |
|
5 |
+ var user = ''; |
|
6 |
+ var isAuthenticated = ""; |
|
7 |
+ |
|
8 |
+ this.set = function(value1, value2) { |
|
9 |
+ user = value1; |
|
10 |
+ isAuthenticated = value2; |
|
11 |
+ $rootScope.$broadcast('user:isAuthenticated', isAuthenticated); |
|
12 |
+ } |
|
13 |
+ |
|
14 |
+ this.isAuthenticated = function() { |
|
15 |
+ return isAuthenticated; |
|
16 |
+ } |
|
17 |
+ |
|
18 |
+ this.getUser = function() { |
|
19 |
+ return user; |
|
20 |
+ } |
|
21 |
+ |
|
22 |
+}]); |
@@ -87,6 +87,10 @@ body.ng-scope {padding: 0px;} |
||
87 | 87 |
} |
88 | 88 |
} |
89 | 89 |
|
90 |
+/* Bootstrap-UI Overrides */ |
|
91 |
+ |
|
92 |
+.nav, .pagination, .carousel, .panel-title a { cursor: pointer; } |
|
93 |
+ |
|
90 | 94 |
/* Bootstrap Signup Styles */ |
91 | 95 |
|
92 | 96 |
.form-signin { |
@@ -137,3 +141,17 @@ h1.j1x-logo { |
||
137 | 141 |
margin-bottom: 20px; |
138 | 142 |
margin-top: 0px; |
139 | 143 |
} |
144 |
+ |
|
145 |
+a.accordion-toggle:focus { |
|
146 |
+ outline: none; |
|
147 |
+ outline: none; |
|
148 |
+ outline-offset: 0px; |
|
149 |
+} |
|
150 |
+ |
|
151 |
+/* Hacks */ |
|
152 |
+.dl-horizontal.domains dt { |
|
153 |
+ width: 105px; |
|
154 |
+} |
|
155 |
+.dl-horizontal.domains dd { |
|
156 |
+ margin-left: 130px; |
|
157 |
+} |
@@ -0,0 +1,36 @@ |
||
1 |
+<div class="container"> |
|
2 |
+ |
|
3 |
+ <form class="form-horizontal"> |
|
4 |
+ <fieldset> |
|
5 |
+ |
|
6 |
+ <!-- Form Name --> |
|
7 |
+ <legend>Create Post</legend> |
|
8 |
+ |
|
9 |
+ <!-- Text input--> |
|
10 |
+ <div class="form-group"> |
|
11 |
+ <label class="col-md-4 control-label" for="txtTitle">Title</label> |
|
12 |
+ <div class="col-md-4"> |
|
13 |
+ <input id="txtTitle" name="txtTitle" type="text" placeholder="placeholder" class="form-control input-md"> |
|
14 |
+ |
|
15 |
+ </div> |
|
16 |
+ </div> |
|
17 |
+ |
|
18 |
+ <!-- Textarea --> |
|
19 |
+ <div class="form-group"> |
|
20 |
+ <label class="col-md-4 control-label"for="txtPost">Post</label> |
|
21 |
+ <div class="col-md-4"> |
|
22 |
+ <text areaclass="form-control" id="txtPost" name="txtPost"></textarea> |
|
23 |
+ </div> |
|
24 |
+ </div> |
|
25 |
+ |
|
26 |
+ <!-- Button --> |
|
27 |
+ <div class="form-group"> |
|
28 |
+ <label class="col-md-4 control-label"for="singlebutton"></label> |
|
29 |
+ <div class="col-md-4"> |
|
30 |
+ <input id="singlebutton"name="singlebutton"class="btn btn-primary"type="submit"value="Publish"/> |
|
31 |
+ </div> |
|
32 |
+ </div> |
|
33 |
+ |
|
34 |
+ </fieldset> |
|
35 |
+ </form> |
|
36 |
+</div> |
@@ -1,3 +1,21 @@ |
||
1 |
-<ul> |
|
2 |
- <li ng-repeat="domain in domains">{{domain.name}}</li> |
|
3 |
-</ul> |
|
1 |
+<accordion close-others="oneAtATime"> |
|
2 |
+ <accordion-group ng-repeat="domain in domains" is-open="isOpen"> |
|
3 |
+ <accordion-heading ng-click="isOpen = !isOpen"> |
|
4 |
+ <i class="pull-left glyphicon" ng-class="{'glyphicon-chevron-down': isOpen, 'glyphicon-chevron-right': !isOpen}" style="margin-right: 10px;"></i> |
|
5 |
+ {{domain.name}} |
|
6 |
+ <span class="{{labelColor(domain.status)}} label pull-right">{{domain.status}}</span> |
|
7 |
+ </accordion-heading> |
|
8 |
+ <dl class="dl-horizontal domains"> |
|
9 |
+ <dt>Description</dt> |
|
10 |
+ <dd>{{domain.description}}</dd> |
|
11 |
+ <dt>Owner</dt> |
|
12 |
+ <dd>{{domain.owner}}</dd> |
|
13 |
+ <dt>Registrar</dt> |
|
14 |
+ <dd>{{domain.registrar}}</dd> |
|
15 |
+ <dt>Registration</dt> |
|
16 |
+ <dd>{{domain.registration_date}}</dd> |
|
17 |
+ <dt>Expiration</dt> |
|
18 |
+ <dd>{{domain.expiration_date}}</dd> |
|
19 |
+ </dl> |
|
20 |
+ </accordion-group> |
|
21 |
+</accordion> |
@@ -4,5 +4,8 @@ |
||
4 | 4 |
<h2>Domain Manager</h2> |
5 | 5 |
</div> |
6 | 6 |
|
7 |
+ Welcome {{username}}<br> |
|
8 |
+ {{isAuthenticated}} |
|
9 |
+ |
|
7 | 10 |
|
8 | 11 |
</div> |
@@ -3,11 +3,17 @@ |
||
3 | 3 |
<h1 class="j1x-logo">J1X</h1> |
4 | 4 |
|
5 | 5 |
</div> |
6 |
- <form class="form-signin" role="form"> |
|
6 |
+ <form class="form-signin" name="signinForm" role="form"> |
|
7 | 7 |
<h2 class="form-title">Login</h2> |
8 |
- <input ng-model="user.email" type="email" class="form-control" placeholder="Email address" required="" autofocus=""> |
|
9 |
- <input ng-model="user.password" type="password" class="form-control" placeholder="Password" required=""> |
|
10 |
- <button ng-click="SignIn($event)" ng-disabled="!user.email || !user.password || loading" class="btn btn-lg btn-primary btn-block ladda-button" ladda="{{loading}}" data-style="slide-up"> SignIn</button> |
|
8 |
+ <div class="form-group" ng-class="{ 'has-error' : EmailCheck() }"> |
|
9 |
+ <input name="email" ng-model="user.email" type="email" class="form-control" placeholder="Email address" required="" autofocus=""> |
|
10 |
+ <p class="help-block" ng-show="EmailCheck()">Enter a valid email.</p> |
|
11 |
+ </div> |
|
12 |
+ <div class="form-group" ng-class="{ 'has-error' : PasswordCheck() }"> |
|
13 |
+ <input name="password" ng-model="user.password" type="password" class="form-control" placeholder="Password" required="" ng-minlength="8"> |
|
14 |
+ <p class="help-block" ng-show="PasswordCheck()">Min password length is 8 characters.</p> |
|
15 |
+ </div> |
|
16 |
+ <button ng-click="SignIn($event)" ng-disabled="!user.email || !user.password || loading" class="btn btn-lg btn-primary btn-block ladda-button" ladda="{{loading}}" data-style="slide-up">SignIn</button> |
|
11 | 17 |
</form> |
12 | 18 |
|
13 | 19 |
</div> |
@@ -10,6 +10,7 @@ |
||
10 | 10 |
"angular-route": "^1.3.0", |
11 | 11 |
"angular-sanitize": "^1.3.0", |
12 | 12 |
"angular-touch": "^1.3.0", |
13 |
+ "angular-bootstrap": "^0.13.0", |
|
13 | 14 |
"angularfire": "~1.1.1", |
14 | 15 |
"angular-ladda": "~0.2.2" |
15 | 16 |
}, |
@@ -14,7 +14,7 @@ |
||
14 | 14 |
"grunt-contrib-cssmin": "^0.12.0", |
15 | 15 |
"grunt-contrib-htmlmin": "^0.4.0", |
16 | 16 |
"grunt-contrib-imagemin": "^0.9.2", |
17 |
- "grunt-contrib-jshint": "^0.11.0", |
|
17 |
+ "grunt-contrib-jshint": "^0.11.2", |
|
18 | 18 |
"grunt-contrib-uglify": "^0.7.0", |
19 | 19 |
"grunt-contrib-watch": "^0.6.1", |
20 | 20 |
"grunt-filerev": "^2.1.2", |
@@ -31,6 +31,7 @@ module.exports = function(config) { |
||
31 | 31 |
'bower_components/angular-route/angular-route.js', |
32 | 32 |
'bower_components/angular-sanitize/angular-sanitize.js', |
33 | 33 |
'bower_components/angular-touch/angular-touch.js', |
34 |
+ 'bower_components/angular-bootstrap/ui-bootstrap-tpls.js', |
|
34 | 35 |
'bower_components/firebase/firebase.js', |
35 | 36 |
'bower_components/angularfire/dist/angularfire.js', |
36 | 37 |
'bower_components/spin.js/spin.js', |