Skip to content

Commit 6a6e283

Browse files
authored
Merge pull request codefellows-seattle-javascript-401d15#3 from spamalope01/lab26JD
Lab26 jd
2 parents bcfbd0b + 14ce657 commit 6a6e283

File tree

28,730 files changed

+2122184
-0
lines changed

Some content is hidden

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

28,730 files changed

+2122184
-0
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

app/config/router-config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
'use strict';
2+
3+
module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig];
4+
5+
function routerConfig($stateProvider, $urlRouterProvider) {
6+
$urlRouterProvider.when('/', '/home'); //urlRouterProvider sets up definitive routes.
7+
8+
//all these routes will have the # and will act like the # anchor. so they will look like #/home and #/signup.
9+
10+
let routes = [
11+
{
12+
name: 'home',
13+
url: '/home',
14+
template: require('../view/home/home.html'),
15+
controller: 'HomeController',
16+
controllerAs: 'homeCtrl'
17+
},
18+
{
19+
name: 'signup',
20+
url: '/signup',
21+
template: require('../view/signup/signup.html'),
22+
controller: 'SignupController',
23+
controllerAs: 'signupCtrl'
24+
},
25+
{
26+
name: 'gallery',
27+
url: '/gallery',
28+
template: require('../view/gallery/gallery.html'),
29+
controller: 'GalleryController',
30+
controllerAs: 'galleryCtrl'
31+
}
32+
];
33+
34+
//iterates over all the routes and registers them with the service.
35+
routes.forEach( route => {
36+
$stateProvider.state(route);
37+
});
38+
};

app/entry.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
require('./scss/main.scss');
4+
require('./view/gallery/gallery.scss');
5+
require('./view/home/home.scss');
6+
require('./view/signup/signup.scss');
7+
8+
const path = require('path');
9+
const camelcase = require('camelcase');
10+
const pascalcase = require('pascalcase');
11+
const angular = require('angular');
12+
const uiRouter = require('angular-ui-router');
13+
14+
const routesApp = angular.module('routesApp', [uiRouter]);
15+
16+
//this is loading up the route file.
17+
let context = require.context('./config/', true, /\.js$/);
18+
context.keys().forEach(key => {
19+
routesApp.config(context(key));
20+
});
21+
22+
context = require.context('./view/', true, /\.js$/);
23+
context.keys().forEach( key => {
24+
let name = pascalcase(path.basename(key, '.js'));
25+
routesApp.controller(name, context(key)); //this is registering a controller with the routesApp. it\s just doing it with a forEach loop. but it's doing this with appController and HomeController.
26+
});

app/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html ng-app="routesApp">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>routes app</title>
7+
</head>
8+
<body>
9+
<header>
10+
<h1>routes app!</h1>
11+
</header>
12+
13+
<main>
14+
<!-- this is where changes will be hosted and shown. they are affected by the router. click on a link and the ui-view will change to show new content. -->
15+
<ui-view></ui-view>
16+
</main>
17+
18+
<footer></footer>
19+
</body>
20+
</html>

app/scss/main.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
html, body {
2+
width: 100%;
3+
height: 100%;
4+
background: #888;
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
'use strict';
2+
3+
require('./gallery.scss');
4+
5+
module.exports = ['$log', GalleryController];
6+
function GalleryController($log) {
7+
$log.debug('galleryController');
8+
this.title = 'Gallery'
9+
};

app/view/gallery/gallery.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<section class="gallery-content">
2+
<h1>Welcome to the {{ galleryCtrl.title }} </h1>
3+
</section>

app/view/gallery/gallery.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.home-content {
2+
width: 80%;
3+
margin-left: 10%;
4+
color: #fff;
5+
background-color: #888
6+
};

app/view/home/home-controller.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'use strict';
2+
3+
require('./home.scss');
4+
5+
module.exports = ['$log', HomeController];
6+
7+
function HomeController($log) {
8+
$log.debug('HomeController');
9+
this.title = 'Home'
10+
};

0 commit comments

Comments
 (0)