From 1757fa1cf452368130f88f7ab170d90423b0eeb7 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Tue, 21 Jun 2016 01:55:01 -0700 Subject: [PATCH 1/9] wrote intial files moving onto files in app dir --- .eslintignore | 7 ++++ .eslintrc | 45 ++++++++++++++++++++++ .gitignore | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++ gulpfile.js | 66 +++++++++++++++++++++++++++++++ package.json | 18 +++++++++ server.js | 7 ++++ 6 files changed, 248 insertions(+) create mode 100644 .eslintignore create mode 100644 .eslintrc create mode 100644 .gitignore create mode 100644 gulpfile.js create mode 100644 package.json create mode 100644 server.js diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..4c2f916 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules/* +**/vendor/* +**/*.min.js +**/build/* +**/test/*_bundle* +*.md +package.json diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..5f3d636 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,45 @@ +{ +"rules": { +"no-console": 0, +"indent": [ +2, +2, +{ +"SwitchCase": 1 +} +], +"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/.gitignore b/.gitignore new file mode 100644 index 0000000..b286629 --- /dev/null +++ b/.gitignore @@ -0,0 +1,105 @@ +# Created by https://www.gitignore.io/api/node,osx,windows,vim + +### Node ### +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed + +# 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 + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional REPL history +.node_repl_history + + +### OSX ### +*.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +/build + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +### Vim ### +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ +# auto-generated tag files +tags diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..e4a2f90 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,66 @@ +'use strict'; +const gulp = require('gulp'); +const webpack = require('webpack-stream'); +const notify = require('gulp-notify'); +const plumber = require('gulp-plumber'); + +var paths = { + dev: { + css: 'app/css/**/*.css', + html: 'app/**/*.html', + js: 'app/js/**/*.js', + test: 'test/*_test.js' + }, + build: { + main: 'build/', + css: 'build/css', + js: 'build/js', + test: 'test/' + } +}; + +gulp.task('watch', function () { + gulp.watch(paths.dev.html, ['statichtmlfiles:dev']); + gulp.watch(paths.dev.js, ['bundle']); + gulp.watch(paths.dev.css, ['staticcssfiles:dev']); + gulp.watch(paths.dev.test, ['bundle:test']); +}); + +gulp.task('statichtmlfiles:dev', () => { + return gulp.src(paths.dev.html) + .pipe(gulp.dest(paths.build.main)); +}); + +gulp.task('staticcssfiles:dev', () => { + return gulp.src(paths.dev.css) + .pipe(gulp.dest(paths.build.main)); +}); + + +gulp.task('bundle', () => { + return gulp.src(__dirname + '/app/js/client.js') + .pipe(plumber({ + errorHandler: notify.onError('Error: <%= error.message %>') + })) + .pipe(webpack({ + output: { + filename: 'bundle.js' + } + })) + .pipe(gulp.dest(paths.build.main)); +}); + +gulp.task('bundle:test', () => { + return gulp.src(paths.dev.test) + .pipe(plumber({ + errorHandler: notify.onError('Error: <%= error.message %>') + })) + .pipe(webpack({ + output: { + filename: 'test_bundle.js' + } + })) + .pipe(gulp.dest(paths.build.test)); +}); + +gulp.task('default', ['bundle', 'statichtmlfiles:dev', 'staticcssfiles:dev']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..0269c27 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "ng-adventure", + "version": "1.0.0", + "description": "ng boilerplate", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "webpack-stream": "^3.2.0" + }, + "dependencies": { + "angular": "^1.5.7", + "express": "^4.14.0" + } +} diff --git a/server.js b/server.js new file mode 100644 index 0000000..bcf2b55 --- /dev/null +++ b/server.js @@ -0,0 +1,7 @@ +'use strict'; +var express = require('express'); +var app = express(); +app.use(express.static(__dirname + '/build')); +var server = app.listen(3003, function(){ + console.log('server is running at %s', server.address().port); +}); From 1070eda6517da0b83747975833ab33a4bb695b40 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Tue, 21 Jun 2016 09:11:23 -0700 Subject: [PATCH 2/9] writing files in app --- app/css/app.css | 0 app/index.html | 26 ++++++++++++++++++++++++++ app/js/client.js | 6 ++++++ app/js/first/index.js | 0 4 files changed, 32 insertions(+) create mode 100644 app/css/app.css create mode 100644 app/index.html create mode 100644 app/js/client.js create mode 100644 app/js/first/index.js diff --git a/app/css/app.css b/app/css/app.css new file mode 100644 index 0000000..e69de29 diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..0e589a5 --- /dev/null +++ b/app/index.html @@ -0,0 +1,26 @@ + + + + + + + + Butt Sniffer App + + + +
+ + +

{{sniffy.title}}

+

{{sniffy.url}}

+

{{sniffy.description}}

+
+ + + +
+ + + + diff --git a/app/js/client.js b/app/js/client.js new file mode 100644 index 0000000..81c7eb0 --- /dev/null +++ b/app/js/client.js @@ -0,0 +1,6 @@ +'use strict'; + +const angular = require('angular'); + +let ButtSnifferApp = angular.module('ButtSnifferApp', []); +require('./first')(ButtSnifferApp); diff --git a/app/js/first/index.js b/app/js/first/index.js new file mode 100644 index 0000000..e69de29 From d7ab239ff758f29c805110d2c2e77ab10e761c67 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Tue, 21 Jun 2016 10:54:16 -0700 Subject: [PATCH 3/9] got the first directives working --- app/index.html | 22 ++++++++++++------- .../controllers/ButtSnifferController.js | 13 +++++++++++ app/js/first/controllers/index.js | 3 +++ .../first/directives/full_image_directive.js | 13 +++++++++++ app/js/first/directives/index.js | 5 +++++ .../first/directives/tiny_image_directive.js | 15 +++++++++++++ app/js/first/directives/title_directive.js | 13 +++++++++++ app/js/first/index.js | 4 ++++ app/templates/first/full_image_template.html | 6 +++++ app/templates/first/tiny_image_template.html | 4 ++++ app/templates/first/title_image_template.html | 9 ++++++++ package.json | 3 +++ 12 files changed, 102 insertions(+), 8 deletions(-) create mode 100644 app/js/first/controllers/ButtSnifferController.js create mode 100644 app/js/first/controllers/index.js create mode 100644 app/js/first/directives/full_image_directive.js create mode 100644 app/js/first/directives/index.js create mode 100644 app/js/first/directives/tiny_image_directive.js create mode 100644 app/js/first/directives/title_directive.js create mode 100644 app/templates/first/full_image_template.html create mode 100644 app/templates/first/tiny_image_template.html create mode 100644 app/templates/first/title_image_template.html diff --git a/app/index.html b/app/index.html index 0e589a5..d79a06e 100644 --- a/app/index.html +++ b/app/index.html @@ -9,16 +9,22 @@ -
+
+ + + + + + + + + + + + + - -

{{sniffy.title}}

-

{{sniffy.url}}

-

{{sniffy.description}}

-
- -
diff --git a/app/js/first/controllers/ButtSnifferController.js b/app/js/first/controllers/ButtSnifferController.js new file mode 100644 index 0000000..236f969 --- /dev/null +++ b/app/js/first/controllers/ButtSnifferController.js @@ -0,0 +1,13 @@ + +module.exports = function(app) { + app.controller('ButtSnifferController', ['$scope', function() { + this.url = 'http://www.wagandtrain.com/wp-content/plugins/image-shadow/cache/800d8ab9cf449d827c7d4d4a24ae0cc8.jpg'; + this.height = 400; + this.width = 400; + this.title = 'Butt Sniffer'; + this.description = 'Look at this crazy butt sniffer, how did he get there?'; + // this.tinyImage = function() { + // + // } + }]); +}; diff --git a/app/js/first/controllers/index.js b/app/js/first/controllers/index.js new file mode 100644 index 0000000..5e8df1c --- /dev/null +++ b/app/js/first/controllers/index.js @@ -0,0 +1,3 @@ +module.exports = function(app) { + require('./ButtSnifferController')(app); +}; diff --git a/app/js/first/directives/full_image_directive.js b/app/js/first/directives/full_image_directive.js new file mode 100644 index 0000000..f8dd1b3 --- /dev/null +++ b/app/js/first/directives/full_image_directive.js @@ -0,0 +1,13 @@ +module.exports = function(app) { + app.directive('fullImageDirective', function() { + return { + restrict: 'E', + templateUrl: './templates/first/full_image_template.html', + scope: { + title: '@', + url: '@', + description: '@' + } + }; + }); +}; diff --git a/app/js/first/directives/index.js b/app/js/first/directives/index.js new file mode 100644 index 0000000..296b570 --- /dev/null +++ b/app/js/first/directives/index.js @@ -0,0 +1,5 @@ +module.exports = function(app) { + require('./full_image_directive')(app); + require('./title_directive')(app); + require('./tiny_image_directive')(app); +}; diff --git a/app/js/first/directives/tiny_image_directive.js b/app/js/first/directives/tiny_image_directive.js new file mode 100644 index 0000000..550d789 --- /dev/null +++ b/app/js/first/directives/tiny_image_directive.js @@ -0,0 +1,15 @@ +module.exports = function(app) { + app.directive('tinyImageDirective', function() { + return { + restrict: 'E', + templateUrl: './templates/first/tiny_image_template.html', + scope: { + title: '@', + url: '@', + height: '@100', + width: '@100', + description: '@' + } + }; + }); +}; diff --git a/app/js/first/directives/title_directive.js b/app/js/first/directives/title_directive.js new file mode 100644 index 0000000..bff5f4a --- /dev/null +++ b/app/js/first/directives/title_directive.js @@ -0,0 +1,13 @@ +module.exports = function(app) { + app.directive('firstImageDirective', function() { + return { + restrict: 'E', + templateUrl: './templates/first/title_image_template.html', + scope: { + title: '@', + url: '@', + description: '@' + } + }; + }); +}; diff --git a/app/js/first/index.js b/app/js/first/index.js index e69de29..e7d6cfa 100644 --- a/app/js/first/index.js +++ b/app/js/first/index.js @@ -0,0 +1,4 @@ +module.exports = function(app) { + require('./controllers')(app); + require('./directives')(app); +}; diff --git a/app/templates/first/full_image_template.html b/app/templates/first/full_image_template.html new file mode 100644 index 0000000..c04ae2e --- /dev/null +++ b/app/templates/first/full_image_template.html @@ -0,0 +1,6 @@ +
+

Full Image Directive

+

{{title}}

+ {{title}} +

{{description}}

+
+

Small Image Directive

+ {{title}} + +

Title Directive

+

{{title}}

+

{{url}}

+

{{description}}

+
+ {{title}} +
+ diff --git a/package.json b/package.json index 0269c27..04b9a44 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,9 @@ "author": "", "license": "ISC", "devDependencies": { + "gulp": "^3.9.1", + "gulp-notify": "^2.2.0", + "gulp-plumber": "^1.1.0", "webpack-stream": "^3.2.0" }, "dependencies": { From e6769f71effb54d21a3f42c8e0db81cd00e14309 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Tue, 21 Jun 2016 11:06:11 -0700 Subject: [PATCH 4/9] submitting --- app/js/first/controllers/ButtSnifferController.js | 6 ++---- app/templates/first/tiny_image_template.html | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/app/js/first/controllers/ButtSnifferController.js b/app/js/first/controllers/ButtSnifferController.js index 236f969..212bd59 100644 --- a/app/js/first/controllers/ButtSnifferController.js +++ b/app/js/first/controllers/ButtSnifferController.js @@ -1,13 +1,11 @@ +'use strict'; module.exports = function(app) { app.controller('ButtSnifferController', ['$scope', function() { this.url = 'http://www.wagandtrain.com/wp-content/plugins/image-shadow/cache/800d8ab9cf449d827c7d4d4a24ae0cc8.jpg'; this.height = 400; this.width = 400; - this.title = 'Butt Sniffer'; + this.title = 'Butt Sniffer'; this.description = 'Look at this crazy butt sniffer, how did he get there?'; - // this.tinyImage = function() { - // - // } }]); }; diff --git a/app/templates/first/tiny_image_template.html b/app/templates/first/tiny_image_template.html index 54caa38..5ee141d 100644 --- a/app/templates/first/tiny_image_template.html +++ b/app/templates/first/tiny_image_template.html @@ -1,4 +1,4 @@
-

Small Image Directive

- {{title}} +

Tiny Image Directive

+ {{title}}
Date: Tue, 21 Jun 2016 21:53:20 -0700 Subject: [PATCH 5/9] got something displaying --- app/index.html | 12 +++++---- .../controllers/ButtSnifferController.js | 3 +++ .../first/controllers/PhotoAlbumController.js | 27 +++++++++++++++++++ app/js/first/controllers/index.js | 1 + app/js/first/directives/album_directive.js | 11 ++++++++ .../first/directives/full_image_directive.js | 5 ++-- app/js/first/directives/index.js | 1 + app/templates/first/album_directive.html | 3 +++ app/templates/first/albums.html | 5 ++++ app/templates/first/full_image_template.html | 5 +--- 10 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 app/js/first/controllers/PhotoAlbumController.js create mode 100644 app/js/first/directives/album_directive.js create mode 100644 app/templates/first/album_directive.html create mode 100644 app/templates/first/albums.html diff --git a/app/index.html b/app/index.html index d79a06e..b5bae8a 100644 --- a/app/index.html +++ b/app/index.html @@ -9,19 +9,21 @@ -
+
+ - + - - + + + diff --git a/app/js/first/controllers/ButtSnifferController.js b/app/js/first/controllers/ButtSnifferController.js index 212bd59..ea8d7e4 100644 --- a/app/js/first/controllers/ButtSnifferController.js +++ b/app/js/first/controllers/ButtSnifferController.js @@ -7,5 +7,8 @@ module.exports = function(app) { this.width = 400; this.title = 'Butt Sniffer'; this.description = 'Look at this crazy butt sniffer, how did he get there?'; + this.title = ''; + this.description = ''; + this.album = []; }]); }; diff --git a/app/js/first/controllers/PhotoAlbumController.js b/app/js/first/controllers/PhotoAlbumController.js new file mode 100644 index 0000000..fc61b9d --- /dev/null +++ b/app/js/first/controllers/PhotoAlbumController.js @@ -0,0 +1,27 @@ +'use strict'; + +module.exports = function(app) { + app.controller('PhotoAlbumController', PhotoAlbumController); +}; + +function PhotoAlbumController() { + this.model = {}; + this.sugarGliders = { + title: 'Sugar Gliders Album All The Way!!', + description: 'Damn these gliders sure are nasty :)', + album: [ + { + url: 'http://f.tqn.com/y/exoticpets/1/W/R/Q/1/96747320-crop.jpg', + title: 'Chillin on some wood, no glide mode' + }, + { + url: 'http://www.rkpuppiesandmore.com/smallpets/sugarglider.jpg', + title: 'Ridin that I dont know what, but supermanning that surface' + }, + { + url: 'http://rainforestreports.weebly.com/uploads/1/5/5/7/15578800/8932099_orig.jpg', + title: 'Swoopin in on yall' + } + ] + }; +} diff --git a/app/js/first/controllers/index.js b/app/js/first/controllers/index.js index 5e8df1c..c28f5c4 100644 --- a/app/js/first/controllers/index.js +++ b/app/js/first/controllers/index.js @@ -1,3 +1,4 @@ module.exports = function(app) { require('./ButtSnifferController')(app); + require('./PhotoAlbumController')(app); }; diff --git a/app/js/first/directives/album_directive.js b/app/js/first/directives/album_directive.js new file mode 100644 index 0000000..61a7460 --- /dev/null +++ b/app/js/first/directives/album_directive.js @@ -0,0 +1,11 @@ +module.exports = function(app) { + app.directive('photoAlbum', function() { + return { + restrict: 'E', + templateUrl: './templates/first/albums.html', + scope: { + photos: '=' + } + }; + }); +}; diff --git a/app/js/first/directives/full_image_directive.js b/app/js/first/directives/full_image_directive.js index f8dd1b3..74497e0 100644 --- a/app/js/first/directives/full_image_directive.js +++ b/app/js/first/directives/full_image_directive.js @@ -3,10 +3,9 @@ module.exports = function(app) { return { restrict: 'E', templateUrl: './templates/first/full_image_template.html', + replace: true, scope: { - title: '@', - url: '@', - description: '@' + url: '=' } }; }); diff --git a/app/js/first/directives/index.js b/app/js/first/directives/index.js index 296b570..85311c2 100644 --- a/app/js/first/directives/index.js +++ b/app/js/first/directives/index.js @@ -2,4 +2,5 @@ module.exports = function(app) { require('./full_image_directive')(app); require('./title_directive')(app); require('./tiny_image_directive')(app); + require('./album_directive')(app); }; diff --git a/app/templates/first/album_directive.html b/app/templates/first/album_directive.html new file mode 100644 index 0000000..1d80e81 --- /dev/null +++ b/app/templates/first/album_directive.html @@ -0,0 +1,3 @@ +
  • + {{body}} +
  • diff --git a/app/templates/first/albums.html b/app/templates/first/albums.html new file mode 100644 index 0000000..0ef850b --- /dev/null +++ b/app/templates/first/albums.html @@ -0,0 +1,5 @@ +
      +
    • + +
    • +
    diff --git a/app/templates/first/full_image_template.html b/app/templates/first/full_image_template.html index c04ae2e..3b77891 100644 --- a/app/templates/first/full_image_template.html +++ b/app/templates/first/full_image_template.html @@ -1,6 +1,3 @@
    -

    Full Image Directive

    -

    {{title}}

    - {{title}} -

    {{description}}

    +
    Date: Wed, 22 Jun 2016 04:27:57 -0700 Subject: [PATCH 6/9] got photos working and hiding --- app/css/app.css | 4 ++ app/index.html | 17 +++++++- .../first/controllers/PhotoAlbumController.js | 39 ++++++++++++++++++- app/js/first/directives/album_directive.js | 17 +++++++- .../first/directives/full_image_directive.js | 4 +- app/js/first/directives/main_directive.js | 0 .../first/directives/tiny_image_directive.js | 6 +-- app/js/first/directives/title_directive.js | 6 +-- app/templates/first/albums.html | 29 +++++++++++--- app/templates/first/main_template.html | 0 app/templates/first/tiny_image_template.html | 1 - app/templates/first/title_image_template.html | 4 -- 12 files changed, 107 insertions(+), 20 deletions(-) create mode 100644 app/js/first/directives/main_directive.js create mode 100644 app/templates/first/main_template.html diff --git a/app/css/app.css b/app/css/app.css index e69de29..2740d59 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -0,0 +1,4 @@ +ul +{ + list-style-type: none; +} diff --git a/app/index.html b/app/index.html index b5bae8a..da434ab 100644 --- a/app/index.html +++ b/app/index.html @@ -19,10 +19,25 @@ --> + + + +

    {{albums.sugarGliders.title}}

    +

    {{albums.sugarGliders.description}}

    - +

    {{albums.badPussyCats.title}}

    +

    {{albums.badPussyCats.description}}

    + +

    {{albums.superCoolMarineIguanas.title}}

    +

    {{albums.superCoolMarineIguanas.description}}

    + + + + + diff --git a/app/js/first/controllers/PhotoAlbumController.js b/app/js/first/controllers/PhotoAlbumController.js index fc61b9d..e903852 100644 --- a/app/js/first/controllers/PhotoAlbumController.js +++ b/app/js/first/controllers/PhotoAlbumController.js @@ -5,7 +5,7 @@ module.exports = function(app) { }; function PhotoAlbumController() { - this.model = {}; + this.sugarGliders = { title: 'Sugar Gliders Album All The Way!!', description: 'Damn these gliders sure are nasty :)', @@ -24,4 +24,41 @@ function PhotoAlbumController() { } ] }; + this.badPussyCats = { + title: 'These pussies are super bad!!!', + description: 'Who let these pussies out?', + album: [ + { + url: 'https://s-media-cache-ak0.pinimg.com/236x/d8/10/e4/d810e49915d82f8b281d07f9b0d55cd7.jpg', + title: 'Damn this pussy is getting locked up' + }, + { + url: 'http://1.bp.blogspot.com/_DTGEcBi-w0g/TIg0BOQWHuI/AAAAAAAAAmI/UeFySd1t6Yw/s640/bad-cat3.jpg', + title: 'Back in da hood pussy' + }, + { + url: 'https://secure.static.tumblr.com/468c354df166018752850b504e7a4561/earrb7t/xoLnoany6/tumblr_static_tumblr_static_2rtorf46vu0w4kgc8gowcc4gk_640.jpg', + title: 'This pussy is far out man' + } + ] + }; + + this.superCoolMarineIguanas = { + title: 'Bet you didnt know about these guys', + description: 'Marine Iguanas on the rise', + album: [ + { + url: 'https://www.quasarex.com/galapagos/media/img/animals/reptiles/iguanas/marine-iguanas_2.jpg', + title: 'Here he is, front and center' + }, + { + url: 'http://ww2.hdnux.com/photos/45/27/47/9796073/4/920x920.jpg', + title: 'They like to swim' + }, + { + url: 'http://yourshot.nationalgeographic.com/u/ss/fQYSUbVfts-T7pS2VP2wnKyN8wxywmXtY0-FwsgxpiuUfORQIJSJ-23I0H_e0r-hPtf9foGX8_K9EEouT8ey/', + title: 'And spit!' + } + ] + }; } diff --git a/app/js/first/directives/album_directive.js b/app/js/first/directives/album_directive.js index 61a7460..0233670 100644 --- a/app/js/first/directives/album_directive.js +++ b/app/js/first/directives/album_directive.js @@ -4,7 +4,22 @@ module.exports = function(app) { restrict: 'E', templateUrl: './templates/first/albums.html', scope: { - photos: '=' + photos: '=', + title: '=', + description: '=' + }, + controller: function($scope) { + $scope.changeView = function() { + console.log($scope.mode); + }; + $scope.showArticle = function(photo) { + if (!photo) { + $scope.mode = 'list'; + return; + } + $scope.currentPhoto = photo; + $scope.mode = 'single'; + }; } }; }); diff --git a/app/js/first/directives/full_image_directive.js b/app/js/first/directives/full_image_directive.js index 74497e0..a222cd0 100644 --- a/app/js/first/directives/full_image_directive.js +++ b/app/js/first/directives/full_image_directive.js @@ -5,7 +5,9 @@ module.exports = function(app) { templateUrl: './templates/first/full_image_template.html', replace: true, scope: { - url: '=' + url: '=', + title: '=', + description: '=' } }; }); diff --git a/app/js/first/directives/main_directive.js b/app/js/first/directives/main_directive.js new file mode 100644 index 0000000..e69de29 diff --git a/app/js/first/directives/tiny_image_directive.js b/app/js/first/directives/tiny_image_directive.js index 550d789..403e0ba 100644 --- a/app/js/first/directives/tiny_image_directive.js +++ b/app/js/first/directives/tiny_image_directive.js @@ -4,11 +4,11 @@ module.exports = function(app) { restrict: 'E', templateUrl: './templates/first/tiny_image_template.html', scope: { - title: '@', - url: '@', + title: '=', + url: '=', height: '@100', width: '@100', - description: '@' + description: '=' } }; }); diff --git a/app/js/first/directives/title_directive.js b/app/js/first/directives/title_directive.js index bff5f4a..d9233ed 100644 --- a/app/js/first/directives/title_directive.js +++ b/app/js/first/directives/title_directive.js @@ -4,9 +4,9 @@ module.exports = function(app) { restrict: 'E', templateUrl: './templates/first/title_image_template.html', scope: { - title: '@', - url: '@', - description: '@' + title: '=', + url: '=', + description: '=' } }; }); diff --git a/app/templates/first/albums.html b/app/templates/first/albums.html index 0ef850b..3029adb 100644 --- a/app/templates/first/albums.html +++ b/app/templates/first/albums.html @@ -1,5 +1,24 @@ -
      -
    • - -
    • -
    +
    +
      +
    • + +
      + +
      +
    • +
    +
    +
    +
      +
    • + +
      + +
      +
    • +
    +
    + +Full Image Album +Tiny Image Album +Text diff --git a/app/templates/first/main_template.html b/app/templates/first/main_template.html new file mode 100644 index 0000000..e69de29 diff --git a/app/templates/first/tiny_image_template.html b/app/templates/first/tiny_image_template.html index 5ee141d..21b0642 100644 --- a/app/templates/first/tiny_image_template.html +++ b/app/templates/first/tiny_image_template.html @@ -1,4 +1,3 @@
    -

    Tiny Image Directive

    {{title}}
    -

    Title Directive

    {{title}}

    {{url}}

    {{description}}

    -
    - {{title}} -
    From de7f1d3a2cbd536425f34c32f05d40ddf2116b44 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Wed, 22 Jun 2016 09:14:13 -0700 Subject: [PATCH 7/9] got photos working and hiding --- .../first/controllers/PhotoAlbumController.js | 9 ++++++--- app/js/first/directives/album_directive.js | 18 +++++++++++------- app/templates/first/albums.html | 13 ++++++------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/app/js/first/controllers/PhotoAlbumController.js b/app/js/first/controllers/PhotoAlbumController.js index e903852..e032f37 100644 --- a/app/js/first/controllers/PhotoAlbumController.js +++ b/app/js/first/controllers/PhotoAlbumController.js @@ -12,15 +12,18 @@ function PhotoAlbumController() { album: [ { url: 'http://f.tqn.com/y/exoticpets/1/W/R/Q/1/96747320-crop.jpg', - title: 'Chillin on some wood, no glide mode' + title: 'Chillin on some wood, no glide mode', + textDisplay: false }, { url: 'http://www.rkpuppiesandmore.com/smallpets/sugarglider.jpg', - title: 'Ridin that I dont know what, but supermanning that surface' + title: 'Ridin that I dont know what, but supermanning that surface', + textDisplay: false }, { url: 'http://rainforestreports.weebly.com/uploads/1/5/5/7/15578800/8932099_orig.jpg', - title: 'Swoopin in on yall' + title: 'Swoopin in on yall', + textDisplay: false } ] }; diff --git a/app/js/first/directives/album_directive.js b/app/js/first/directives/album_directive.js index 0233670..564d7d4 100644 --- a/app/js/first/directives/album_directive.js +++ b/app/js/first/directives/album_directive.js @@ -9,16 +9,20 @@ module.exports = function(app) { description: '=' }, controller: function($scope) { + $scope.photoText = false; + $scope.photoTextAgain = true; $scope.changeView = function() { console.log($scope.mode); }; - $scope.showArticle = function(photo) { - if (!photo) { - $scope.mode = 'list'; - return; - } - $scope.currentPhoto = photo; - $scope.mode = 'single'; + $scope.toggle = function($event, image) { + // let foo = $event.currentTarget; + // if ($event.currentTarget != $event.currentTarget) { + // $scope.photoText = false; + // } else { + $scope.photoText = !$scope.photoText; + $scope.photoTextAgain = !$scope.photoTextAgain; + + }; } }; diff --git a/app/templates/first/albums.html b/app/templates/first/albums.html index 3029adb..15faee7 100644 --- a/app/templates/first/albums.html +++ b/app/templates/first/albums.html @@ -1,18 +1,18 @@ -
    +
    • - -
      + +
    -
    +
    • - -
      + +
    • @@ -21,4 +21,3 @@ Full Image Album Tiny Image Album -Text From 917188a83c0371f47e35c1873f70b11e80ab8c37 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Wed, 22 Jun 2016 11:52:16 -0700 Subject: [PATCH 8/9] ready to submit --- app/index.html | 39 +++++----------------- app/js/first/directives/album_directive.js | 16 +++++---- app/js/first/directives/main_directive.js | 0 app/templates/first/album_directive.html | 3 -- app/templates/first/albums.html | 14 +++++--- app/templates/first/main_template.html | 0 6 files changed, 28 insertions(+), 44 deletions(-) delete mode 100644 app/js/first/directives/main_directive.js delete mode 100644 app/templates/first/album_directive.html delete mode 100644 app/templates/first/main_template.html diff --git a/app/index.html b/app/index.html index da434ab..da5acba 100644 --- a/app/index.html +++ b/app/index.html @@ -11,36 +11,15 @@
      - - - - - - - - -

      {{albums.sugarGliders.title}}

      -

      {{albums.sugarGliders.description}}

      - -

      {{albums.badPussyCats.title}}

      -

      {{albums.badPussyCats.description}}

      - -

      {{albums.superCoolMarineIguanas.title}}

      -

      {{albums.superCoolMarineIguanas.description}}

      - - - - - - - - +

      {{albums.sugarGliders.title}}

      +

      {{albums.sugarGliders.description}}

      + +

      {{albums.badPussyCats.title}}

      +

      {{albums.badPussyCats.description}}

      + +

      {{albums.superCoolMarineIguanas.title}}

      +

      {{albums.superCoolMarineIguanas.description}}

      +
      diff --git a/app/js/first/directives/album_directive.js b/app/js/first/directives/album_directive.js index 564d7d4..5b9f9fb 100644 --- a/app/js/first/directives/album_directive.js +++ b/app/js/first/directives/album_directive.js @@ -6,7 +6,8 @@ module.exports = function(app) { scope: { photos: '=', title: '=', - description: '=' + description: '=', + photo: '=' }, controller: function($scope) { $scope.photoText = false; @@ -14,11 +15,14 @@ module.exports = function(app) { $scope.changeView = function() { console.log($scope.mode); }; - $scope.toggle = function($event, image) { - // let foo = $event.currentTarget; - // if ($event.currentTarget != $event.currentTarget) { - // $scope.photoText = false; - // } else { + $scope.toggle = function(photo) { + console.log(photo); + + $scope.currentPhoto = photo; + let photoArray = []; + photoArray.push(photo); + console.log(photoArray); + $scope.photoText = !$scope.photoText; $scope.photoTextAgain = !$scope.photoTextAgain; diff --git a/app/js/first/directives/main_directive.js b/app/js/first/directives/main_directive.js deleted file mode 100644 index e69de29..0000000 diff --git a/app/templates/first/album_directive.html b/app/templates/first/album_directive.html deleted file mode 100644 index 1d80e81..0000000 --- a/app/templates/first/album_directive.html +++ /dev/null @@ -1,3 +0,0 @@ -
    • - {{body}} -
    • diff --git a/app/templates/first/albums.html b/app/templates/first/albums.html index 15faee7..7d23b46 100644 --- a/app/templates/first/albums.html +++ b/app/templates/first/albums.html @@ -1,17 +1,21 @@ + + +
      • - -
        - -
        +
      +
      + +
      +
      • - +
        diff --git a/app/templates/first/main_template.html b/app/templates/first/main_template.html deleted file mode 100644 index e69de29..0000000 From 426a0eca71ea67a1d89ed933c32adc9c4a3c83b2 Mon Sep 17 00:00:00 2001 From: YOUR FULL NAME Date: Thu, 23 Jun 2016 10:07:53 -0700 Subject: [PATCH 9/9] made test --- app/js/first/directives/dummy.js | 11 +++++++++++ app/templates/first/dummy.html | 3 +++ gulpfile.js | 6 ++++++ package.json | 2 +- test/directive_test.js | 13 +++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/js/first/directives/dummy.js create mode 100644 app/templates/first/dummy.html create mode 100644 test/directive_test.js diff --git a/app/js/first/directives/dummy.js b/app/js/first/directives/dummy.js new file mode 100644 index 0000000..1d9d08b --- /dev/null +++ b/app/js/first/directives/dummy.js @@ -0,0 +1,11 @@ +module.exports = function(app) { + app.directive('dummy', function() { + return { + templateUrl: './templates/first/dummy.html', + scope: { + thing: '=' + }, + replace: true + }; + }); +}; diff --git a/app/templates/first/dummy.html b/app/templates/first/dummy.html new file mode 100644 index 0000000..aa17956 --- /dev/null +++ b/app/templates/first/dummy.html @@ -0,0 +1,3 @@ +
        +

        {{thing}}

        +
        diff --git a/gulpfile.js b/gulpfile.js index e4a2f90..7794d05 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -45,6 +45,12 @@ gulp.task('bundle', () => { .pipe(webpack({ output: { filename: 'bundle.js' + }, + module: { + loaders: [{ + test: /\.html$/, + loader: 'html' + }] } })) .pipe(gulp.dest(paths.build.main)); diff --git a/package.json b/package.json index 04b9a44..7714ebd 100644 --- a/package.json +++ b/package.json @@ -9,13 +9,13 @@ "author": "", "license": "ISC", "devDependencies": { + "angular": "^1.5.7", "gulp": "^3.9.1", "gulp-notify": "^2.2.0", "gulp-plumber": "^1.1.0", "webpack-stream": "^3.2.0" }, "dependencies": { - "angular": "^1.5.7", "express": "^4.14.0" } } diff --git a/test/directive_test.js b/test/directive_test.js new file mode 100644 index 0000000..48ea329 --- /dev/null +++ b/test/directive_test.js @@ -0,0 +1,13 @@ +'use strict'; + +const angular = require('angular'); +require('angular-mocks'); +require('../app/js/client'); + +const dummyTemplate = require('../app/templates/first/dummy.html'); + +describe('directive tests', () => { + it('should be a test', () => { + expect(true).toBe(true); + }); +});