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
8 changes: 8 additions & 0 deletions vic-bunny/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/node_modules/*
**/vendor/*
**/build/*
**/*.min.js
*.md
package.json
Procfile
npm-debug.log
42 changes: 42 additions & 0 deletions vic-bunny/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"rules": {
"no-console": 0,
"indent": [
2,
2
],
"quotes": [
2,
"single"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
]
},
"env": {
"es6": true,
"node": true,
"browser": true,
"mocha": true,
"jasmine": true
},
"globals": {
"describe": false,
"it": false,
"beforeEach": false,
"afterEach": false,
"before": false,
"after": false
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"impliedStrict": true
},
"extends": "eslint:recommended"
}
4 changes: 4 additions & 0 deletions vic-bunny/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
build
db
*_bundle.js
18 changes: 18 additions & 0 deletions vic-bunny/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bunny App</title>
<!-- <link rel="stylesheet" href="app.css"> -->
</head>
<body data-ng-app="BunnyApp">
<main ng-cloak ng-controller="BunnyController as hopper">
<no-bunny link="{{hopper.link}}" title="{{hopper.title}}" description="{{hopper.description}}"></no-bunny>
<thumb-bunny link="{{hopper.link}}" height="hopper.height" width="hopper.width" alt="{{hopper.title}}"></thumb-bunny>
<vic-bunny title="{{hopper.title}}" link="{{hopper.link}}" height="{{hopper.height}}" width="{{hopper.width}}" description="{{hopper.description}}"></vic-bunny>
</main>
<script src="bundle.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions vic-bunny/app/js/bunny/controllers/bunny-controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict';

module.exports = function(app) {
app.controller('BunnyController', ['$scope', function() {
this.title = 'Vicious Bunny';
this.height = 400;
this.width = 400;
this.description = 'Don\'t get too close or this vicious little monster will attack! This particular species can devour the average man in 13.7 seconds.';
this.link = 'http://f.cl.ly/items/3g3J1G0w122M360w380O/3726490195_f7cc75d377_o.jpg';
}]);
};
3 changes: 3 additions & 0 deletions vic-bunny/app/js/bunny/controllers/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function(app) {
require('./bunny-controller')(app);
};
5 changes: 5 additions & 0 deletions vic-bunny/app/js/bunny/directives/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = function(app) {
require('./nobunny-directive')(app);
require('./thumbbunny-directive')(app);
require('./vicbunny-directive')(app);
};
14 changes: 14 additions & 0 deletions vic-bunny/app/js/bunny/directives/nobunny-directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = function(app) {
app.directive('noBunny', function() {
return {
templateUrl:
'./templates/bunny/nobunny-directive.html',
restrict: 'E',
scope: {
title: '@',
link: '@',
description: '@'
}
};
});
};
16 changes: 16 additions & 0 deletions vic-bunny/app/js/bunny/directives/thumbbunny-directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = function(app) {
app.directive('thumbBunny', function() {
return {
templateUrl:
'./templates/bunny/thumbbunny-directive.html',
restrict: 'E',
scope: {
title: '@',
link: '@',
height: '@100',
width: '@100',
description: '@'
}
};
});
};
16 changes: 16 additions & 0 deletions vic-bunny/app/js/bunny/directives/vicbunny-directive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = function(app) {
app.directive('vicBunny', function() {
return {
templateUrl:
'./templates/bunny/vicbunny-directive.html',
restrict: 'E',
scope: {
title: '@',
link: '@',
height: '@',
width: '@',
description: '@'
}
};
});
};
4 changes: 4 additions & 0 deletions vic-bunny/app/js/bunny/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = function(app) {
require('./controllers')(app);
require('./directives')(app);
};
4 changes: 4 additions & 0 deletions vic-bunny/app/js/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const angular = require('angular');
const app = angular.module('BunnyApp', []);

require('./bunny')(app);
5 changes: 5 additions & 0 deletions vic-bunny/app/templates/bunny/nobunny-directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
<h1>{{title}}</h1>
<a href="{{link}}">BEWARE VIC BUNNY!</a>
<h3>{{description}}</h3>
</div>
3 changes: 3 additions & 0 deletions vic-bunny/app/templates/bunny/thumbbunny-directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div>
<img src="{{link}}" width="100" height"100" alt="{{title}}">
</div>
5 changes: 5 additions & 0 deletions vic-bunny/app/templates/bunny/vicbunny-directive.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<div>
<h1>{{title}}</h1>
<img src="{{link}}" height="{{height}}" width="{{width}}" alt="{{title}}">
<h3>{{description}}</h3>
</div>
40 changes: 40 additions & 0 deletions vic-bunny/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
'use strict';

const gulp = require('gulp');
const eslint = require('gulp-eslint');
const webpack = require('webpack-stream');

var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/bunny/*.js', './app/js/bunny/controllers/*.js', './app/js/bunny/directives/*.js'];

const paths = {
js:__dirname + '/app/js/**/**/*.js',
html:__dirname + '/app/**/*.html'
};

gulp.task('lint', () => {
return gulp.src(files)
.pipe(eslint())
.pipe(eslint.format());
});

gulp.task('copy', () => {
return gulp.src(paths.html)
.pipe(gulp.dest(__dirname + '/build'));
});

gulp.task('bundle', () => {
return gulp.src(paths.js)
.pipe(webpack({
output: {
filename: 'bundle.js'
}
}))
.pipe(gulp.dest('./build'));
});

gulp.task('default', ['bundle', 'copy']);

gulp.task('watch', () => {
gulp.watch(paths.js, ['lint', 'bundle']);
gulp.watch(paths.html, ['copy']);
});
69 changes: 69 additions & 0 deletions vic-bunny/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Karma configuration
// Generated on Tue Jun 21 2016 21:34:56 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'test/test_bundle.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};
25 changes: 25 additions & 0 deletions vic-bunny/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "vic-bunny",
"version": "1.0.0",
"description": "",
"main": "gulpfile.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"angular": "^1.5.7",
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"webpack-stream": "^3.2.0"
},
"dependencies": {
"express": "^4.14.0"
}
}
7 changes: 7 additions & 0 deletions vic-bunny/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';

const express = require('express');
const app = express();

app.use(express.static(__dirname + '/build'));
app.listen(3002, () => console.log('listening on 3002'));