{{ cowsayCtrl.title }}
+ ++ {{ cowsayCtrl.update(cowsayCtrl.text) }} ++ + +
diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..c13c5f6 --- /dev/null +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5702678 --- /dev/null +++ b/.gitignore @@ -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 + + +# End of https://www.gitignore.io/api/node diff --git a/app/entry.js b/app/entry.js new file mode 100644 index 0000000..8527519 --- /dev/null +++ b/app/entry.js @@ -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 || 'moo', 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: 'cow creator', + url: '/cowcreator' + }, + { + name: 'account', + url: '/myaccount' + } + ]; +} diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..78b6f1a --- /dev/null +++ b/app/index.html @@ -0,0 +1,52 @@ + + +
++ {{ cowsayCtrl.update(cowsayCtrl.text) }} ++ + +