From f66af7662a1c0d6422186ec08ed54ba278559c10 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 21:24:19 -0700 Subject: [PATCH 01/26] setup foder structure, package.json, and eslintrc --- vic-bunny/.eslintignore | 8 ++++ vic-bunny/.eslintrc | 42 +++++++++++++++++++ vic-bunny/.gitignore | 4 ++ vic-bunny/app/index.html | 0 .../js/bunny/controllers/bunny-controller.js | 0 vic-bunny/app/js/bunny/controllers/index.js | 0 .../js/bunny/directives/bunny-directive.js | 0 vic-bunny/app/js/bunny/directives/index.js | 0 vic-bunny/app/js/bunny/index.js | 0 vic-bunny/app/js/client.js | 0 .../app/templates/bunny/bunny-directive.html | 0 vic-bunny/gulpfile.js | 0 vic-bunny/package.json | 25 +++++++++++ vic-bunny/server.js | 0 14 files changed, 79 insertions(+) create mode 100644 vic-bunny/.eslintignore create mode 100644 vic-bunny/.eslintrc create mode 100644 vic-bunny/.gitignore create mode 100644 vic-bunny/app/index.html create mode 100644 vic-bunny/app/js/bunny/controllers/bunny-controller.js create mode 100644 vic-bunny/app/js/bunny/controllers/index.js create mode 100644 vic-bunny/app/js/bunny/directives/bunny-directive.js create mode 100644 vic-bunny/app/js/bunny/directives/index.js create mode 100644 vic-bunny/app/js/bunny/index.js create mode 100644 vic-bunny/app/js/client.js create mode 100644 vic-bunny/app/templates/bunny/bunny-directive.html create mode 100644 vic-bunny/gulpfile.js create mode 100644 vic-bunny/package.json create mode 100644 vic-bunny/server.js diff --git a/vic-bunny/.eslintignore b/vic-bunny/.eslintignore new file mode 100644 index 0000000..5348393 --- /dev/null +++ b/vic-bunny/.eslintignore @@ -0,0 +1,8 @@ +**/node_modules/* +**/vendor/* +**/build/* +**/*.min.js +*.md +package.json +Procfile +npm-debug.log diff --git a/vic-bunny/.eslintrc b/vic-bunny/.eslintrc new file mode 100644 index 0000000..4d749b1 --- /dev/null +++ b/vic-bunny/.eslintrc @@ -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" +} diff --git a/vic-bunny/.gitignore b/vic-bunny/.gitignore new file mode 100644 index 0000000..88202b0 --- /dev/null +++ b/vic-bunny/.gitignore @@ -0,0 +1,4 @@ +node_modules +build +db +*_bundle.js diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/controllers/bunny-controller.js b/vic-bunny/app/js/bunny/controllers/bunny-controller.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/controllers/index.js b/vic-bunny/app/js/bunny/controllers/index.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/directives/bunny-directive.js b/vic-bunny/app/js/bunny/directives/bunny-directive.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/directives/index.js b/vic-bunny/app/js/bunny/directives/index.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/index.js b/vic-bunny/app/js/bunny/index.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/client.js b/vic-bunny/app/js/client.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/templates/bunny/bunny-directive.html b/vic-bunny/app/templates/bunny/bunny-directive.html new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/package.json b/vic-bunny/package.json new file mode 100644 index 0000000..3fbc649 --- /dev/null +++ b/vic-bunny/package.json @@ -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" + } +} diff --git a/vic-bunny/server.js b/vic-bunny/server.js new file mode 100644 index 0000000..e69de29 From 297d18203a0dc23641fa34ed400757cb9329530b Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 21:31:46 -0700 Subject: [PATCH 02/26] init commit with .gitignore file --- vic-bunny/.gitignore | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 vic-bunny/.gitignore diff --git a/vic-bunny/.gitignore b/vic-bunny/.gitignore new file mode 100644 index 0000000..88202b0 --- /dev/null +++ b/vic-bunny/.gitignore @@ -0,0 +1,4 @@ +node_modules +build +db +*_bundle.js From 1a8dfb4a5a2162ea2df221864cb19abce684d0ec Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 21:36:03 -0700 Subject: [PATCH 03/26] added karma.conf.js, changed single run to true --- vic-bunny/karma.conf.js | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 vic-bunny/karma.conf.js diff --git a/vic-bunny/karma.conf.js b/vic-bunny/karma.conf.js new file mode 100644 index 0000000..01f2aca --- /dev/null +++ b/vic-bunny/karma.conf.js @@ -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 + }); +}; From 26c3484faf1fc16a3ad99d9fc5a7d0a10e52b623 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 21:40:22 -0700 Subject: [PATCH 04/26] added server using express --- vic-bunny/server.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/vic-bunny/server.js b/vic-bunny/server.js index e69de29..dc5d4dc 100644 --- a/vic-bunny/server.js +++ b/vic-bunny/server.js @@ -0,0 +1,6 @@ +'use strict'; + +const express = require('express'); + +express().use(express.static(__dirname + '/build')) +.listen(8080, () => console.log('listening on 8080')); From 58cd64d9f2051772e09366c829227b7fc44f557f Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 21:45:17 -0700 Subject: [PATCH 05/26] updated server with const app to call express --- vic-bunny/server.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vic-bunny/server.js b/vic-bunny/server.js index dc5d4dc..d216dc9 100644 --- a/vic-bunny/server.js +++ b/vic-bunny/server.js @@ -1,6 +1,7 @@ 'use strict'; const express = require('express'); +const app = express(); -express().use(express.static(__dirname + '/build')) -.listen(8080, () => console.log('listening on 8080')); +app.use(express.static(__dirname + '/build')); +app.listen(3002, () => console.log('listening on 3002')); From a56efd5fd8c9af59c50bb55a8b8ddf00614094c9 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 22:01:22 -0700 Subject: [PATCH 06/26] added basic gulpfile --- vic-bunny/gulpfile.js | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js index e69de29..76b328c 100644 --- a/vic-bunny/gulpfile.js +++ b/vic-bunny/gulpfile.js @@ -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/index.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('./app/js/client.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']); +}); From b406d39c97e752b42eafff43dd7af28525a32475 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 22:20:53 -0700 Subject: [PATCH 07/26] client.js setup requiring angular and bunny folder --- vic-bunny/app/js/client.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vic-bunny/app/js/client.js b/vic-bunny/app/js/client.js index e69de29..5f8c0cf 100644 --- a/vic-bunny/app/js/client.js +++ b/vic-bunny/app/js/client.js @@ -0,0 +1,4 @@ +const angular = require('angular'); +const app = angular.module('BunnyApp', []); + +require('./bunny')(app); From 79cd3425aa48bcf3bdcda6dcfd823e9226044e05 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 22:44:16 -0700 Subject: [PATCH 08/26] bunny controller has needed properties --- .../app/js/bunny/controllers/bunny-controller.js | 11 +++++++++++ vic-bunny/app/js/bunny/controllers/index.js | 3 +++ vic-bunny/app/js/bunny/directives/index.js | 5 +++++ .../{bunny-directive.js => nobunny-directive.js} | 0 .../app/js/bunny/directives/thumbbunny-directive.js | 0 .../app/js/bunny/directives/vicbunny-directive.js | 0 vic-bunny/app/js/bunny/index.js | 4 ++++ 7 files changed, 23 insertions(+) rename vic-bunny/app/js/bunny/directives/{bunny-directive.js => nobunny-directive.js} (100%) create mode 100644 vic-bunny/app/js/bunny/directives/thumbbunny-directive.js create mode 100644 vic-bunny/app/js/bunny/directives/vicbunny-directive.js diff --git a/vic-bunny/app/js/bunny/controllers/bunny-controller.js b/vic-bunny/app/js/bunny/controllers/bunny-controller.js index e69de29..dda07be 100644 --- a/vic-bunny/app/js/bunny/controllers/bunny-controller.js +++ b/vic-bunny/app/js/bunny/controllers/bunny-controller.js @@ -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'; + }]); +}; diff --git a/vic-bunny/app/js/bunny/controllers/index.js b/vic-bunny/app/js/bunny/controllers/index.js index e69de29..ba2eb02 100644 --- a/vic-bunny/app/js/bunny/controllers/index.js +++ b/vic-bunny/app/js/bunny/controllers/index.js @@ -0,0 +1,3 @@ +module.exports = function(app) { + require('./bunny-controller')(app); +}; diff --git a/vic-bunny/app/js/bunny/directives/index.js b/vic-bunny/app/js/bunny/directives/index.js index e69de29..1b8165e 100644 --- a/vic-bunny/app/js/bunny/directives/index.js +++ b/vic-bunny/app/js/bunny/directives/index.js @@ -0,0 +1,5 @@ +module.exports = function(app) { + require('./nobunny-directive')(app); + require('./thumbbunny-directive')(app); + require('./vicbunny-directive')(app); +}; diff --git a/vic-bunny/app/js/bunny/directives/bunny-directive.js b/vic-bunny/app/js/bunny/directives/nobunny-directive.js similarity index 100% rename from vic-bunny/app/js/bunny/directives/bunny-directive.js rename to vic-bunny/app/js/bunny/directives/nobunny-directive.js diff --git a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js b/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js b/vic-bunny/app/js/bunny/directives/vicbunny-directive.js new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/js/bunny/index.js b/vic-bunny/app/js/bunny/index.js index e69de29..e7d6cfa 100644 --- a/vic-bunny/app/js/bunny/index.js +++ b/vic-bunny/app/js/bunny/index.js @@ -0,0 +1,4 @@ +module.exports = function(app) { + require('./controllers')(app); + require('./directives')(app); +}; From 190344008e9f987d2746c0f9555e68ef80c8edb5 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:01:08 -0700 Subject: [PATCH 09/26] noBunny directive added to include only title link and description --- .../app/js/bunny/directives/nobunny-directive.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/vic-bunny/app/js/bunny/directives/nobunny-directive.js b/vic-bunny/app/js/bunny/directives/nobunny-directive.js index e69de29..2710bf3 100644 --- a/vic-bunny/app/js/bunny/directives/nobunny-directive.js +++ b/vic-bunny/app/js/bunny/directives/nobunny-directive.js @@ -0,0 +1,14 @@ +module.exports = function(app) { + app.directive('noBunny', function() { + return { + templateUrl: + './templates/bunny/bunny-directive.html', + restrict: 'E', + scope: { + title: '@', + link: '@', + description: '@' + } + }; + }); +}; From 7ce41a7fc774dd895ac55aa59520d1869ee5edbb Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:11:13 -0700 Subject: [PATCH 10/26] created template html files for each directive, thumbbunny directive has appropriate scope --- .../app/js/bunny/directives/nobunny-directive.js | 2 +- .../js/bunny/directives/thumbbunny-directive.js | 16 ++++++++++++++++ ...nny-directive.html => nobunny-directive.html} | 0 .../templates/bunny/thumbbunny-directive.html | 0 .../app/templates/bunny/vicbunny-directive.html | 0 5 files changed, 17 insertions(+), 1 deletion(-) rename vic-bunny/app/templates/bunny/{bunny-directive.html => nobunny-directive.html} (100%) create mode 100644 vic-bunny/app/templates/bunny/thumbbunny-directive.html create mode 100644 vic-bunny/app/templates/bunny/vicbunny-directive.html diff --git a/vic-bunny/app/js/bunny/directives/nobunny-directive.js b/vic-bunny/app/js/bunny/directives/nobunny-directive.js index 2710bf3..d11d39a 100644 --- a/vic-bunny/app/js/bunny/directives/nobunny-directive.js +++ b/vic-bunny/app/js/bunny/directives/nobunny-directive.js @@ -2,7 +2,7 @@ module.exports = function(app) { app.directive('noBunny', function() { return { templateUrl: - './templates/bunny/bunny-directive.html', + './templates/bunny/nobunny-directive.html', restrict: 'E', scope: { title: '@', diff --git a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js b/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js index e69de29..5b64fa2 100644 --- a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js +++ b/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js @@ -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: '@' + } + }; + }); +}; diff --git a/vic-bunny/app/templates/bunny/bunny-directive.html b/vic-bunny/app/templates/bunny/nobunny-directive.html similarity index 100% rename from vic-bunny/app/templates/bunny/bunny-directive.html rename to vic-bunny/app/templates/bunny/nobunny-directive.html diff --git a/vic-bunny/app/templates/bunny/thumbbunny-directive.html b/vic-bunny/app/templates/bunny/thumbbunny-directive.html new file mode 100644 index 0000000..e69de29 diff --git a/vic-bunny/app/templates/bunny/vicbunny-directive.html b/vic-bunny/app/templates/bunny/vicbunny-directive.html new file mode 100644 index 0000000..e69de29 From ac8921235678143ff9fd510fa922ee864f3b89ef Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:16:35 -0700 Subject: [PATCH 11/26] vicbunny directive complete with full size image --- .../js/bunny/directives/vicbunny-directive.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js b/vic-bunny/app/js/bunny/directives/vicbunny-directive.js index e69de29..1fdf676 100644 --- a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js +++ b/vic-bunny/app/js/bunny/directives/vicbunny-directive.js @@ -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: '@' + } + }; + }); +}; From e50a1d9d3ea034c4f2d7f87596fa2c2b19bb6c7c Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:28:00 -0700 Subject: [PATCH 12/26] nobunny directive html template created --- vic-bunny/app/templates/bunny/nobunny-directive.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/vic-bunny/app/templates/bunny/nobunny-directive.html b/vic-bunny/app/templates/bunny/nobunny-directive.html index e69de29..61174fa 100644 --- a/vic-bunny/app/templates/bunny/nobunny-directive.html +++ b/vic-bunny/app/templates/bunny/nobunny-directive.html @@ -0,0 +1,5 @@ +
+

{{title}}

+ BEWARE VIC BUNNY! +

{{description}}

+
From 47a6ef2028a858ac2a2eec230496018bcb23a9b4 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:34:05 -0700 Subject: [PATCH 13/26] finished directive html templates --- vic-bunny/app/templates/bunny/thumbbunny-directive.html | 3 +++ vic-bunny/app/templates/bunny/vicbunny-directive.html | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/vic-bunny/app/templates/bunny/thumbbunny-directive.html b/vic-bunny/app/templates/bunny/thumbbunny-directive.html index e69de29..752be82 100644 --- a/vic-bunny/app/templates/bunny/thumbbunny-directive.html +++ b/vic-bunny/app/templates/bunny/thumbbunny-directive.html @@ -0,0 +1,3 @@ +
+ {{title}} +
diff --git a/vic-bunny/app/templates/bunny/vicbunny-directive.html b/vic-bunny/app/templates/bunny/vicbunny-directive.html index e69de29..8ad1caf 100644 --- a/vic-bunny/app/templates/bunny/vicbunny-directive.html +++ b/vic-bunny/app/templates/bunny/vicbunny-directive.html @@ -0,0 +1,5 @@ +
+

{{title}}

+ {{title}} +

{{description}}

+
From 87329548d0b80261094df4fd9ff2bf57b87cd6ba Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Tue, 21 Jun 2016 23:50:00 -0700 Subject: [PATCH 14/26] index.html complete! --- vic-bunny/app/index.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html index e69de29..3493dc1 100644 --- a/vic-bunny/app/index.html +++ b/vic-bunny/app/index.html @@ -0,0 +1,18 @@ + + + + + + + Bunny App + + + +
+ + + +
+ + + From 81e5912c961465c89be9d2f459ff72786212eed2 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Wed, 22 Jun 2016 00:10:09 -0700 Subject: [PATCH 15/26] now bundling all html files! --- vic-bunny/app/index.html | 2 +- vic-bunny/gulpfile.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html index 3493dc1..2e44b72 100644 --- a/vic-bunny/app/index.html +++ b/vic-bunny/app/index.html @@ -5,7 +5,7 @@ Bunny App - +
diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js index 76b328c..bc498a0 100644 --- a/vic-bunny/gulpfile.js +++ b/vic-bunny/gulpfile.js @@ -8,7 +8,7 @@ var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/bunny/*.js', './ap const paths = { js:__dirname + '/app/js/**/**/*.js', - html:__dirname + '/app/index.html' + html:__dirname + '/app/**/*.html' }; gulp.task('lint', () => { @@ -23,7 +23,7 @@ gulp.task('copy', () => { }); gulp.task('bundle', () => { - return gulp.src('./app/js/client.js') + return gulp.src(paths.js) .pipe(webpack({ output: { filename: 'bundle.js' From 3eb40cfd9c8a62e0bd640c31f2d6346f0ce73f4f Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Wed, 22 Jun 2016 10:37:57 -0700 Subject: [PATCH 16/26] renamed folders and changed appropriate files for better readability --- vic-bunny/app/index.html | 10 +++++----- vic-bunny/app/js/bunny/directives/index.js | 5 ----- vic-bunny/app/js/client.js | 4 ++-- .../controllers/bunny-controller.js | 0 .../app/js/{bunny => photoalbum}/controllers/index.js | 0 .../directives/fullsize-directive.js} | 4 ++-- vic-bunny/app/js/photoalbum/directives/index.js | 5 +++++ .../directives/textonly-directive.js} | 4 ++-- .../directives/thumbsize-directive.js} | 4 ++-- vic-bunny/app/js/{bunny => photoalbum}/index.js | 0 .../fullsize-directive.html} | 0 .../textonly-directive.html} | 0 .../thumbsize-directive.html} | 0 vic-bunny/gulpfile.js | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 vic-bunny/app/js/bunny/directives/index.js rename vic-bunny/app/js/{bunny => photoalbum}/controllers/bunny-controller.js (100%) rename vic-bunny/app/js/{bunny => photoalbum}/controllers/index.js (100%) rename vic-bunny/app/js/{bunny/directives/vicbunny-directive.js => photoalbum/directives/fullsize-directive.js} (70%) create mode 100644 vic-bunny/app/js/photoalbum/directives/index.js rename vic-bunny/app/js/{bunny/directives/nobunny-directive.js => photoalbum/directives/textonly-directive.js} (66%) rename vic-bunny/app/js/{bunny/directives/thumbbunny-directive.js => photoalbum/directives/thumbsize-directive.js} (70%) rename vic-bunny/app/js/{bunny => photoalbum}/index.js (100%) rename vic-bunny/app/templates/{bunny/vicbunny-directive.html => photoalbum/fullsize-directive.html} (100%) rename vic-bunny/app/templates/{bunny/nobunny-directive.html => photoalbum/textonly-directive.html} (100%) rename vic-bunny/app/templates/{bunny/thumbbunny-directive.html => photoalbum/thumbsize-directive.html} (100%) diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html index 2e44b72..36d2b67 100644 --- a/vic-bunny/app/index.html +++ b/vic-bunny/app/index.html @@ -4,14 +4,14 @@ - Bunny App + Photo Album - +
- - - + + +
diff --git a/vic-bunny/app/js/bunny/directives/index.js b/vic-bunny/app/js/bunny/directives/index.js deleted file mode 100644 index 1b8165e..0000000 --- a/vic-bunny/app/js/bunny/directives/index.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = function(app) { - require('./nobunny-directive')(app); - require('./thumbbunny-directive')(app); - require('./vicbunny-directive')(app); -}; diff --git a/vic-bunny/app/js/client.js b/vic-bunny/app/js/client.js index 5f8c0cf..8089246 100644 --- a/vic-bunny/app/js/client.js +++ b/vic-bunny/app/js/client.js @@ -1,4 +1,4 @@ const angular = require('angular'); -const app = angular.module('BunnyApp', []); +const app = angular.module('PhotoAlbum', []); -require('./bunny')(app); +require('./photoalbum')(app); diff --git a/vic-bunny/app/js/bunny/controllers/bunny-controller.js b/vic-bunny/app/js/photoalbum/controllers/bunny-controller.js similarity index 100% rename from vic-bunny/app/js/bunny/controllers/bunny-controller.js rename to vic-bunny/app/js/photoalbum/controllers/bunny-controller.js diff --git a/vic-bunny/app/js/bunny/controllers/index.js b/vic-bunny/app/js/photoalbum/controllers/index.js similarity index 100% rename from vic-bunny/app/js/bunny/controllers/index.js rename to vic-bunny/app/js/photoalbum/controllers/index.js diff --git a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js b/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js similarity index 70% rename from vic-bunny/app/js/bunny/directives/vicbunny-directive.js rename to vic-bunny/app/js/photoalbum/directives/fullsize-directive.js index 1fdf676..8f2cb04 100644 --- a/vic-bunny/app/js/bunny/directives/vicbunny-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js @@ -1,8 +1,8 @@ module.exports = function(app) { - app.directive('vicBunny', function() { + app.directive('fullSize', function() { return { templateUrl: - './templates/bunny/vicbunny-directive.html', + './templates/photoalbum/fullsize-directive.html', restrict: 'E', scope: { title: '@', diff --git a/vic-bunny/app/js/photoalbum/directives/index.js b/vic-bunny/app/js/photoalbum/directives/index.js new file mode 100644 index 0000000..b6ef279 --- /dev/null +++ b/vic-bunny/app/js/photoalbum/directives/index.js @@ -0,0 +1,5 @@ +module.exports = function(app) { + require('./textonly-directive')(app); + require('./thumbsize-directive')(app); + require('./fullsize-directive')(app); +}; diff --git a/vic-bunny/app/js/bunny/directives/nobunny-directive.js b/vic-bunny/app/js/photoalbum/directives/textonly-directive.js similarity index 66% rename from vic-bunny/app/js/bunny/directives/nobunny-directive.js rename to vic-bunny/app/js/photoalbum/directives/textonly-directive.js index d11d39a..7094a36 100644 --- a/vic-bunny/app/js/bunny/directives/nobunny-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/textonly-directive.js @@ -1,8 +1,8 @@ module.exports = function(app) { - app.directive('noBunny', function() { + app.directive('textOnly', function() { return { templateUrl: - './templates/bunny/nobunny-directive.html', + './templates/photoalbum/textonly-directive.html', restrict: 'E', scope: { title: '@', diff --git a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js b/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js similarity index 70% rename from vic-bunny/app/js/bunny/directives/thumbbunny-directive.js rename to vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js index 5b64fa2..3771f1c 100644 --- a/vic-bunny/app/js/bunny/directives/thumbbunny-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js @@ -1,8 +1,8 @@ module.exports = function(app) { - app.directive('thumbBunny', function() { + app.directive('thumbSize', function() { return { templateUrl: - './templates/bunny/thumbbunny-directive.html', + './templates/photoalbum/thumbsize-directive.html', restrict: 'E', scope: { title: '@', diff --git a/vic-bunny/app/js/bunny/index.js b/vic-bunny/app/js/photoalbum/index.js similarity index 100% rename from vic-bunny/app/js/bunny/index.js rename to vic-bunny/app/js/photoalbum/index.js diff --git a/vic-bunny/app/templates/bunny/vicbunny-directive.html b/vic-bunny/app/templates/photoalbum/fullsize-directive.html similarity index 100% rename from vic-bunny/app/templates/bunny/vicbunny-directive.html rename to vic-bunny/app/templates/photoalbum/fullsize-directive.html diff --git a/vic-bunny/app/templates/bunny/nobunny-directive.html b/vic-bunny/app/templates/photoalbum/textonly-directive.html similarity index 100% rename from vic-bunny/app/templates/bunny/nobunny-directive.html rename to vic-bunny/app/templates/photoalbum/textonly-directive.html diff --git a/vic-bunny/app/templates/bunny/thumbbunny-directive.html b/vic-bunny/app/templates/photoalbum/thumbsize-directive.html similarity index 100% rename from vic-bunny/app/templates/bunny/thumbbunny-directive.html rename to vic-bunny/app/templates/photoalbum/thumbsize-directive.html diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js index bc498a0..79c9edf 100644 --- a/vic-bunny/gulpfile.js +++ b/vic-bunny/gulpfile.js @@ -4,7 +4,7 @@ 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']; +var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/photoalbum/*.js', './app/js/photoalbum/controllers/*.js', './app/js/photoalbum/directives/*.js']; const paths = { js:__dirname + '/app/js/**/**/*.js', From e00a1d7459a34f56611dda45b3f6b71c54ff4937 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Wed, 22 Jun 2016 23:20:08 -0700 Subject: [PATCH 17/26] renamed folders to be album related, added photoalbum controller --- vic-bunny/app/js/client.js | 2 + .../app/js/photoalbum/controllers/index.js | 1 + .../controllers/photoalbum-controller.js | 64 +++++++++++++++++++ .../app/js/photoalbum/directives/index.js | 1 + .../directives/photoalbum-directive.js | 14 ++++ .../photoalbum/photoalbum-directive.html | 5 ++ .../photoalbum/thumbsize-directive.html | 2 +- 7 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 vic-bunny/app/js/photoalbum/controllers/photoalbum-controller.js create mode 100644 vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js create mode 100644 vic-bunny/app/templates/photoalbum/photoalbum-directive.html diff --git a/vic-bunny/app/js/client.js b/vic-bunny/app/js/client.js index 8089246..52886e7 100644 --- a/vic-bunny/app/js/client.js +++ b/vic-bunny/app/js/client.js @@ -1,3 +1,5 @@ +'use strict'; + const angular = require('angular'); const app = angular.module('PhotoAlbum', []); diff --git a/vic-bunny/app/js/photoalbum/controllers/index.js b/vic-bunny/app/js/photoalbum/controllers/index.js index ba2eb02..5b7e9e9 100644 --- a/vic-bunny/app/js/photoalbum/controllers/index.js +++ b/vic-bunny/app/js/photoalbum/controllers/index.js @@ -1,3 +1,4 @@ module.exports = function(app) { require('./bunny-controller')(app); + require('./photoalbum-controller')(app); }; diff --git a/vic-bunny/app/js/photoalbum/controllers/photoalbum-controller.js b/vic-bunny/app/js/photoalbum/controllers/photoalbum-controller.js new file mode 100644 index 0000000..ac23cee --- /dev/null +++ b/vic-bunny/app/js/photoalbum/controllers/photoalbum-controller.js @@ -0,0 +1,64 @@ +'use strict'; + +module.exports = function(app) { + app.controller('PhotoAlbumController', PhotoAlbumController); + + function PhotoAlbumController() { + this.weimeraners = { + title: 'Weimeraner Puppies Photo Album', + description: 'Weimeraners are adorable!', + photos: [ + { + url:'https://www.greenfieldpuppies.com/wp-content/plugins/gfp/images/big/pup_x_1371865636_0.jpg', + alt:'Adorable Weimeraner 1' + }, + { + url:'http://tracieblue.com/last_litter/Blue%20Weimaraner%20Puppy%20Pink%201.jpg', + alt:'Adorable Weimeraner 2' + }, + { + url:'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTJxJ1p4MBzwQBU6h3GFmieJOdfydtFhymksj4mCnE0FJwAij33rA', + alt:'Adorable Weimeraner 3' + } + ] + }; + + this.piglets = { + title: 'Piglets Photo Album', + description: 'Piglets are too cute!', + photos: [ + { + url:'http://www.tehcute.com/pics/201307/piglet-keeping-cool.jpg', + alt:'Too Cute Piglet 1' + }, + { + url:'https://c2.staticflickr.com/6/5019/5476287563_ee1ab67638_z.jpg', + alt:'Too Cute Piglet 2' + }, + { + url:'http://justcuteanimals.com/wp-content/uploads/2014/09/cute-piglet-animal-pictures-pigs-piggies-pics.jpg', + alt:'Too Cute Piglet 3' + } + ] + }; + + this.hedgehogs = { + title: 'Hedgehogs Photo Album', + description: 'Hedgehogs are Adorable!', + photos: [ + { + url:'https://s-media-cache-ak0.pinimg.com/236x/d5/65/75/d56575af0463fff19dc043545edceced.jpg', + alt:'Adorable Hedgehog 1' + }, + { + url:'http://justcuteanimals.com/wp-content/uploads/2012/11/cute-animal-skateboard-baby-hedgehog-table-pics.jpg', + alt:'Adorable Hedgehog 2' + }, + { + url:'http://40.media.tumblr.com/1e0315765429e4d2e5315a86bb176e02/tumblr_nmxdzmT3QD1ura9vuo1_500.jpg', + alt:'Adorable Hedgehog 3' + } + ] + }; + } +}; diff --git a/vic-bunny/app/js/photoalbum/directives/index.js b/vic-bunny/app/js/photoalbum/directives/index.js index b6ef279..d80fa29 100644 --- a/vic-bunny/app/js/photoalbum/directives/index.js +++ b/vic-bunny/app/js/photoalbum/directives/index.js @@ -2,4 +2,5 @@ module.exports = function(app) { require('./textonly-directive')(app); require('./thumbsize-directive')(app); require('./fullsize-directive')(app); + require('./photoalbum-directive')(app); }; diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js new file mode 100644 index 0000000..e4d0955 --- /dev/null +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -0,0 +1,14 @@ +module.exports = function(app) { + app.directive('photoAlbum', function() { + return { + templateUrl: + './templates/photoalbum/photoalbum-directive.html', + restrict: 'E', + scope: { + title: '=', + link: '=', + description: '=' + } + }; + }); +}; diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html new file mode 100644 index 0000000..3bcf314 --- /dev/null +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -0,0 +1,5 @@ +
+

{{title}}

+ Photo Album +

{{description}}

+
diff --git a/vic-bunny/app/templates/photoalbum/thumbsize-directive.html b/vic-bunny/app/templates/photoalbum/thumbsize-directive.html index 752be82..e2a63a1 100644 --- a/vic-bunny/app/templates/photoalbum/thumbsize-directive.html +++ b/vic-bunny/app/templates/photoalbum/thumbsize-directive.html @@ -1,3 +1,3 @@
- {{title}} + {{title}}
From 06436005a3a302d7347e4fb4a827fa709dc499bf Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Wed, 22 Jun 2016 23:47:07 -0700 Subject: [PATCH 18/26] updated photoalbum directive, still need to work on controller property --- .../photoalbum/directives/photoalbum-directive.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js index e4d0955..81df83c 100644 --- a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -5,9 +5,16 @@ module.exports = function(app) { './templates/photoalbum/photoalbum-directive.html', restrict: 'E', scope: { - title: '=', - link: '=', - description: '=' + title: '@', + description: '@', + photos: '=' + }, + + controller:function($scope) { + $scope.changeView = function() { + console.log($scope.mode); + }; + } }; }); From da98e89ebafec9f0cbf76e9e33c0a487f6ae679e Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 01:06:21 -0700 Subject: [PATCH 19/26] photoalbum directivejs added showthumb function and photoalbum directive html --- .../photoalbum/directives/photoalbum-directive.js | 11 ++++++++++- .../templates/photoalbum/photoalbum-directive.html | 14 +++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js index 81df83c..b5e2f71 100644 --- a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -14,7 +14,16 @@ module.exports = function(app) { $scope.changeView = function() { console.log($scope.mode); }; - + + $scope.showThumb = function(photo) { + if(!photo) { + $scope.mode = 'text'; + return; + } + + $scope.currentPhoto = photo; + $scope.mode = 'thumb'; + }; } }; }); diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index 3bcf314..e3bda2e 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -1,5 +1,13 @@
-

{{title}}

- Photo Album -

{{description}}

+
    + +
+
    + +
+
    + +
+ +
From b0314f1c7bc17329dfe5b1841c8c13521d4ea33c Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 01:55:36 -0700 Subject: [PATCH 20/26] still working on display, directives adjusted to show correct url --- vic-bunny/app/index.html | 8 ++++---- .../app/templates/photoalbum/fullsize-directive.html | 8 +++----- .../app/templates/photoalbum/photoalbum-directive.html | 8 ++++---- .../app/templates/photoalbum/textonly-directive.html | 5 ++--- .../app/templates/photoalbum/thumbsize-directive.html | 6 +++--- 5 files changed, 16 insertions(+), 19 deletions(-) diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html index 36d2b67..38736e5 100644 --- a/vic-bunny/app/index.html +++ b/vic-bunny/app/index.html @@ -8,10 +8,10 @@ -
- - - +
+ + +
diff --git a/vic-bunny/app/templates/photoalbum/fullsize-directive.html b/vic-bunny/app/templates/photoalbum/fullsize-directive.html index 8ad1caf..41b3866 100644 --- a/vic-bunny/app/templates/photoalbum/fullsize-directive.html +++ b/vic-bunny/app/templates/photoalbum/fullsize-directive.html @@ -1,5 +1,3 @@ -
-

{{title}}

- {{title}} -

{{description}}

-
+
  • + {{alt}} +
  • diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index e3bda2e..3471425 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -1,13 +1,13 @@
    -
      +
      -
        +
        - - + +
    diff --git a/vic-bunny/app/templates/photoalbum/textonly-directive.html b/vic-bunny/app/templates/photoalbum/textonly-directive.html index 61174fa..61bba8d 100644 --- a/vic-bunny/app/templates/photoalbum/textonly-directive.html +++ b/vic-bunny/app/templates/photoalbum/textonly-directive.html @@ -1,5 +1,4 @@ -
    +
  • {{title}}

    - BEWARE VIC BUNNY!

    {{description}}

    -
  • + diff --git a/vic-bunny/app/templates/photoalbum/thumbsize-directive.html b/vic-bunny/app/templates/photoalbum/thumbsize-directive.html index e2a63a1..80740a3 100644 --- a/vic-bunny/app/templates/photoalbum/thumbsize-directive.html +++ b/vic-bunny/app/templates/photoalbum/thumbsize-directive.html @@ -1,3 +1,3 @@ -
    - {{title}} -
    +
  • + {{alt}} +
  • From 97b13f90a656253830fd892e1838e6e0dd6e724c Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 09:54:43 -0700 Subject: [PATCH 21/26] fixed full and thumb directives so photos appear --- .../app/js/photoalbum/directives/fullsize-directive.js | 7 ++----- .../js/photoalbum/directives/thumbsize-directive.js | 7 ++----- .../app/templates/photoalbum/fullsize-directive.html | 2 +- .../app/templates/photoalbum/photoalbum-directive.html | 10 +++++----- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js b/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js index 8f2cb04..8fa81f5 100644 --- a/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/fullsize-directive.js @@ -5,11 +5,8 @@ module.exports = function(app) { './templates/photoalbum/fullsize-directive.html', restrict: 'E', scope: { - title: '@', - link: '@', - height: '@', - width: '@', - description: '@' + url: '=', + alt: '=' } }; }); diff --git a/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js b/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js index 3771f1c..de9f33a 100644 --- a/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/thumbsize-directive.js @@ -5,11 +5,8 @@ module.exports = function(app) { './templates/photoalbum/thumbsize-directive.html', restrict: 'E', scope: { - title: '@', - link: '@', - height: '@100', - width: '@100', - description: '@' + url: '=', + alt: '=' } }; }); diff --git a/vic-bunny/app/templates/photoalbum/fullsize-directive.html b/vic-bunny/app/templates/photoalbum/fullsize-directive.html index 41b3866..ad2d0a1 100644 --- a/vic-bunny/app/templates/photoalbum/fullsize-directive.html +++ b/vic-bunny/app/templates/photoalbum/fullsize-directive.html @@ -1,3 +1,3 @@
  • - {{alt}} + {{alt}}
  • diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index 3471425..8efd59e 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -1,13 +1,13 @@
    -
      +
      -
        +
          - +
        - - + +
    From 40674f4122e097a410169171d100af093e3d98d4 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 11:34:55 -0700 Subject: [PATCH 22/26] radio buttons working!, still need to click on thumb to get full image --- .../js/photoalbum/directives/photoalbum-directive.js | 1 + .../app/templates/photoalbum/photoalbum-directive.html | 10 +++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js index b5e2f71..6b170b6 100644 --- a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -11,6 +11,7 @@ module.exports = function(app) { }, controller:function($scope) { + $scope.mode = 'text'; $scope.changeView = function() { console.log($scope.mode); }; diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index 8efd59e..8723019 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -1,13 +1,13 @@
    -
      +
      -
        +
          - +
        - - + +
    From 39cbc2f5418dd858257a512e2ec7fea1121bb913 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 12:14:12 -0700 Subject: [PATCH 23/26] added css to remove bullets, can click thumb to get full image --- vic-bunny/app/css/app.css | 3 +++ vic-bunny/app/index.html | 2 +- .../photoalbum/directives/photoalbum-directive.js | 4 ++-- .../photoalbum/photoalbum-directive.html | 4 ++-- vic-bunny/gulpfile.js | 15 +++++++++++---- 5 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 vic-bunny/app/css/app.css diff --git a/vic-bunny/app/css/app.css b/vic-bunny/app/css/app.css new file mode 100644 index 0000000..391b722 --- /dev/null +++ b/vic-bunny/app/css/app.css @@ -0,0 +1,3 @@ +ul { + list-style-type: none; +} diff --git a/vic-bunny/app/index.html b/vic-bunny/app/index.html index 38736e5..7612c4f 100644 --- a/vic-bunny/app/index.html +++ b/vic-bunny/app/index.html @@ -5,7 +5,7 @@ Photo Album - +
    diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js index 6b170b6..a7e2b4e 100644 --- a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -16,14 +16,14 @@ module.exports = function(app) { console.log($scope.mode); }; - $scope.showThumb = function(photo) { + $scope.showThumbAsFull = function(photo) { if(!photo) { $scope.mode = 'text'; return; } $scope.currentPhoto = photo; - $scope.mode = 'thumb'; + $scope.mode = 'full'; }; } }; diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index 8723019..eb2145a 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -3,10 +3,10 @@
      - +
      - +
    diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js index 79c9edf..c8db361 100644 --- a/vic-bunny/gulpfile.js +++ b/vic-bunny/gulpfile.js @@ -8,7 +8,8 @@ var files = ['*.js', './app/*.js', './app/js/*.js', './app/js/photoalbum/*.js', const paths = { js:__dirname + '/app/js/**/**/*.js', - html:__dirname + '/app/**/*.html' + html:__dirname + '/app/**/*.html', + css:__dirname + '/app/css/*.css' }; gulp.task('lint', () => { @@ -17,11 +18,16 @@ gulp.task('lint', () => { .pipe(eslint.format()); }); -gulp.task('copy', () => { +gulp.task('copy-html', () => { return gulp.src(paths.html) .pipe(gulp.dest(__dirname + '/build')); }); +gulp.task('copy-css', () => { + return gulp.src(paths.css) + .pipe(gulp.dest(__dirname + '/build')); +}); + gulp.task('bundle', () => { return gulp.src(paths.js) .pipe(webpack({ @@ -32,9 +38,10 @@ gulp.task('bundle', () => { .pipe(gulp.dest('./build')); }); -gulp.task('default', ['bundle', 'copy']); +gulp.task('default', ['bundle', 'copy-html', 'copy-css']); gulp.task('watch', () => { gulp.watch(paths.js, ['lint', 'bundle']); - gulp.watch(paths.html, ['copy']); + gulp.watch(paths.html, ['copy-html']); + gulp.watch(paths.css, ['copy-css']); }); From 49613c31e2b6cc419dad86567634224d91e9aa0f Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 16:06:51 -0700 Subject: [PATCH 24/26] updated package.json to start on server.js, added some css styling --- vic-bunny/app/css/app.css | 21 +++++++++++++++++++ .../directives/photoalbum-directive.js | 2 +- .../photoalbum/photoalbum-directive.html | 2 +- vic-bunny/package.json | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/vic-bunny/app/css/app.css b/vic-bunny/app/css/app.css index 391b722..45c2a3c 100644 --- a/vic-bunny/app/css/app.css +++ b/vic-bunny/app/css/app.css @@ -1,3 +1,24 @@ +body { + background-color: #777777; +} + ul { list-style-type: none; + background-color: #87CEEB; + margin: 5px, 0px, 5px, 0px; + width: 60%; + padding: 0px, 20px, 0px, 20px; +} + +li { + display: inline-block; +} + +img { + border: 4px solid #333333; + margin-top: 3px; +} + +img:hover { + transform: scale(1.1); } diff --git a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js index a7e2b4e..a6ecc90 100644 --- a/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js +++ b/vic-bunny/app/js/photoalbum/directives/photoalbum-directive.js @@ -18,7 +18,7 @@ module.exports = function(app) { $scope.showThumbAsFull = function(photo) { if(!photo) { - $scope.mode = 'text'; + $scope.mode = 'thumb'; return; } diff --git a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html index eb2145a..7fcfab6 100644 --- a/vic-bunny/app/templates/photoalbum/photoalbum-directive.html +++ b/vic-bunny/app/templates/photoalbum/photoalbum-directive.html @@ -6,7 +6,7 @@
      - +
    diff --git a/vic-bunny/package.json b/vic-bunny/package.json index 3fbc649..0edf132 100644 --- a/vic-bunny/package.json +++ b/vic-bunny/package.json @@ -8,7 +8,7 @@ }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "start": "node server.js" + "start": "server.js" }, "keywords": [], "author": "", From aeead25b51d84bb241cd0a4c2c5a6b05d880eab4 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 23:33:54 -0700 Subject: [PATCH 25/26] added mytest directive js and html for testing and test file --- .../app/js/photoalbum/directives/mytest.js | 11 +++++ .../app/templates/photoalbum/mytest.html | 3 ++ vic-bunny/test/directive-test.js | 41 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 vic-bunny/app/js/photoalbum/directives/mytest.js create mode 100644 vic-bunny/app/templates/photoalbum/mytest.html create mode 100644 vic-bunny/test/directive-test.js diff --git a/vic-bunny/app/js/photoalbum/directives/mytest.js b/vic-bunny/app/js/photoalbum/directives/mytest.js new file mode 100644 index 0000000..4b662f0 --- /dev/null +++ b/vic-bunny/app/js/photoalbum/directives/mytest.js @@ -0,0 +1,11 @@ +module.exports = function(app) { + app.directive('myTest', function() { + return { + templateUrl: './templates/photoalbum/mytest.html', + scope: { + data: '=' + }, + replace: true + }; + }); +}; diff --git a/vic-bunny/app/templates/photoalbum/mytest.html b/vic-bunny/app/templates/photoalbum/mytest.html new file mode 100644 index 0000000..f6aa025 --- /dev/null +++ b/vic-bunny/app/templates/photoalbum/mytest.html @@ -0,0 +1,3 @@ +
    +

    {{data}}

    +
    diff --git a/vic-bunny/test/directive-test.js b/vic-bunny/test/directive-test.js new file mode 100644 index 0000000..c3c5bb9 --- /dev/null +++ b/vic-bunny/test/directive-test.js @@ -0,0 +1,41 @@ +'use strict'; + +const angular = require('angular'); +require('angular-mocks'); +require('../app/js/client'); + +const myTestTemplate = require('../app/templates/photoalbum/mytest.html'); +// const photoAlbumTemplate = require('../app/templates/photoalbum/photoalbum-directive.html'); +// const fullSizeTemplate = require('../app/templates/photoalbum/fullsize-directive.html'); +// const thumbSizeTemplate = require('../app/templates/photoalbum/thumbsize-directive.html'); +// const textOnlyTemplate = require('../app/templates/photoalbum/textonly-directive.html'); + +describe('directive tests', () => { + let $httpBackend; + let $scope; + let $compile; + + before(() => { + angular.mock.module('PhotoAlbum'); + angular.mock.inject(function(_$httpBackend_, $rootScope, _$compile_) { + $scope = $rootScope.$new(); + $compile = _$compile_; + $httpBackend = _$httpBackend_; + }); + }); + + it('should be my-test directive', () => { + $httpBackend.expectGET('./template/photoalbum/mytest.html') + .respond(200, myTestTemplate); + $scope.test = 'test data'; + let link = $compile(''); + let directive = link($scope); + $scope.$digest(); + $httpBackend.flush(); + + let h2 = directive.find('h2'); + let text = h2.text(); + + expect(text).toBe('test data'); + }); +}); From b6b966c9d97b0d760b5f2491f63fc0917c199c33 Mon Sep 17 00:00:00 2001 From: Victor Benavente Date: Thu, 23 Jun 2016 23:58:29 -0700 Subject: [PATCH 26/26] updated package.json updated gulpfile to create test bundle, required mytest in directives index --- vic-bunny/app/js/photoalbum/directives/index.js | 1 + vic-bunny/gulpfile.js | 15 +++++++++++++++ vic-bunny/package.json | 4 ++++ vic-bunny/test/directive-test.js | 4 ++-- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/vic-bunny/app/js/photoalbum/directives/index.js b/vic-bunny/app/js/photoalbum/directives/index.js index d80fa29..81e9215 100644 --- a/vic-bunny/app/js/photoalbum/directives/index.js +++ b/vic-bunny/app/js/photoalbum/directives/index.js @@ -3,4 +3,5 @@ module.exports = function(app) { require('./thumbsize-directive')(app); require('./fullsize-directive')(app); require('./photoalbum-directive')(app); + require('./mytest')(app); }; diff --git a/vic-bunny/gulpfile.js b/vic-bunny/gulpfile.js index c8db361..8632d29 100644 --- a/vic-bunny/gulpfile.js +++ b/vic-bunny/gulpfile.js @@ -38,6 +38,21 @@ gulp.task('bundle', () => { .pipe(gulp.dest('./build')); }); +gulp.task('bundle:test', () => { + return gulp.src('./test/**/*-test.js') + .pipe(webpack({ + output:{ + filename: 'test_bundle.js' + }, + module: { + loaders: [{ + test: /\.html$/, + loader: 'html' + }] + } + })).pipe(gulp.dest('./test')); +}); + gulp.task('default', ['bundle', 'copy-html', 'copy-css']); gulp.task('watch', () => { diff --git a/vic-bunny/package.json b/vic-bunny/package.json index 0edf132..8273b8b 100644 --- a/vic-bunny/package.json +++ b/vic-bunny/package.json @@ -15,8 +15,12 @@ "license": "ISC", "devDependencies": { "angular": "^1.5.7", + "angular-mocks": "^1.5.7", "gulp": "^3.9.1", "gulp-eslint": "^2.0.0", + "html-loader": "^0.4.3", + "jasmine-core": "^2.4.1", + "karma-chrome-launcher": "^1.0.1", "webpack-stream": "^3.2.0" }, "dependencies": { diff --git a/vic-bunny/test/directive-test.js b/vic-bunny/test/directive-test.js index c3c5bb9..065433c 100644 --- a/vic-bunny/test/directive-test.js +++ b/vic-bunny/test/directive-test.js @@ -15,7 +15,7 @@ describe('directive tests', () => { let $scope; let $compile; - before(() => { + beforeEach(() => { angular.mock.module('PhotoAlbum'); angular.mock.inject(function(_$httpBackend_, $rootScope, _$compile_) { $scope = $rootScope.$new(); @@ -25,7 +25,7 @@ describe('directive tests', () => { }); it('should be my-test directive', () => { - $httpBackend.expectGET('./template/photoalbum/mytest.html') + $httpBackend.expectGET('./templates/photoalbum/mytest.html') .respond(200, myTestTemplate); $scope.test = 'test data'; let link = $compile('');