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/app/css/app.css b/app/css/app.css new file mode 100644 index 0000000..2740d59 --- /dev/null +++ b/app/css/app.css @@ -0,0 +1,4 @@ +ul +{ + list-style-type: none; +} diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..da5acba --- /dev/null +++ b/app/index.html @@ -0,0 +1,28 @@ + + + + + + + + Butt Sniffer App + + + +
+ +

{{albums.sugarGliders.title}}

+

{{albums.sugarGliders.description}}

+ +

{{albums.badPussyCats.title}}

+

{{albums.badPussyCats.description}}

+ +

{{albums.superCoolMarineIguanas.title}}

+

{{albums.superCoolMarineIguanas.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/controllers/ButtSnifferController.js b/app/js/first/controllers/ButtSnifferController.js new file mode 100644 index 0000000..ea8d7e4 --- /dev/null +++ b/app/js/first/controllers/ButtSnifferController.js @@ -0,0 +1,14 @@ +'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.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..e032f37 --- /dev/null +++ b/app/js/first/controllers/PhotoAlbumController.js @@ -0,0 +1,67 @@ +'use strict'; + +module.exports = function(app) { + app.controller('PhotoAlbumController', PhotoAlbumController); +}; + +function PhotoAlbumController() { + + 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', + textDisplay: false + }, + { + url: 'http://www.rkpuppiesandmore.com/smallpets/sugarglider.jpg', + 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', + textDisplay: false + } + ] + }; + 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/controllers/index.js b/app/js/first/controllers/index.js new file mode 100644 index 0000000..c28f5c4 --- /dev/null +++ b/app/js/first/controllers/index.js @@ -0,0 +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..5b9f9fb --- /dev/null +++ b/app/js/first/directives/album_directive.js @@ -0,0 +1,34 @@ +module.exports = function(app) { + app.directive('photoAlbum', function() { + return { + restrict: 'E', + templateUrl: './templates/first/albums.html', + scope: { + photos: '=', + title: '=', + description: '=', + photo: '=' + }, + controller: function($scope) { + $scope.photoText = false; + $scope.photoTextAgain = true; + $scope.changeView = function() { + console.log($scope.mode); + }; + $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/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/js/first/directives/full_image_directive.js b/app/js/first/directives/full_image_directive.js new file mode 100644 index 0000000..a222cd0 --- /dev/null +++ b/app/js/first/directives/full_image_directive.js @@ -0,0 +1,14 @@ +module.exports = function(app) { + app.directive('fullImageDirective', function() { + return { + restrict: 'E', + templateUrl: './templates/first/full_image_template.html', + replace: true, + scope: { + url: '=', + title: '=', + description: '=' + } + }; + }); +}; diff --git a/app/js/first/directives/index.js b/app/js/first/directives/index.js new file mode 100644 index 0000000..85311c2 --- /dev/null +++ b/app/js/first/directives/index.js @@ -0,0 +1,6 @@ +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/js/first/directives/tiny_image_directive.js b/app/js/first/directives/tiny_image_directive.js new file mode 100644 index 0000000..403e0ba --- /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..d9233ed --- /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 new file mode 100644 index 0000000..e7d6cfa --- /dev/null +++ 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/albums.html b/app/templates/first/albums.html new file mode 100644 index 0000000..7d23b46 --- /dev/null +++ b/app/templates/first/albums.html @@ -0,0 +1,27 @@ + + + +
+ +
+ +
+
+ +
+ +
+ +Full Image Album +Tiny Image Album 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/app/templates/first/full_image_template.html b/app/templates/first/full_image_template.html new file mode 100644 index 0000000..3b77891 --- /dev/null +++ b/app/templates/first/full_image_template.html @@ -0,0 +1,3 @@ +
+ +
+ {{title}} + +

{{title}}

+

{{url}}

+

{{description}}

+ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..7794d05 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,72 @@ +'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' + }, + module: { + loaders: [{ + test: /\.html$/, + loader: 'html' + }] + } + })) + .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..7714ebd --- /dev/null +++ b/package.json @@ -0,0 +1,21 @@ +{ + "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": { + "angular": "^1.5.7", + "gulp": "^3.9.1", + "gulp-notify": "^2.2.0", + "gulp-plumber": "^1.1.0", + "webpack-stream": "^3.2.0" + }, + "dependencies": { + "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); +}); 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); + }); +});