Skip to content

Commit 6f000fb

Browse files
MSunMSun
authored andcommitted
first commit to set up the development environment
1 parent da9f64b commit 6f000fb

Some content is hidden

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

65 files changed

+2522
-0
lines changed

.editorconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false

.eslintrc

Lines changed: 219 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.idea
2+
node_modules
3+
npm-debug.log
4+
public
5+
.DS_Store
6+
coverage

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: node server/start.js

browser/js/about/about.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<section id="about">
2+
<p>
3+
This website--the very one at which you currently gaze--was created by a basic scaffolding
4+
concocted at Fullstack Academy. Here are some of the people who make it all very real:
5+
</p>
6+
<carousel interval="2000">
7+
<slide ng-repeat="image in images">
8+
<img height="300" ng-src="{{ image }}" />
9+
</slide>
10+
</carousel>
11+
</section>

browser/js/about/about.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
app.config(function ($stateProvider) {
2+
3+
// Register our *about* state.
4+
$stateProvider.state('about', {
5+
url: '/about',
6+
controller: 'AboutController',
7+
templateUrl: 'js/about/about.html'
8+
});
9+
10+
});
11+
12+
app.controller('AboutController', function ($scope, FullstackPics) {
13+
14+
// Images of beautiful Fullstack people.
15+
$scope.images = _.shuffle(FullstackPics);
16+
17+
});

browser/js/app.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
'use strict';
2+
window.app = angular.module('FullstackGeneratedApp', ['ui.router', 'ui.bootstrap', 'fsaPreBuilt']);
3+
4+
app.config(function ($urlRouterProvider, $locationProvider) {
5+
// This turns off hashbang urls (/#about) and changes it to something normal (/about)
6+
$locationProvider.html5Mode(true);
7+
// If we go to a URL that ui-router doesn't have registered, go to the "/" url.
8+
$urlRouterProvider.otherwise('/');
9+
});
10+
11+
// This app.run is for controlling access to specific states.
12+
app.run(function ($rootScope, AuthService, $state) {
13+
14+
// The given state requires an authenticated user.
15+
var destinationStateRequiresAuth = function (state) {
16+
return state.data && state.data.authenticate;
17+
};
18+
19+
// $stateChangeStart is an event fired
20+
// whenever the process of changing a state begins.
21+
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
22+
23+
if (!destinationStateRequiresAuth(toState)) {
24+
// The destination state does not require authentication
25+
// Short circuit with return.
26+
return;
27+
}
28+
29+
if (AuthService.isAuthenticated()) {
30+
// The user is authenticated.
31+
// Short circuit with return.
32+
return;
33+
}
34+
35+
// Cancel navigating to new state.
36+
event.preventDefault();
37+
38+
AuthService.getLoggedInUser().then(function (user) {
39+
// If a user is retrieved, then renavigate to the destination
40+
// (the second time, AuthService.isAuthenticated() will work)
41+
// otherwise, if no user is logged in, go to "login" state.
42+
if (user) {
43+
$state.go(toState.name, toParams);
44+
} else {
45+
$state.go('login');
46+
}
47+
});
48+
49+
});
50+
51+
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<img src="https://jlau-bucket-1.s3.amazonaws.com/uploads/topic/image/42/fullstack.png" />
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
app.directive('fullstackLogo', function () {
2+
return {
3+
restrict: 'E',
4+
templateUrl: 'js/common/directives/fullstack-logo/fullstack-logo.html'
5+
};
6+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<nav class="navbar navbar-static-top">
2+
<div class="container">
3+
<div class="navbar-header">
4+
<fullstack-logo></fullstack-logo>
5+
</div>
6+
<ul class="nav navbar-nav">
7+
<li ng-repeat="item in items" ng-show="!item.auth || isLoggedIn()">
8+
<a ui-sref-active="active" ui-sref="{{ item.state }}">{{ item.label }}</a>
9+
</li>
10+
</ul>
11+
<button ng-show="!user" ui-sref="login" class="btn login-button">Login</button>
12+
<div ng-show="user" class="welcome">
13+
<span>Welcome, {{ user.email }}!</span>
14+
<a ng-click="logout()">Logout</a>
15+
</div>
16+
</div>
17+
</nav>

0 commit comments

Comments
 (0)