Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
218 changes: 218 additions & 0 deletions .eslintrc

Large diffs are not rendered by default.

65 changes: 65 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Created by https://www.gitignore.io/api/node

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
#Build Directory
build/

# End of https://www.gitignore.io/api/node
61 changes: 61 additions & 0 deletions app/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
'use strict';

require('./scss/reset.scss');
require('./scss/main.scss');

const angular = require('angular');
const cowsay = require('cowsay-browser');

const cowsayApp = angular.module('cowsayApp', []);

cowsayApp.controller('CowsayController', ['$log', CowsayController]);

function CowsayController($log) {
$log.debug('CowsayController');

this.title = 'Welcome to Cowville!';
this.history = [];

cowsay.list((err, cowfiles) => {
this.cowfiles = cowfiles;
this.current = this.cowfiles[0];
});

this.update = function(input) {
$log.debug('cowsayCtrl.update()');
return cowsay.say({ text: input || 'moooooooo', f: this.current });
};

this.speak = function(input) {
$log.debug('cowsayCtrl.speak()');
this.spoken = this.update(input);
this.history.push(this.spoken);
};

this.undo = function() {
$log.debug('cowsayCtrl.undo()');
this.history.pop();
this.spoken = this.history.pop() || '';
};
};

cowsayApp.controller('NavController', ['$log', NavController]);

function NavController($log) {
$log.debug('NavController');

this.routes = [
{
name: 'home',
url: '/home'
},
{
name: 'about',
url: '/about-us'
},
{
name: 'contact',
url: '/contact-us'
}
];
};
51 changes: 51 additions & 0 deletions app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!DOCTYPE html>
<html ng-app="cowsayApp">
<head>
<title>Welcome to Cowville!</title>
</head>
<body>
<header>
<nav ng-controller="NavController as navCtrl">
<ul>
<li ng-repeat="route in navCtrl.routes">
<a href="{{ link.url }}">{{ route.name }}</a>
</li>
</ul>
</nav>
</header>

<main>
<section
class="container"
ng-controller="CowsayController as cowsayCtrl"
ng-init="cowsayCtrl.current = 'squirrel'">
<h2>{{ cowsayCtrl.title }}</h2>

<pre class="cow">
{{ cowsayCtrl.update(cowsayCtrl.text) }}
</pre>

<form
ng-submit="cowsayCtrl.speak(cowsayCtrl.text)"
name="cowsayForm"
no validate>
<select ng-model="cowsayCtrl.current">
<option ng-repeat="cowfile in cowsayCtrl.cowfiles" value="{{ cowfile }}">
{{ cowfile }}
</option>
</select>

<input type="text" ng-model="cowsayCtrl.text" required>
<button type="submit">Speak!</button>

<div ng-show="cowsayCtrl.spoken" class="history">
<pre>
{{ cowsayCtrl.spoken }}
</pre>
<button type="button" ng-click="cowsayCtrl.undo()">Undo!</button>
</div>
</form>
</section>
</main>
</body>
</html>
143 changes: 143 additions & 0 deletions app/scss/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
@import url('https://fonts.googleapis.com/css?family=Montserrat');
//
// // global variables
$font : Montserrat, sans-serif;
$lightgray : #abaeb2;
$medgray : #787d84;
$darkgray : #333538;


header {
background-color: $medgray;
height: 5vw;
width: 100%;
};

h1{
font-family: $font;
text-decoration: none;
flex-direction: column;
margin-left: 2%;
padding-top: 2vw;
padding-left: 5vw;
};


nav{
float: right;
margin-bottom: 50px;
width: 100%;
color: $darkgray;

ul li{
float: right;
display: inline-block;
margin-top: -3vw;
margin-right: 3vw;
margin-left: 3vw;
margin-bottom: 2vw;
padding-bottom: 450px;
}
};

a{
text-decoration: none;
color: $darkgray;
font-family: $font;
&:hover{
text-decoration: underline;
}
};

body{
background-color: $lightgray;
width: 100%;
};

main{
background-color: $lightgray;
height: 45vw;
width: 100%;
outline: orange solid 1px;
position: relative;
};

.container{
background-color: $lightgray;
outline: pink 1px solid;
height: 50vw;
width: 100%;
position: absolute;
top: 2vw;
left: 4vw;
};

.cow{
outline: black 1px solid;
width: 55%;
height: 45vw;
};

//centering
form{
float: right;
margin: -50% 15% 0% 65%;
padding-top: 5vw;
padding-bottom: 5vw;
clear: both;

//buttons
select{
margin: 2vw 0 2vw 0;
font-family: $font;
width: 20vw;
height: 4vw;
}

button{
height: 4vw;
width: 20vw;
border-radius: 10%;
font-family : $font;
margin-top: 2vw;
margin-bottom: 1vw;
color: white;
background-color: $darkgray;
outline: black solid 1px;
display: block;

}

input{
height: 1.8vw;
width: 20vw;
font-family : $font;
margin-bottom: 2vw;
outline: black solid 1px;
}

};

h2{
font-family: $font;
margin-bottom: 1vw;
};

footer {
height: 120px;
width: 100%;
background-color: #333538;
margin-bottom: -200px;
position: relative;

};


h6{
font-family: $font;
float: right;
position: absolute;
top:104px;
right:2px;
color: white;
};
48 changes: 48 additions & 0 deletions app/scss/reset.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
Loading