From 61f85e609c463b380d10c18fda9ac8cf149c4d2c Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 14:59:14 -0700 Subject: [PATCH 01/51] Scaffolding project. --- .babelrc | 0 .eslintrc | 21 ++++++++ .gitignore | 116 +++++++++++++++++++++++++++++++++++++++++++++ app/entry.js | 0 app/index.html | 0 app/scss/main.scss | 0 karma.config.js | 0 package.json | 49 +++++++++++++++++++ webpack.config.js | 0 9 files changed, 186 insertions(+) create mode 100644 .babelrc create mode 100644 .eslintrc create mode 100644 .gitignore create mode 100644 app/entry.js create mode 100644 app/index.html create mode 100644 app/scss/main.scss create mode 100644 karma.config.js create mode 100644 package.json create mode 100644 webpack.config.js diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..e69de29b diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..8dc68078 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "rules": { + "no-console": "off", + "indent": [ "error", 2 ], + "quotes": [ "error", "single" ], + "semi": ["error", "always"], + "linebreak-style": [ "error", "unix" ] + }, + "env": { + "es6": true, + "node": true, + "mocha": true, + "jasmine": true + }, + "ecmaFeatures": { + "modules": true, + "experimentalObjectRestSpread": true, + "impliedStrict": true + }, + "extends": "eslint:recommended" +} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..603220a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,116 @@ +# Created by https://www.gitignore.io/api/node,macos,windows + +### macOS ### +*.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 + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Angular Build Directory +build/ + +# End of https://www.gitignore.io/api/node,macos,windows diff --git a/app/entry.js b/app/entry.js new file mode 100644 index 00000000..e69de29b diff --git a/app/index.html b/app/index.html new file mode 100644 index 00000000..e69de29b diff --git a/app/scss/main.scss b/app/scss/main.scss new file mode 100644 index 00000000..e69de29b diff --git a/karma.config.js b/karma.config.js new file mode 100644 index 00000000..e69de29b diff --git a/package.json b/package.json new file mode 100644 index 00000000..47a5c3b3 --- /dev/null +++ b/package.json @@ -0,0 +1,49 @@ +{ + "name": "lab-dana", + "version": "1.0.0", + "description": "![cf](https://i.imgur.com/7v5ASc8.png) Lab 25 - Client Side Auth ======", + "main": "karma.config.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/dkulp23/25-angular_auth.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/dkulp23/25-angular_auth/issues" + }, + "homepage": "https://github.com/dkulp23/25-angular_auth#readme", + "dependencies": { + "angular": "^1.6.3", + "angular-animate": "^1.6.3", + "angular-route": "^1.6.3", + "angular-touch": "^1.6.3", + "angular-ui-router": "^0.4.2", + "babel-core": "^6.24.0", + "babel-loader": "^6.4.1", + "babel-preset-es2015": "^6.24.0", + "camelcase": "^4.0.0", + "clean-webpack-plugin": "^0.1.16", + "css-loader": "^0.27.3", + "dotenv": "^4.0.0", + "extract-text-webpack-plugin": "^2.1.0", + "file-loader": "^0.10.1", + "html-loader": "^0.4.5", + "html-webpack-plugin": "^2.28.0", + "node-sass": "^4.5.1", + "pascalcase": "^0.1.1", + "resolve-url-loader": "^2.0.2", + "sass-loader": "^6.0.3", + "style-loader": "^0.16.1", + "ui-router": "^1.0.0-alpha.3", + "url-loader": "^0.5.8", + "webpack": "^2.3.2" + }, + "devDependencies": { + "webpack-dev-server": "^2.4.2" + } +} diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 00000000..e69de29b From ec1b4f65b6df8a40af4d3fac1b1c3a3766db24c8 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:09:58 -0700 Subject: [PATCH 02/51] Configuring settings and attempting to load image dynamically. --- .babelrc | 3 +++ app/assets/images/cf.png | Bin 0 -> 9822 bytes webpack.config.js | 46 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 app/assets/images/cf.png diff --git a/.babelrc b/.babelrc index e69de29b..c13c5f62 100644 --- a/.babelrc +++ b/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/app/assets/images/cf.png b/app/assets/images/cf.png new file mode 100644 index 0000000000000000000000000000000000000000..2aecf242ec0c8cf9f973b05744cad0bea6b4f4f3 GIT binary patch literal 9822 zcmd6NRZtwkxA))<3GRddOK^7&?(R--cY-?v3GNV_1p;h<;J$=~;2{JFF2UU$?*4Dp z_wYU3xBGBwYU=cK&#&jqnVw^P;xyFcaWKg-0RX^JRFKgE00ejw0YFEE6BExWTR1_r zQk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-=|hFpW`ExpIO$SB-Q?Mtdvz@DgV1f z%(|Y{zJ4HTkh_P%H!t3=F)w&_Eht2joF0fj44SPNnkqmi6D87V>d5mn()))f5&=44 zWSv+fSB5;L!7Bz3HG!Psl}en!`)~;0^je_k%VSDN{iZx@RGl}?rY6J5Z8|9V?R_A zD&K;bpTlp+L3G8+uSI9tE+s2dzQ`R%VW)_XglyAcL4KO9^3VgK#r+yfRQv|`8e`z5 zEHXc`__8Ehtav&ke(uU4W2Lj0x8jUPj@K2G6KFWcToz{0!$C**>{cYuu!ypEEk=3L zhS_Z6W93qeI`@<5RXnP^}61IbH* z$z2F2P#g3AP<_$-3);$WL#{`{fJ=Ct7K68}fw#4#w~g=zPa8M^xH-9a*todZxH)w= vIfZ$-g!%Yc;0;br&Gh@G{}15eX6<0>|33rXOuR>j0{}%?H5tfzi-`XMhJBJN literal 0 HcmV?d00001 diff --git a/webpack.config.js b/webpack.config.js index e69de29b..6afacb2a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -0,0 +1,46 @@ +'use strict'; + +require('dotenv').load(); + +const webpack = require('webpack'); +const HTMLPlugin = require('html-webpack-plugin'); +const ExtractTextPlugin = require('extract-text-webpack-plugin'); + +module.exports = { + devtool: 'eval', + entry: `${__dirname}/app/entry.js`, + output: { + path: `${__dirname}/build`, + filename: 'bundle.js' + }, + plugins: [ + new HTMLPlugin({ + template: `${__dirname}/app/index.html` + }), + new ExtractTextPlugin('bundle.css'), + new webpack.DefinePlugin({ + __API_URL__: JSON.stringify(process.env.API_URL) //__webpack_constant__ + }) + ], + module: { + rules: [ + { + test: /\.js$/, + exclude: /node_modules/, + loader: 'babel-loader' + }, + { + test: /\.html$/, + loader: 'html-loader' + }, + { + test: /\.scss$/, + loader: ExtractTextPlugin.extract(['css-loader', 'sass-loader']) + }, + { + test: /\.png$/, + loader: 'url-loader' + } + ] + } +}; From 9aea9d099c0fbe5964aaace1c00643177b925a70 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:28:58 -0700 Subject: [PATCH 03/51] entry.js fiel and karma config. --- .../assets => app/assets/images}/cf-logo.png | Bin app/entry.js | 39 ++++++++++++++++++ karma.config.js | 26 ++++++++++++ 3 files changed, 65 insertions(+) rename {wireframes/assets => app/assets/images}/cf-logo.png (100%) diff --git a/wireframes/assets/cf-logo.png b/app/assets/images/cf-logo.png similarity index 100% rename from wireframes/assets/cf-logo.png rename to app/assets/images/cf-logo.png diff --git a/app/entry.js b/app/entry.js index e69de29b..a2dfb641 100644 --- a/app/entry.js +++ b/app/entry.js @@ -0,0 +1,39 @@ +'use strict'; + +require('./scss/main.scss'); + +const path = require('path'); +const angular = require('angular'); +const camelCase = require('camelcase'); +const pascalcase = require('pascalcase'); +const uiRouter = require('angular-ui-router'); +const ngTouch = require('angular-touch'); +const ngAnimate = require('angular-animate'); + +const cfgram = angular.module('cfgram', [ngTouch, ngAnimate, uiRouter]); + +let context = require.context('./config/', true, /\.js$/); +context.keys().forEach( key => { + cfgram.config(context(key)); +}); + +context = require.context('./view/', true, /\.js$/); +context.keys().forEach( key => { + let name = pascalcase(path.basename(key, '.js')); + let module = context(key); + cfgram.controller(name, module); +}); + +context = require.context('./service/', true, /\.js/); +context.keys().forEach( key => { + let name = camelCase(path.basename(key, '.js')); + let module = context(key); + cfgram.service(name, module); +}); + +context = require.context('./component/', true, /\.js$/); +context.keys().forEach( key => { + let name = camelCase(path.basename(key, '.js')); + let module = context(key); + cfgram.component(name, module); +}); diff --git a/karma.config.js b/karma.config.js index e69de29b..b174dbe3 100644 --- a/karma.config.js +++ b/karma.config.js @@ -0,0 +1,26 @@ +const webpackConfig = require('./webpack.config.js'); +webpackConfig.entry = {}; + +module.exports = function(config) { + config.set({ + webpack: webpackConfig, + basePath: '', + frameworks: ['jasmine'], + files: [ + 'test/**/*-test.js' + ], + exclude: [ + ], + preprocessors: { + 'test/**/*-test.js': ['webpack'] + }, + reporters: ['mocha'], + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + autoWatch: true, + browsers: ['PhantomJS'], + singleRun: false, + concurrency: Infinity + }); +}; From 3a9def52ad06255644912287cf98ee19dec09108 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:33:57 -0700 Subject: [PATCH 04/51] Auth-service logic. --- app/service/auth-service.js | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 app/service/auth-service.js diff --git a/app/service/auth-service.js b/app/service/auth-service.js new file mode 100644 index 00000000..9c711054 --- /dev/null +++ b/app/service/auth-service.js @@ -0,0 +1,89 @@ +'use strict'; + +module.exports = ['$q', '$log', '$http', '$window', authService]; + +function authService($q, $log, $http, $window) { + $log.debug('authService'); + + let service = {}; + let token = null; + + function setToken(_token) { + $log.debug('authService.setToken'); + + if (! _token) { + return $q.reject(new Error('no token')); + } + + $window.localStorage.setItem('token', _token); + token = _token; + return $q.resolve(token); + } + + service.getToken = function() { + $log.debug('authService.getToken'); + + if (token) { + return $q.resolve(token); + } + + token = $window.localStorage.getItem('token'); + if (token) return $q.resolve(token); + return $q.reject(new Error('token not found')); + }; + + service.signup = function(user) { + $log.debug('authService.signup'); + + let url = `${__API_URL__}/api/signup`; // eslint-disable-line + let config = { + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + } + }; + + return $http.post(url, user, config) + .then( res => { + $log.log('success:', res.data); + return setToken(res.data); + }) + .catch( err => { + $log.error('failure:', err.message); + return $q.reject(err); + }); + }; + + service.logout = function() { + $log.debug('authService.logout'); + + $window.localStorage.removeItem('token'); + token = null; + return $q.resolve(); + }; + + service.login = function(user) { + $log.debug('authService.login'); + + let url = `${__API_URL__}/api/login`; // eslint-disable-line + let base64 = $window.btoa(`${user.username}:${user.password}`); + let config = { + headers: { + Accept: 'application/json', + Authorization: `Basic ${base64}` + } + }; + + return $http.get(url, config) + .then( res => { + $log.log('success:', res.data); + return setToken(res.data); + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + + return service; +} From 9fee3453d4791e2f4bc0a15932414c327104ac9a Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:35:36 -0700 Subject: [PATCH 05/51] Added router configuration. --- app/config/router-config.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 app/config/router-config.js diff --git a/app/config/router-config.js b/app/config/router-config.js new file mode 100644 index 00000000..31d817b6 --- /dev/null +++ b/app/config/router-config.js @@ -0,0 +1,31 @@ +'use strict'; + +module.exports = ['$stateProvider', '$urlRouterProvider', routerConfig]; + +function routerConfig($stateProvider, $urlRouterProvider) { + $urlRouterProvider.when('', '/join#signup'); + $urlRouterProvider.when('/', '/join#signup'); + $urlRouterProvider.when('/signup', '/join#signup'); + $urlRouterProvider.when('/login', '/join#login'); + + let states = [ + { + name: 'home', + url: '/home', + template: require('../view/home/home.html'), + controller: 'HomeController', + controllerAs: 'homeCtrl' + }, + { + name: 'landing', + url: '/join', + template: require('../view/landing/landing.html'), + controller: 'LandingController', + controllerAs: 'landingCtrl' + } + ]; + + states.forEach( state => { + $stateProvider.state(state); + }); +} From ef5dfedc88ee8af126b08e2a2f31fcfe7bc06c8a Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:44:41 -0700 Subject: [PATCH 06/51] Scaffolded files for views and components. Completed home view. --- app/component/login/_login.scss | 0 app/component/login/login.html | 0 app/component/login/login.js | 0 app/component/signup/_signup.scss | 0 app/component/signup/signup.html | 0 app/component/signup/signup.js | 0 app/view/home/_home.scss | 0 app/view/home/home-controller.js | 10 ++++++++++ app/view/home/home.html | 3 +++ app/view/landing/_landing.scss | 0 app/view/landing/landing-controller.js | 0 app/view/landing/landing.html | 0 12 files changed, 13 insertions(+) create mode 100644 app/component/login/_login.scss create mode 100644 app/component/login/login.html create mode 100644 app/component/login/login.js create mode 100644 app/component/signup/_signup.scss create mode 100644 app/component/signup/signup.html create mode 100644 app/component/signup/signup.js create mode 100644 app/view/home/_home.scss create mode 100644 app/view/home/home-controller.js create mode 100644 app/view/home/home.html create mode 100644 app/view/landing/_landing.scss create mode 100644 app/view/landing/landing-controller.js create mode 100644 app/view/landing/landing.html diff --git a/app/component/login/_login.scss b/app/component/login/_login.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/login/login.html b/app/component/login/login.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/login/login.js b/app/component/login/login.js new file mode 100644 index 00000000..e69de29b diff --git a/app/component/signup/_signup.scss b/app/component/signup/_signup.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/signup/signup.js b/app/component/signup/signup.js new file mode 100644 index 00000000..e69de29b diff --git a/app/view/home/_home.scss b/app/view/home/_home.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/view/home/home-controller.js b/app/view/home/home-controller.js new file mode 100644 index 00000000..6cf237e8 --- /dev/null +++ b/app/view/home/home-controller.js @@ -0,0 +1,10 @@ +'use strict'; + +require('./_home.scss'); + +module.exports = ['$log', HomeController]; + +function HomeController($log) { + $log.debug('HomeController'); + this.title = 'Tere tulemast koju!'; +} diff --git a/app/view/home/home.html b/app/view/home/home.html new file mode 100644 index 00000000..da83caab --- /dev/null +++ b/app/view/home/home.html @@ -0,0 +1,3 @@ +
+

{{ homeCtrl.title }}

+
diff --git a/app/view/landing/_landing.scss b/app/view/landing/_landing.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/view/landing/landing-controller.js b/app/view/landing/landing-controller.js new file mode 100644 index 00000000..e69de29b diff --git a/app/view/landing/landing.html b/app/view/landing/landing.html new file mode 100644 index 00000000..e69de29b From f42ef79a16a66dba94fe9130ad9d159bec239df2 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 15:51:20 -0700 Subject: [PATCH 07/51] Added landing view controller and html. --- app/view/landing/landing-controller.js | 11 +++++++++++ app/view/landing/landing.html | 25 +++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/app/view/landing/landing-controller.js b/app/view/landing/landing-controller.js index e69de29b..f0436dfe 100644 --- a/app/view/landing/landing-controller.js +++ b/app/view/landing/landing-controller.js @@ -0,0 +1,11 @@ +'use strict'; + +require('./_landing.scss'); + +module.exports = ['$log', '$location', '$rootScope', LandingController]; + +function LandingController($log, $location) { + $log.debug('LandingController'); + + let url = $location.url() === '/join#signup' || url === '/join'; +} diff --git a/app/view/landing/landing.html b/app/view/landing/landing.html index e69de29b..68029964 100644 --- a/app/view/landing/landing.html +++ b/app/view/landing/landing.html @@ -0,0 +1,25 @@ +
+
+
+ +

already a member?

+ + sign in here + +
+
+ +
+
+ +

want to sign up?

+ + sign up here + +
+
+
From 75c397579d07f818340c51b2984d010a97913040 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 16:08:55 -0700 Subject: [PATCH 08/51] Added signup component. --- app/component/signup/signup.html | 26 ++++++++++++++++++++++++++ app/component/signup/signup.js | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html index e69de29b..c3755103 100644 --- a/app/component/signup/signup.html +++ b/app/component/signup/signup.html @@ -0,0 +1,26 @@ + diff --git a/app/component/signup/signup.js b/app/component/signup/signup.js index e69de29b..3da31c61 100644 --- a/app/component/signup/signup.js +++ b/app/component/signup/signup.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = { + template: require('./signup.html'), + controller: ['$log', '$location', 'authService', SignupController], + controllerAs: 'signupCtrl' +}; + +function SignupController($log, $location, authService) { + $log.debug('SignupController'); + + authService.getToken() + .then( () => { + $location.url('/home'); + }); + + this.signup = function(user) { + $log.debug('SignupController.signup'); + + authService.signup(user) + .then( () => { + $location.url('/home'); + }); + }; +} From 7d3a1f652021a9fdbcb0322a58f90425213e42ff Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 16:22:41 -0700 Subject: [PATCH 09/51] Added login component. --- app/component/login/login.html | 33 +++++++++++++++++++++++++++++++++ app/component/login/login.js | 27 +++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/app/component/login/login.html b/app/component/login/login.html index e69de29b..237c5b9c 100644 --- a/app/component/login/login.html +++ b/app/component/login/login.html @@ -0,0 +1,33 @@ + diff --git a/app/component/login/login.js b/app/component/login/login.js index e69de29b..77c2c83e 100644 --- a/app/component/login/login.js +++ b/app/component/login/login.js @@ -0,0 +1,27 @@ +'use strict'; + +require('./_login.scss'); + +module.exports = { + template: require('./login.html'), + controller: ['$log', '$location', 'authService', LoginController], + controllerAs: 'loginCtrl' +}; + +function LoginController($log, $location, authService) { + $log.debug('LoginController'); + + authService.getToken() + .then( () => { + $location.url('/home'); + }); + + this.login = function() { + $log.debug('loginCtrl.login'); + + authService.login(this.user) + .then( () => { + $location.url('/home'); + }); + }; +} From 7708f74133e68228411dd0a9080a57992dc87a03 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 17:51:54 -0700 Subject: [PATCH 10/51] Starting on styling. --- app/component/login/login.html | 50 ++++++++++++++++--------------- app/component/signup/signup.html | 36 +++++++++++----------- app/index.html | 18 +++++++++++ app/scss/lib/base/_base.scss | 6 ++++ app/scss/lib/base/_reset.scss | 48 +++++++++++++++++++++++++++++ app/scss/lib/layout/_content.scss | 0 app/scss/lib/layout/_footer.scss | 0 app/scss/lib/layout/_header.scss | 0 app/scss/lib/theme/_vars.scss | 3 ++ app/scss/main.scss | 8 +++++ package.json | 7 ++++- 11 files changed, 134 insertions(+), 42 deletions(-) create mode 100644 app/scss/lib/base/_base.scss create mode 100644 app/scss/lib/base/_reset.scss create mode 100644 app/scss/lib/layout/_content.scss create mode 100644 app/scss/lib/layout/_footer.scss create mode 100644 app/scss/lib/layout/_header.scss create mode 100644 app/scss/lib/theme/_vars.scss diff --git a/app/component/login/login.html b/app/component/login/login.html index 237c5b9c..f1190f57 100644 --- a/app/component/login/login.html +++ b/app/component/login/login.html @@ -3,31 +3,33 @@ name="loginForm" ng-submit="loginCtrl.login()" novalidate> -
- sign in. +
+ +
+
+ -
-
- -
+
- + + diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html index c3755103..0d3f4ec7 100644 --- a/app/component/signup/signup.html +++ b/app/component/signup/signup.html @@ -2,25 +2,27 @@ diff --git a/app/index.html b/app/index.html index e69de29b..2387e119 100644 --- a/app/index.html +++ b/app/index.html @@ -0,0 +1,18 @@ + + + + + + cf gramz + + +
+
+

cfgram

+
+
+ +
+
+ + diff --git a/app/scss/lib/base/_base.scss b/app/scss/lib/base/_base.scss new file mode 100644 index 00000000..9a240bf8 --- /dev/null +++ b/app/scss/lib/base/_base.scss @@ -0,0 +1,6 @@ +.icon { + height: 50px; + width: 50px; + background-image: url('../assets/images/cf-logo.png'); + background-size: cover; +} diff --git a/app/scss/lib/base/_reset.scss b/app/scss/lib/base/_reset.scss new file mode 100644 index 00000000..ed11813c --- /dev/null +++ b/app/scss/lib/base/_reset.scss @@ -0,0 +1,48 @@ +/* http://meyerweb.com/eric/tools/css/reset/ + v2.0 | 20110126 + License: none (public domain) +*/ + +html, body, div, span, applet, object, iframe, +h1, h2, h3, h4, h5, h6, p, blockquote, pre, +a, abbr, acronym, address, big, cite, code, +del, dfn, em, img, ins, kbd, q, s, samp, +small, strike, strong, sub, sup, tt, var, +b, u, i, center, +dl, dt, dd, ol, ul, li, +fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td, +article, aside, canvas, details, embed, +figure, figcaption, footer, header, hgroup, +menu, nav, output, ruby, section, summary, +time, mark, audio, video { + margin: 0; + padding: 0; + border: 0; + font-size: 100%; + font: inherit; + vertical-align: baseline; +} +/* HTML5 display-role reset for older browsers */ +article, aside, details, figcaption, figure, +footer, header, hgroup, menu, nav, section { + display: block; +} +body { + line-height: 1; +} +ol, ul { + list-style: none; +} +blockquote, q { + quotes: none; +} +blockquote:before, blockquote:after, +q:before, q:after { + content: ''; + content: none; +} +table { + border-collapse: collapse; + border-spacing: 0; +} diff --git a/app/scss/lib/layout/_content.scss b/app/scss/lib/layout/_content.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/scss/lib/layout/_footer.scss b/app/scss/lib/layout/_footer.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/scss/lib/layout/_header.scss b/app/scss/lib/layout/_header.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/scss/lib/theme/_vars.scss b/app/scss/lib/theme/_vars.scss new file mode 100644 index 00000000..b4709a0c --- /dev/null +++ b/app/scss/lib/theme/_vars.scss @@ -0,0 +1,3 @@ +$dark: #333; +$white: #fff; +$light: #b3b3b3; diff --git a/app/scss/main.scss b/app/scss/main.scss index e69de29b..fcc0e454 100644 --- a/app/scss/main.scss +++ b/app/scss/main.scss @@ -0,0 +1,8 @@ +//+++++ BASE +++++\\ +@import './lib/base/reset'; +@import './lib/base/base'; + +//+++++ LAYOUTZ +++++\\ +@import './lib/layout/header'; +@import './lib/layout/content'; +@import './lib/layout/footer'; diff --git a/package.json b/package.json index 47a5c3b3..aa6d9000 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,11 @@ "description": "![cf](https://i.imgur.com/7v5ASc8.png) Lab 25 - Client Side Auth ======", "main": "karma.config.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "build": "./node_modules/webpack/bin/webpack.js", + "build-watch": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot", + "lint": "eslint **/*.js --ignore-pattern node_modules/", + "test": "./node_modules/karma/bin/karma start --single-run", + "test-watch": "./node_modules/karma/bin/karma start" }, "repository": { "type": "git", @@ -44,6 +48,7 @@ "webpack": "^2.3.2" }, "devDependencies": { + "eslint": "^3.18.0", "webpack-dev-server": "^2.4.2" } } From 74ac040d1b2402c0c052f3c6a968c5a2ba86427a Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 18:57:49 -0700 Subject: [PATCH 11/51] Working on styling header. --- app/scss/lib/base/_base.scss | 16 ++++++++++++++-- app/scss/lib/layout/_header.scss | 20 ++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/app/scss/lib/base/_base.scss b/app/scss/lib/base/_base.scss index 9a240bf8..d4ba9db9 100644 --- a/app/scss/lib/base/_base.scss +++ b/app/scss/lib/base/_base.scss @@ -1,6 +1,18 @@ +@import '../theme/vars'; + +body { + font-family: helvetica; +} + +header { + background-color: $dark; + + h2 { + color: $white; + } +} + .icon { - height: 50px; - width: 50px; background-image: url('../assets/images/cf-logo.png'); background-size: cover; } diff --git a/app/scss/lib/layout/_header.scss b/app/scss/lib/layout/_header.scss index e69de29b..4346172c 100644 --- a/app/scss/lib/layout/_header.scss +++ b/app/scss/lib/layout/_header.scss @@ -0,0 +1,20 @@ +header { + width: 100%; + height: 80px; + overflow: auto; + + div { + float: left; + height: 50px; + width: 50px; + margin-top: 15px; + margin-left: 25px; + } + + h2 { + float: left; + margin-left: 10px; + margin-top: 30px; + font-size: 3vw; + } +} From 9817d770856a0643dd11fa3b89fbfc05e3360285 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 20:59:54 -0700 Subject: [PATCH 12/51] Sign in page is looking pretty good. --- app/component/login/login.html | 10 ++++---- app/scss/lib/base/_base.scss | 39 ++++++++++++++++++++++++++++--- app/scss/lib/layout/_content.scss | 35 +++++++++++++++++++++++++++ app/scss/lib/layout/_footer.scss | 6 +++++ app/scss/lib/layout/_header.scss | 5 +++- app/view/landing/landing.html | 8 ++++--- 6 files changed, 92 insertions(+), 11 deletions(-) diff --git a/app/component/login/login.html b/app/component/login/login.html index f1190f57..41f502fa 100644 --- a/app/component/login/login.html +++ b/app/component/login/login.html @@ -3,13 +3,14 @@ name="loginForm" ng-submit="loginCtrl.login()" novalidate> - + diff --git a/app/scss/lib/base/_base.scss b/app/scss/lib/base/_base.scss index d4ba9db9..f01478be 100644 --- a/app/scss/lib/base/_base.scss +++ b/app/scss/lib/base/_base.scss @@ -2,6 +2,7 @@ body { font-family: helvetica; + background-color: $light; } header { @@ -10,9 +11,41 @@ header { h2 { color: $white; } + + .icon { + background-image: url('../assets/images/cf-logo.png'); + background-size: cover; + } +} + +p { + float: right; + margin-top: 10px; + margin-right: 150px; +} + +a { + text-decoration: none; + color: black; + font-weight: bolder; +} + +button { + background-color: $dark; + color: $white; + font-size: 15px; + border-radius: 5px; +} + +footer { + background-color: $dark / 2; +} + +.input-std { + border-radius: 3px; } -.icon { - background-image: url('../assets/images/cf-logo.png'); - background-size: cover; +::-webkit-input-placeholder { + text-indent: 10px; + font-size: 12px; } diff --git a/app/scss/lib/layout/_content.scss b/app/scss/lib/layout/_content.scss index e69de29b..67309518 100644 --- a/app/scss/lib/layout/_content.scss +++ b/app/scss/lib/layout/_content.scss @@ -0,0 +1,35 @@ +.sign { + float: left; + padding-top: 30px; + margin-left: 4%; +} + +.clearfix { + clear: both; +} + +.input-std { + width: 90%; + height: 30px; + margin-left: 4%; + margin-top: 20px; +} + +.btn-std { + float: right; + height: 35px; + width: 150px; + margin-top: 20px; + margin-right: 5%; +} + +a{ + float: right; + margin-right: 5%; + margin-top: 10px; +} + +p { + margin-top: 10px; + margin-right: 10px; +} diff --git a/app/scss/lib/layout/_footer.scss b/app/scss/lib/layout/_footer.scss index e69de29b..18d6c21c 100644 --- a/app/scss/lib/layout/_footer.scss +++ b/app/scss/lib/layout/_footer.scss @@ -0,0 +1,6 @@ +footer { + width: 100%; + height: 10%; + position: absolute; + bottom: 0; +} diff --git a/app/scss/lib/layout/_header.scss b/app/scss/lib/layout/_header.scss index 4346172c..0172ef2e 100644 --- a/app/scss/lib/layout/_header.scss +++ b/app/scss/lib/layout/_header.scss @@ -15,6 +15,9 @@ header { float: left; margin-left: 10px; margin-top: 30px; - font-size: 3vw; + font-size: 20px; + line-height: 20px; + font-weight: 100; + letter-spacing: 1.5px; } } diff --git a/app/view/landing/landing.html b/app/view/landing/landing.html index 68029964..fe53090e 100644 --- a/app/view/landing/landing.html +++ b/app/view/landing/landing.html @@ -3,11 +3,12 @@ ng-if="landingCtrl.showSignup">
-

already a member?

+
sign in here - + +

already a member?

@@ -15,11 +16,12 @@ ng-if="!landingCtrl.showSignup">
-

want to sign up?

+
sign up here +

want to sign up?

From 26a786b3ebf4b8a5d3a09b42d246dc2e8b7f502f Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 21:16:35 -0700 Subject: [PATCH 13/51] Styling almost there. --- app/component/signup/signup.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html index 0d3f4ec7..07152859 100644 --- a/app/component/signup/signup.html +++ b/app/component/signup/signup.html @@ -2,7 +2,7 @@ From a06e1bb8c71a5c979605f4547d1463be348a6a7d Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 28 Mar 2017 22:55:53 -0700 Subject: [PATCH 14/51] Finished styling buttons. --- app/scss/lib/base/_base.scss | 7 ++++++- app/view/home/_home.scss | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/scss/lib/base/_base.scss b/app/scss/lib/base/_base.scss index f01478be..086d42c0 100644 --- a/app/scss/lib/base/_base.scss +++ b/app/scss/lib/base/_base.scss @@ -30,11 +30,16 @@ a { font-weight: bolder; } -button { +.btn-std { background-color: $dark; color: $white; font-size: 15px; border-radius: 5px; + + &:hover { + cursor: pointer; + background-color: $dark / 2; + } } footer { diff --git a/app/view/home/_home.scss b/app/view/home/_home.scss index e69de29b..9d4c4332 100644 --- a/app/view/home/_home.scss +++ b/app/view/home/_home.scss @@ -0,0 +1,5 @@ +h2 { + text-align: center; + margin-top: 30px; + font-size: 30px; +} From 27a2b5bf22514a3427326d65b4c0582fe0175e54 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 16:17:23 -0700 Subject: [PATCH 15/51] Configured debug logs to toggle off in production mode. Webpack not loading the variable properly so I hardcoded true for now. --- app/config/log-config.js | 7 +++++++ webpack.config.js | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 app/config/log-config.js diff --git a/app/config/log-config.js b/app/config/log-config.js new file mode 100644 index 00000000..5d187b8b --- /dev/null +++ b/app/config/log-config.js @@ -0,0 +1,7 @@ +'use strict'; + +module.exports = ['$logProvider', logConfig]; + +function logConfig($logProvider) { + $logProvider.debugEnabled(true);//eslint-disable-line +} diff --git a/webpack.config.js b/webpack.config.js index 6afacb2a..e6228a18 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,11 +1,14 @@ 'use strict'; -require('dotenv').load(); - +const dotenv = require('dotenv'); const webpack = require('webpack'); const HTMLPlugin = require('html-webpack-plugin'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); +const production = process.env.NODE_ENV === 'production'; + +dotenv.load(); + module.exports = { devtool: 'eval', entry: `${__dirname}/app/entry.js`, @@ -19,7 +22,8 @@ module.exports = { }), new ExtractTextPlugin('bundle.css'), new webpack.DefinePlugin({ - __API_URL__: JSON.stringify(process.env.API_URL) //__webpack_constant__ + __API_URL__: JSON.stringify(process.env.API_URL), + __DEBUG__: JSON.stringify(!production) }) ], module: { From b38166b55f0e8205db1fb5e332911926bc1fd980 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 16:49:08 -0700 Subject: [PATCH 16/51] Added gallery service with methods to post or delete one and fetch all. --- app/service/gallery-service.js | 90 ++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 app/service/gallery-service.js diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js new file mode 100644 index 00000000..f32244bb --- /dev/null +++ b/app/service/gallery-service.js @@ -0,0 +1,90 @@ +'use strict'; + +module.exports = ['$q', '$log', '$http', 'authService', galleryService]; + +function galleryService($q, $log, $http, authService) { + $log.debug('galleryService'); + + let service = {}; + service.galleries = []; + + service.createGallery = function(gallery) { + $log.debug('galleryService.createGallery'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery`; //eslint-disable-line + let config = { + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + Authorization: `Bearer ${token}` + } + }; + + return $http.post(url, gallery, config); + }) + .then( res => { + $log.log('gallery created'); + let gallery = res.data; + service.galleries.unshift(gallery); + return gallery; + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + + service.fetchGalleries = function() { + $log.debug('galleryService.fetchGalleries'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery`;//eslint-disable-line + let config = { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${token}` + } + }; + + return $http.get(url, config); + }) + .then( res => { + $log.log('got your galleries'); + let galleries = res.data; + service.galleries = galleries; + return service.galleries; + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + + service.deleteGalleries = function(galleryID, galleryData) { + $log.debug('galleryService.deleteGalleries'); + $log.log(galleryData); + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery/${galleryID}`; //eslint-disable-line + let config = { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${token}` + } + }; + + return $http.delete(url, config); + }) + .then( res => { + $log.log('gallery removed'); + return JSON.parse(res.status); + }) + .catch( err => { + $log.error(err); + return $q.reject(err); + }); + }; +} From 4550b9894ab931789f9ffb890f26a9de5ad7c8c7 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 16:59:37 -0700 Subject: [PATCH 17/51] Scaffolding new navbar component and restructured landing page components. --- .../_create-gallery.scss} | 0 .../create-gallery.html} | 0 app/component/gallery/create-gallery.js | 0 app/component/landing/login/_login.scss | 0 app/component/{ => landing}/login/login.html | 0 app/component/{ => landing}/login/login.js | 0 app/component/landing/signup/_signup.scss | 0 .../{ => landing}/signup/signup.html | 0 app/component/{ => landing}/signup/signup.js | 0 app/component/navbar/_navbar.scss | 0 app/component/navbar/navbar.html | 0 app/component/navbar/navbar.js | 44 +++++++++++++++++++ 12 files changed, 44 insertions(+) rename app/component/{login/_login.scss => gallery/_create-gallery.scss} (100%) rename app/component/{signup/_signup.scss => gallery/create-gallery.html} (100%) create mode 100644 app/component/gallery/create-gallery.js create mode 100644 app/component/landing/login/_login.scss rename app/component/{ => landing}/login/login.html (100%) rename app/component/{ => landing}/login/login.js (100%) create mode 100644 app/component/landing/signup/_signup.scss rename app/component/{ => landing}/signup/signup.html (100%) rename app/component/{ => landing}/signup/signup.js (100%) create mode 100644 app/component/navbar/_navbar.scss create mode 100644 app/component/navbar/navbar.html create mode 100644 app/component/navbar/navbar.js diff --git a/app/component/login/_login.scss b/app/component/gallery/_create-gallery.scss similarity index 100% rename from app/component/login/_login.scss rename to app/component/gallery/_create-gallery.scss diff --git a/app/component/signup/_signup.scss b/app/component/gallery/create-gallery.html similarity index 100% rename from app/component/signup/_signup.scss rename to app/component/gallery/create-gallery.html diff --git a/app/component/gallery/create-gallery.js b/app/component/gallery/create-gallery.js new file mode 100644 index 00000000..e69de29b diff --git a/app/component/landing/login/_login.scss b/app/component/landing/login/_login.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/login/login.html b/app/component/landing/login/login.html similarity index 100% rename from app/component/login/login.html rename to app/component/landing/login/login.html diff --git a/app/component/login/login.js b/app/component/landing/login/login.js similarity index 100% rename from app/component/login/login.js rename to app/component/landing/login/login.js diff --git a/app/component/landing/signup/_signup.scss b/app/component/landing/signup/_signup.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/signup/signup.html b/app/component/landing/signup/signup.html similarity index 100% rename from app/component/signup/signup.html rename to app/component/landing/signup/signup.html diff --git a/app/component/signup/signup.js b/app/component/landing/signup/signup.js similarity index 100% rename from app/component/signup/signup.js rename to app/component/landing/signup/signup.js diff --git a/app/component/navbar/_navbar.scss b/app/component/navbar/_navbar.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/navbar/navbar.html b/app/component/navbar/navbar.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/navbar/navbar.js b/app/component/navbar/navbar.js new file mode 100644 index 00000000..79cb21a8 --- /dev/null +++ b/app/component/navbar/navbar.js @@ -0,0 +1,44 @@ +'use strict'; + +require('./_navbar.scss'); + +module.exports = { + template: require('./navbar.html'), + controller: ['$log', '$location', '$rootScope', 'authService', NavbarController], + controllerAs: 'navbarCtrl' +}; + +function NavbarController($log, $location, $rootScope, authService) { + $log.debug('NavbarController'); + + this.checkPath = function() { + let path = $location.path(); + if (path === '/join') { + this.hideButtons = true; + } + + if (path !== '/join') { + this.hideButtons = false; + authService.getToken() + .catch( () => { + $location.url('/join#login'); + }); + } + }; + + this.checkPath(); + + $rootScope.$on('$locationChangeSuccess', () => { + this.checkPath(); + }); + + this.logout = function() { + $log.log('navbarCtrl.logout'); + + this.hideButtons = true; + authService.logout() + .then( () => { + $location.url('/'); + }); + }; +} From fc10ab0448f446ed3fdf39461ace1ca2756a8dde Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 17:04:21 -0700 Subject: [PATCH 18/51] Added navbar html template. Added custom directive to index in header. --- app/component/navbar/navbar.html | 10 ++++++++++ app/index.html | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/component/navbar/navbar.html b/app/component/navbar/navbar.html index e69de29b..8dba7a2f 100644 --- a/app/component/navbar/navbar.html +++ b/app/component/navbar/navbar.html @@ -0,0 +1,10 @@ + diff --git a/app/index.html b/app/index.html index 2387e119..381ec277 100644 --- a/app/index.html +++ b/app/index.html @@ -7,8 +7,7 @@
-
-

cfgram

+
From e9120781181b1175159aaef18dfd3ffde7bfd368 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 17:07:08 -0700 Subject: [PATCH 19/51] Added controller and html template for component to create a new gallery. --- app/component/gallery/create-gallery.html | 25 +++++++++++++++++++++++ app/component/gallery/create-gallery.js | 21 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/app/component/gallery/create-gallery.html b/app/component/gallery/create-gallery.html index e69de29b..c7e15708 100644 --- a/app/component/gallery/create-gallery.html +++ b/app/component/gallery/create-gallery.html @@ -0,0 +1,25 @@ + diff --git a/app/component/gallery/create-gallery.js b/app/component/gallery/create-gallery.js index e69de29b..a6da00a7 100644 --- a/app/component/gallery/create-gallery.js +++ b/app/component/gallery/create-gallery.js @@ -0,0 +1,21 @@ +'use strict'; + +module.exports = { + template: require('./create-gallery.html'), + controller: ['$log', 'galleryService', CreateGalleryController], + controllerAs: 'createGalleryCtrl' +}; + +function CreateGalleryController($log, galleryService) { + $log.debug('CreateGalleryController'); + + this.gallery = {}; + + this.createGallery = function() { + galleryService.createGallery(this.gallery) + .then( () => { + this.gallery.name = null; + this.gallery.desc = null; + }); + }; +} From 5a4bf136f4b314ff0be34277d22aea8999b3a72c Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 22:11:52 -0700 Subject: [PATCH 20/51] Added home view template and controller. --- app/view/home/home-controller.js | 20 +++++++++++++++++--- app/view/home/home.html | 10 +++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/view/home/home-controller.js b/app/view/home/home-controller.js index 6cf237e8..4640d170 100644 --- a/app/view/home/home-controller.js +++ b/app/view/home/home-controller.js @@ -2,9 +2,23 @@ require('./_home.scss'); -module.exports = ['$log', HomeController]; +module.exports = ['$log', '$rootScope', 'galleryService', HomeController]; -function HomeController($log) { +function HomeController($log, $rootScope, galleryService) { $log.debug('HomeController'); - this.title = 'Tere tulemast koju!'; + + this.galleries = []; + + this.fetchGalleries = function() { + galleryService.fetchGalleries() + .then( galleries => { + this.galleries = galleries; + }); + }; + + this.fetchGalleries(); + + $rootScope.$on('$locationChangeSuccess', () => { + this.fetchGalleries(); + }); } diff --git a/app/view/home/home.html b/app/view/home/home.html index da83caab..9c023fb5 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -1,3 +1,11 @@
-

{{ homeCtrl.title }}

+ + +
    +
  • + name: {{ gallery.name }} + description: {{ gallery.desc }} + id: {{ gallery._id }} +
  • +
From 5aaa6f13c96dfaf5199d706c7b6a293b2dc66119 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 22:47:28 -0700 Subject: [PATCH 21/51] Sign out button styled. --- app/component/navbar/_navbar.scss | 14 ++++++++++++++ app/component/navbar/navbar.html | 2 +- app/scss/main.scss | 4 ++++ app/view/home/_home.scss | 6 +----- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/app/component/navbar/_navbar.scss b/app/component/navbar/_navbar.scss index e69de29b..5d926d14 100644 --- a/app/component/navbar/_navbar.scss +++ b/app/component/navbar/_navbar.scss @@ -0,0 +1,14 @@ +@import '../../scss/lib/theme/vars'; + +nav { + float: right; + margin-right: 25px; + + .btn-std { + margin-top: 10px; + width: 125px; + height: 30px; + background-color: $white; + color: $dark; + } +} diff --git a/app/component/navbar/navbar.html b/app/component/navbar/navbar.html index 8dba7a2f..f36816b3 100644 --- a/app/component/navbar/navbar.html +++ b/app/component/navbar/navbar.html @@ -4,7 +4,7 @@

cf gram

diff --git a/app/scss/main.scss b/app/scss/main.scss index fcc0e454..fdeab693 100644 --- a/app/scss/main.scss +++ b/app/scss/main.scss @@ -6,3 +6,7 @@ @import './lib/layout/header'; @import './lib/layout/content'; @import './lib/layout/footer'; + +//+++++ VIEWS +++++\\ +@import '../view/landing/landing'; +@import '../view/home/home'; diff --git a/app/view/home/_home.scss b/app/view/home/_home.scss index 9d4c4332..8b137891 100644 --- a/app/view/home/_home.scss +++ b/app/view/home/_home.scss @@ -1,5 +1 @@ -h2 { - text-align: center; - margin-top: 30px; - font-size: 30px; -} + From e4d57397709b18156756599304c2f36540c76749 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 23:01:23 -0700 Subject: [PATCH 22/51] Form fields for creating a gallery styled. --- app/component/gallery/_create-gallery.scss | 9 ++++++ app/component/gallery/create-gallery.html | 5 +-- app/component/gallery/create-gallery.js | 2 ++ app/component/login/login.html | 37 ++++++++++++++++++++++ app/component/signup/signup.js | 25 +++++++++++++++ 5 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 app/component/login/login.html create mode 100644 app/component/signup/signup.js diff --git a/app/component/gallery/_create-gallery.scss b/app/component/gallery/_create-gallery.scss index e69de29b..c0d25bc1 100644 --- a/app/component/gallery/_create-gallery.scss +++ b/app/component/gallery/_create-gallery.scss @@ -0,0 +1,9 @@ +@import '../../scss/lib/theme/vars'; + +label { + color: $dark * 2; + float: left; + margin-left: 40px; + padding-top: 20px; + font-size: 20px; +} diff --git a/app/component/gallery/create-gallery.html b/app/component/gallery/create-gallery.html index c7e15708..ac5f6179 100644 --- a/app/component/gallery/create-gallery.html +++ b/app/component/gallery/create-gallery.html @@ -3,19 +3,20 @@ class="gallery-form" ng-submit="createGalleryCtrl.createGallery()">
- +
- diff --git a/app/component/gallery/create-gallery.js b/app/component/gallery/create-gallery.js index a6da00a7..cabb2be6 100644 --- a/app/component/gallery/create-gallery.js +++ b/app/component/gallery/create-gallery.js @@ -1,5 +1,7 @@ 'use strict'; +require('./_create-gallery.scss'); + module.exports = { template: require('./create-gallery.html'), controller: ['$log', 'galleryService', CreateGalleryController], diff --git a/app/component/login/login.html b/app/component/login/login.html new file mode 100644 index 00000000..41f502fa --- /dev/null +++ b/app/component/login/login.html @@ -0,0 +1,37 @@ + diff --git a/app/component/signup/signup.js b/app/component/signup/signup.js new file mode 100644 index 00000000..3da31c61 --- /dev/null +++ b/app/component/signup/signup.js @@ -0,0 +1,25 @@ +'use strict'; + +module.exports = { + template: require('./signup.html'), + controller: ['$log', '$location', 'authService', SignupController], + controllerAs: 'signupCtrl' +}; + +function SignupController($log, $location, authService) { + $log.debug('SignupController'); + + authService.getToken() + .then( () => { + $location.url('/home'); + }); + + this.signup = function(user) { + $log.debug('SignupController.signup'); + + authService.signup(user) + .then( () => { + $location.url('/home'); + }); + }; +} From b62b2233d632585f983ba881fff6485ddc366d94 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 29 Mar 2017 23:47:34 -0700 Subject: [PATCH 23/51] Galleries styled. --- app/component/signup/signup.html | 27 +++++++++++++++++++++++++++ app/service/gallery-service.js | 2 ++ app/view/home/_home.scss | 30 ++++++++++++++++++++++++++++++ app/view/home/home.html | 15 ++++++++++----- 4 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 app/component/signup/signup.html diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html new file mode 100644 index 00000000..07152859 --- /dev/null +++ b/app/component/signup/signup.html @@ -0,0 +1,27 @@ + diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index f32244bb..a4cd7d1b 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -87,4 +87,6 @@ function galleryService($q, $log, $http, authService) { return $q.reject(err); }); }; + + return service; } diff --git a/app/view/home/_home.scss b/app/view/home/_home.scss index 8b137891..0149867b 100644 --- a/app/view/home/_home.scss +++ b/app/view/home/_home.scss @@ -1 +1,31 @@ +@import '../../scss/lib/theme/vars'; +h2 { + margin-left: 5%; + margin-top: 50px; + color: $dark * 2; + font-size: 1.3em; +} + +.gallery-box { + height: 80px; + width: 90%; + margin-left: 5%; + margin-top: 20px; + background-color: $light / 1.5; + border-radius: 5px; + padding: 5px; + + li { + margin-left: 10px; + font-size: 15px; + line-height: 25px; + color: $dark / 2; + font-weight: bolder; + + span { + color: $dark; + font-weight: normal; + } + } +} diff --git a/app/view/home/home.html b/app/view/home/home.html index 9c023fb5..1edd968b 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -1,11 +1,16 @@
- +
+

Galleries

    -
  • - name: {{ gallery.name }} - description: {{ gallery.desc }} - id: {{ gallery._id }} +
From b09a7575f4f054f22e83db2244ee2b86e4fc68f7 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 30 Mar 2017 21:36:28 -0700 Subject: [PATCH 24/51] Updated gallery service to include update and delete methods. --- app/service/gallery-service.js | 63 ++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index a4cd7d1b..1e6c4e29 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -88,5 +88,68 @@ function galleryService($q, $log, $http, authService) { }); }; + service.updateGalleries = function(galleryID, galleryData) { + $log.debug('galleryService.updateGalleries'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery/${galleryID}`; //eslint-disable-line + let config = { + headers: { + Accept: 'application/json', + Authorization: `Bearer ${token}`, + 'Content-Type': 'application/json' + } + }; + + return $http.put(url, galleryData, config); + }) + .then( res => { + for (let i = 0; i < service.galleries.length; i++) { + let current = service.galleries[i]; + if (current._id === galleryID) { + service.gallery[i] = res.data; + break; + } + } + + return res.data; + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + + service.deleteGallery = function(galleryID) { + $log.debug('galleryService.deleteGallery'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery/${galleryID}`; //eslint-disable-line + let config = { + headers: { + Authorization: `Bearer ${token}` + } + }; + + return $http.delete(url, config); + }) + .then( res => { + $log.log(res); + for (let i=0; i < service.galleries.length; i++) { + let current = service.galleries[i]; + if (current._id === galleryID) { + service.galleries.splice(i, 1); + break; + } + } + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + return service; } From 870f4c37aab6a497565de5c4e545541d8fc82462 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 30 Mar 2017 21:48:02 -0700 Subject: [PATCH 25/51] Scaffolding gallery components file structure. --- app/component/gallery/{ => create-gallery}/_create-gallery.scss | 2 +- app/component/gallery/{ => create-gallery}/create-gallery.html | 0 app/component/gallery/{ => create-gallery}/create-gallery.js | 0 app/component/gallery/edit-gallery/_edit-gallery.scss | 0 app/component/gallery/edit-gallery/edit-gallery.html | 0 app/component/gallery/edit-gallery/edit-gallery.js | 0 app/component/gallery/gallery-item/_gallery-item.scss | 0 app/component/gallery/gallery-item/gallery-item.html | 0 app/component/gallery/gallery-item/gallery-item.js | 0 9 files changed, 1 insertion(+), 1 deletion(-) rename app/component/gallery/{ => create-gallery}/_create-gallery.scss (72%) rename app/component/gallery/{ => create-gallery}/create-gallery.html (100%) rename app/component/gallery/{ => create-gallery}/create-gallery.js (100%) create mode 100644 app/component/gallery/edit-gallery/_edit-gallery.scss create mode 100644 app/component/gallery/edit-gallery/edit-gallery.html create mode 100644 app/component/gallery/edit-gallery/edit-gallery.js create mode 100644 app/component/gallery/gallery-item/_gallery-item.scss create mode 100644 app/component/gallery/gallery-item/gallery-item.html create mode 100644 app/component/gallery/gallery-item/gallery-item.js diff --git a/app/component/gallery/_create-gallery.scss b/app/component/gallery/create-gallery/_create-gallery.scss similarity index 72% rename from app/component/gallery/_create-gallery.scss rename to app/component/gallery/create-gallery/_create-gallery.scss index c0d25bc1..0fe57ca9 100644 --- a/app/component/gallery/_create-gallery.scss +++ b/app/component/gallery/create-gallery/_create-gallery.scss @@ -1,4 +1,4 @@ -@import '../../scss/lib/theme/vars'; +@import '../../../scss/lib/theme/vars'; label { color: $dark * 2; diff --git a/app/component/gallery/create-gallery.html b/app/component/gallery/create-gallery/create-gallery.html similarity index 100% rename from app/component/gallery/create-gallery.html rename to app/component/gallery/create-gallery/create-gallery.html diff --git a/app/component/gallery/create-gallery.js b/app/component/gallery/create-gallery/create-gallery.js similarity index 100% rename from app/component/gallery/create-gallery.js rename to app/component/gallery/create-gallery/create-gallery.js diff --git a/app/component/gallery/edit-gallery/_edit-gallery.scss b/app/component/gallery/edit-gallery/_edit-gallery.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/edit-gallery/edit-gallery.html b/app/component/gallery/edit-gallery/edit-gallery.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/edit-gallery/edit-gallery.js b/app/component/gallery/edit-gallery/edit-gallery.js new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/gallery-item/_gallery-item.scss b/app/component/gallery/gallery-item/_gallery-item.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/gallery-item/gallery-item.html b/app/component/gallery/gallery-item/gallery-item.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/gallery-item/gallery-item.js b/app/component/gallery/gallery-item/gallery-item.js new file mode 100644 index 00000000..e69de29b From 885e4362cc0155a3c69f57d34f3b07b6ea9e67be Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 30 Mar 2017 22:06:01 -0700 Subject: [PATCH 26/51] Added components for displaying and editing individual galleries. Plugged directives in to appropriate places in markup. --- .../gallery/edit-gallery/edit-gallery.html | 25 +++++++++++++++++++ .../gallery/edit-gallery/edit-gallery.js | 22 ++++++++++++++++ .../gallery/gallery-item/gallery-item.html | 22 ++++++++++++++++ .../gallery/gallery-item/gallery-item.js | 22 ++++++++++++++++ app/view/home/home.html | 5 ++-- 5 files changed, 94 insertions(+), 2 deletions(-) diff --git a/app/component/gallery/edit-gallery/edit-gallery.html b/app/component/gallery/edit-gallery/edit-gallery.html index e69de29b..f29c12d7 100644 --- a/app/component/gallery/edit-gallery/edit-gallery.html +++ b/app/component/gallery/edit-gallery/edit-gallery.html @@ -0,0 +1,25 @@ +
+ +
diff --git a/app/component/gallery/edit-gallery/edit-gallery.js b/app/component/gallery/edit-gallery/edit-gallery.js index e69de29b..06e1da5f 100644 --- a/app/component/gallery/edit-gallery/edit-gallery.js +++ b/app/component/gallery/edit-gallery/edit-gallery.js @@ -0,0 +1,22 @@ +'use strict'; + +require('./_edit-gallery.scss'); + +module.exports = { + template: require('./edit-gallery.html'), + controller: ['$log', 'galleryService', EditGalleryController], + controllerAs: 'editGallery', + bindings: { + gallery: '<' + } +}; + +function EditGalleryController($log, galleryService) { + $log.debug('EditGalleryController'); + + this.updateGallery = function() { + $log.debug('editGalleryCtrl.updateGallery'); + + galleryService.updateGallery(this.gallery._id, this.gallery); + }; +} diff --git a/app/component/gallery/gallery-item/gallery-item.html b/app/component/gallery/gallery-item/gallery-item.html index e69de29b..52491bd2 100644 --- a/app/component/gallery/gallery-item/gallery-item.html +++ b/app/component/gallery/gallery-item/gallery-item.html @@ -0,0 +1,22 @@ + diff --git a/app/component/gallery/gallery-item/gallery-item.js b/app/component/gallery/gallery-item/gallery-item.js index e69de29b..ff83bc53 100644 --- a/app/component/gallery/gallery-item/gallery-item.js +++ b/app/component/gallery/gallery-item/gallery-item.js @@ -0,0 +1,22 @@ +'use strict'; + +require('./_gallery-item.scss'); + +module.exports = { + template: require('./gallery-item.html'), + controller: ['$log', 'galleryService', GalleryItemController], + controllerAs: 'galleryItemCtrl', + bindings: { + gallery: '<' + } +}; + +function GalleryItemController($log, galleryService) { + $log.debug('GalleryItemController'); + + this.showEditGallery = false; + + this.deleteGallery = function() { + galleryService.deleteGallery(this.gallery._id); + }; +} diff --git a/app/view/home/home.html b/app/view/home/home.html index 1edd968b..49db3dee 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -3,7 +3,7 @@

Galleries

    - + --> +
From 8958b856eef9be5e98731d93fd0f95fa66fc9392 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 30 Mar 2017 22:47:58 -0700 Subject: [PATCH 27/51] Debugged an issue with the edit component. Misspelled the controllerAs so it wasn't linking to the view. --- app/component/gallery/edit-gallery/edit-gallery.js | 2 +- app/service/gallery-service.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/component/gallery/edit-gallery/edit-gallery.js b/app/component/gallery/edit-gallery/edit-gallery.js index 06e1da5f..17fc2434 100644 --- a/app/component/gallery/edit-gallery/edit-gallery.js +++ b/app/component/gallery/edit-gallery/edit-gallery.js @@ -5,7 +5,7 @@ require('./_edit-gallery.scss'); module.exports = { template: require('./edit-gallery.html'), controller: ['$log', 'galleryService', EditGalleryController], - controllerAs: 'editGallery', + controllerAs: 'editGalleryCtrl', bindings: { gallery: '<' } diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index 1e6c4e29..e9473633 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -88,7 +88,7 @@ function galleryService($q, $log, $http, authService) { }); }; - service.updateGalleries = function(galleryID, galleryData) { + service.updateGallery = function(galleryID, galleryData) { $log.debug('galleryService.updateGalleries'); return authService.getToken() @@ -108,7 +108,7 @@ function galleryService($q, $log, $http, authService) { for (let i = 0; i < service.galleries.length; i++) { let current = service.galleries[i]; if (current._id === galleryID) { - service.gallery[i] = res.data; + service.galleries[i] = res.data; break; } } From 90691b7504f32bbe2fb66ae95283748a7b583210 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Sun, 2 Apr 2017 18:33:21 -0700 Subject: [PATCH 28/51] Removed duplicate login directory. --- app/component/login/login.html | 37 ---------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 app/component/login/login.html diff --git a/app/component/login/login.html b/app/component/login/login.html deleted file mode 100644 index 41f502fa..00000000 --- a/app/component/login/login.html +++ /dev/null @@ -1,37 +0,0 @@ - From 61c539c7f0ec48cf30e941067169631345d7df5c Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Sun, 2 Apr 2017 18:34:56 -0700 Subject: [PATCH 29/51] Removed duplicate signup directory. --- app/component/signup/signup.html | 27 --------------------------- app/component/signup/signup.js | 25 ------------------------- 2 files changed, 52 deletions(-) delete mode 100644 app/component/signup/signup.html delete mode 100644 app/component/signup/signup.js diff --git a/app/component/signup/signup.html b/app/component/signup/signup.html deleted file mode 100644 index 07152859..00000000 --- a/app/component/signup/signup.html +++ /dev/null @@ -1,27 +0,0 @@ - diff --git a/app/component/signup/signup.js b/app/component/signup/signup.js deleted file mode 100644 index 3da31c61..00000000 --- a/app/component/signup/signup.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict'; - -module.exports = { - template: require('./signup.html'), - controller: ['$log', '$location', 'authService', SignupController], - controllerAs: 'signupCtrl' -}; - -function SignupController($log, $location, authService) { - $log.debug('SignupController'); - - authService.getToken() - .then( () => { - $location.url('/home'); - }); - - this.signup = function(user) { - $log.debug('SignupController.signup'); - - authService.signup(user) - .then( () => { - $location.url('/home'); - }); - }; -} From 7fbef539fe1b9a93c21bb21ddaad71e87491920d Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 14:46:50 -0700 Subject: [PATCH 30/51] Added service to handle business logic for sending a post request to the api and then adding the response to a gallery. --- app/service/pic-service.js | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/service/pic-service.js diff --git a/app/service/pic-service.js b/app/service/pic-service.js new file mode 100644 index 00000000..4aca96c9 --- /dev/null +++ b/app/service/pic-service.js @@ -0,0 +1,43 @@ +'use strict'; + +module.exports = ['$q', '$log', '$http', 'Upload', 'authService', picService]; + +function picService($q, $log, $http, Upload, authService) { + $log.debug('picService'); + + let service = {}; + + service.uploadGalleryPic = function(galleryData, picData) { + $log.debug('service.uploadGalleryPic'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery/${galleryData._id/pic}`; //eslint-disable-line + let headers = { + Authorization: `Bearer ${token}`, + Accept: 'application/json' + }; + + return Upload.upload({ + url, + headers, + method: 'POST', + data: { + name: picData.name, + desc: picData.desc, + file: picData.file + } + }) + .then( res => { + galleryData.pics.unshift(res.data); + return res.data; + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }); + }; + + return service; +} From c5bb335d717a70c4ef75b14a1b130aaff2e1d113 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 15:45:04 -0700 Subject: [PATCH 31/51] Scaffolding pic upload and thumbnail components. Added pic upload component first. --- .../_thumbnail-container.scss | 0 .../thumbnail-container.html | 0 .../thumbnail-container.js | 0 .../gallery/thumbnail/_thumbnail.scss | 0 .../gallery/thumbnail/thumbnail.html | 0 app/component/gallery/thumbnail/thumbnail.js | 0 .../gallery/upload-pic/_upload-pic.scss | 0 .../gallery/upload-pic/upload-pic.html | 25 +++++++++++++++++ .../gallery/upload-pic/upload.pic.js | 27 +++++++++++++++++++ 9 files changed, 52 insertions(+) create mode 100644 app/component/gallery/thumbnail-container/_thumbnail-container.scss create mode 100644 app/component/gallery/thumbnail-container/thumbnail-container.html create mode 100644 app/component/gallery/thumbnail-container/thumbnail-container.js create mode 100644 app/component/gallery/thumbnail/_thumbnail.scss create mode 100644 app/component/gallery/thumbnail/thumbnail.html create mode 100644 app/component/gallery/thumbnail/thumbnail.js create mode 100644 app/component/gallery/upload-pic/_upload-pic.scss create mode 100644 app/component/gallery/upload-pic/upload-pic.html create mode 100644 app/component/gallery/upload-pic/upload.pic.js diff --git a/app/component/gallery/thumbnail-container/_thumbnail-container.scss b/app/component/gallery/thumbnail-container/_thumbnail-container.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/thumbnail-container/thumbnail-container.html b/app/component/gallery/thumbnail-container/thumbnail-container.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/thumbnail-container/thumbnail-container.js b/app/component/gallery/thumbnail-container/thumbnail-container.js new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/thumbnail/_thumbnail.scss b/app/component/gallery/thumbnail/_thumbnail.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/thumbnail/thumbnail.html b/app/component/gallery/thumbnail/thumbnail.html new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/thumbnail/thumbnail.js b/app/component/gallery/thumbnail/thumbnail.js new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/upload-pic/_upload-pic.scss b/app/component/gallery/upload-pic/_upload-pic.scss new file mode 100644 index 00000000..e69de29b diff --git a/app/component/gallery/upload-pic/upload-pic.html b/app/component/gallery/upload-pic/upload-pic.html new file mode 100644 index 00000000..21205b7c --- /dev/null +++ b/app/component/gallery/upload-pic/upload-pic.html @@ -0,0 +1,25 @@ +
+
+ +

upload a new photo

+ +
+ + +
+ +
+

+ select a file to upload +

+ + +
+ +
+
diff --git a/app/component/gallery/upload-pic/upload.pic.js b/app/component/gallery/upload-pic/upload.pic.js new file mode 100644 index 00000000..6a950f16 --- /dev/null +++ b/app/component/gallery/upload-pic/upload.pic.js @@ -0,0 +1,27 @@ +'use strict'; + +require('./_upload-pic.scss'); + +module.exports = { + template: require('./upload-pic.html'), + controller: ['$log', 'picService', UploadPicController], + controllerAs: 'uploadPicCtrl', + bindings: { + gallery: '<' + } +}; + +function UploadPicController($log, picService) { + $log.debug('UploadPicController'); + + this.pic = {}; + + this.uploadPic = function() { + picService.uploadGalleryPic(this.gallery, this.pic) + .then( () => { + this.pic.name = null; + this.pic.desc = null; + this.pic.file = null; + }); + }; +} From c93b5dc4aa73f523c87da8f6f84c988fb5d16f31 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 15:49:09 -0700 Subject: [PATCH 32/51] added thumbnail and thumbnail container components. --- .../thumbnail-container.html | 11 ++++++++++ .../thumbnail-container.js | 11 ++++++++++ .../gallery/thumbnail/thumbnail.html | 5 +++++ app/component/gallery/thumbnail/thumbnail.js | 21 +++++++++++++++++++ app/view/home/home.html | 4 ++++ 5 files changed, 52 insertions(+) diff --git a/app/component/gallery/thumbnail-container/thumbnail-container.html b/app/component/gallery/thumbnail-container/thumbnail-container.html index e69de29b..f445b23b 100644 --- a/app/component/gallery/thumbnail-container/thumbnail-container.html +++ b/app/component/gallery/thumbnail-container/thumbnail-container.html @@ -0,0 +1,11 @@ +
+

{{ thumbnailContainerCtrl.gallery.name }}

+ + +
+ + + +
+
diff --git a/app/component/gallery/thumbnail-container/thumbnail-container.js b/app/component/gallery/thumbnail-container/thumbnail-container.js index e69de29b..18bf16d4 100644 --- a/app/component/gallery/thumbnail-container/thumbnail-container.js +++ b/app/component/gallery/thumbnail-container/thumbnail-container.js @@ -0,0 +1,11 @@ +'use strict'; + +require('./_thumbnail-container.scss'); + +module.exports = { + template: require('./thumbnail-container.html'), + controllerAs: 'thumbnailContainerCtrl', + bindings: { + gallery: '<' + } +}; diff --git a/app/component/gallery/thumbnail/thumbnail.html b/app/component/gallery/thumbnail/thumbnail.html index e69de29b..cefea4f9 100644 --- a/app/component/gallery/thumbnail/thumbnail.html +++ b/app/component/gallery/thumbnail/thumbnail.html @@ -0,0 +1,5 @@ +
+ {{ thumbnailCtrl.pic.desc }} + delete + +
diff --git a/app/component/gallery/thumbnail/thumbnail.js b/app/component/gallery/thumbnail/thumbnail.js index e69de29b..97436385 100644 --- a/app/component/gallery/thumbnail/thumbnail.js +++ b/app/component/gallery/thumbnail/thumbnail.js @@ -0,0 +1,21 @@ +'use strict'; + +require('./_thumbnail.scss'); + +module.exports = { + template: require('./thumbnail.html'), + controller: ['$log', 'picService', ThumbnailController], + controllerAs: 'thumbnailCtrl', + bindings: { + pic: '<' + } +}; + +function ThumbnailController($log, picService) { //eslint-disable-line + $log.debug('ThumbnailController'); + + this.deletePic = function() { + $log.debug('thumbnailCtrl.deletePic'); + //hits delete pic method in the pic service + }; +} diff --git a/app/view/home/home.html b/app/view/home/home.html index 49db3dee..95f4b221 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -14,4 +14,8 @@

Galleries

--> + + + From f586ae53aa6a7e78557d465b1f5f5ba6ac854ce2 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 15:56:58 -0700 Subject: [PATCH 33/51] Updated home view controller to show thumbnail container. --- app/view/home/home-controller.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/view/home/home-controller.js b/app/view/home/home-controller.js index 4640d170..c33fe804 100644 --- a/app/view/home/home-controller.js +++ b/app/view/home/home-controller.js @@ -18,6 +18,12 @@ function HomeController($log, $rootScope, galleryService) { this.fetchGalleries(); + this.galleryDeleteDone = function(gallery) { + if (this.currentGallery._id === gallery._id) { + this.currentGallery = null; + } + }; + $rootScope.$on('$locationChangeSuccess', () => { this.fetchGalleries(); }); From 8d78fd30375c022c31d3fc12f20541ea46602d0d Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 16:10:45 -0700 Subject: [PATCH 34/51] Installed file upload module and saved as dependency. Also injected as an app level dependency in the entry.js file. --- app/component/gallery/upload-pic/upload-pic.html | 1 - app/entry.js | 3 ++- package.json | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/component/gallery/upload-pic/upload-pic.html b/app/component/gallery/upload-pic/upload-pic.html index 21205b7c..ebd90532 100644 --- a/app/component/gallery/upload-pic/upload-pic.html +++ b/app/component/gallery/upload-pic/upload-pic.html @@ -1,6 +1,5 @@

upload a new photo

diff --git a/app/entry.js b/app/entry.js index a2dfb641..011df723 100644 --- a/app/entry.js +++ b/app/entry.js @@ -9,8 +9,9 @@ const pascalcase = require('pascalcase'); const uiRouter = require('angular-ui-router'); const ngTouch = require('angular-touch'); const ngAnimate = require('angular-animate'); +const ngFileUpload = require('ng-file-upload'); -const cfgram = angular.module('cfgram', [ngTouch, ngAnimate, uiRouter]); +const cfgram = angular.module('cfgram', [ngTouch, ngAnimate, uiRouter, ngFileUpload]); let context = require.context('./config/', true, /\.js$/); context.keys().forEach( key => { diff --git a/package.json b/package.json index aa6d9000..c9419143 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "file-loader": "^0.10.1", "html-loader": "^0.4.5", "html-webpack-plugin": "^2.28.0", + "ng-file-upload": "^12.2.13", "node-sass": "^4.5.1", "pascalcase": "^0.1.1", "resolve-url-loader": "^2.0.2", From 446e6f4ab78504c30af8f05617fb2e6c39b9173d Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 16:19:07 -0700 Subject: [PATCH 35/51] Added attributes to gallery-item directive to show thumbnail directive on click. --- app/view/home/home.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/view/home/home.html b/app/view/home/home.html index 95f4b221..580efe6d 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -12,7 +12,12 @@

Galleries

  • id: {{ gallery._id }}
  • --> - + Date: Mon, 3 Apr 2017 16:37:11 -0700 Subject: [PATCH 36/51] Fixed typo. --- app/service/pic-service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/service/pic-service.js b/app/service/pic-service.js index 4aca96c9..f397b849 100644 --- a/app/service/pic-service.js +++ b/app/service/pic-service.js @@ -12,7 +12,7 @@ function picService($q, $log, $http, Upload, authService) { return authService.getToken() .then( token => { - let url = `${__API_URL__}/api/gallery/${galleryData._id/pic}`; //eslint-disable-line + let url = `${__API_URL__}/api/gallery/${galleryData._id}/pic`; //eslint-disable-line let headers = { Authorization: `Bearer ${token}`, Accept: 'application/json' From 97b13450a488fee82a900edfc6f432ee3195828c Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 19:40:11 -0700 Subject: [PATCH 37/51] Writing delete method on pic service. --- app/service/pic-service.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/service/pic-service.js b/app/service/pic-service.js index f397b849..7fc960ed 100644 --- a/app/service/pic-service.js +++ b/app/service/pic-service.js @@ -8,7 +8,7 @@ function picService($q, $log, $http, Upload, authService) { let service = {}; service.uploadGalleryPic = function(galleryData, picData) { - $log.debug('service.uploadGalleryPic'); + $log.debug('picService.uploadGalleryPic'); return authService.getToken() .then( token => { @@ -39,5 +39,26 @@ function picService($q, $log, $http, Upload, authService) { }); }; + service.deleteGalleryPic = function(galleryData, picData) { + $log.debug('picService.deleteGalleryPic'); + + return authService.getToken() + .then( token => { + let url = `${__API_URL__}/api/gallery/${galleryData._id}/pic/${picData._id}`; //eslint-disable-line + let headers = { + Authorization: `Bearer ${token}` + }; + + return $http.delete(url, headers); + }) + .then( res => { + $log.log(res); + }) + .catch( err => { + $log.error(err.message); + return $q.reject(err); + }); + }; + return service; } From 9b50bce622c12cee6b84a9913ee574f10f03a930 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 3 Apr 2017 23:41:55 -0700 Subject: [PATCH 38/51] Delete method working to send the delete request. Still need to have it remove the thumbnail as well. --- .../thumbnail-container/thumbnail-container.html | 5 ++--- app/component/gallery/thumbnail/thumbnail.js | 6 ++++-- app/service/pic-service.js | 10 +++++++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/component/gallery/thumbnail-container/thumbnail-container.html b/app/component/gallery/thumbnail-container/thumbnail-container.html index f445b23b..97e5ccf3 100644 --- a/app/component/gallery/thumbnail-container/thumbnail-container.html +++ b/app/component/gallery/thumbnail-container/thumbnail-container.html @@ -4,8 +4,7 @@

    {{ thumbnailContainerCtrl.gallery.name }}

    - - + pic="item" gallery="thumbnailContainerCtrl.gallery"> +
    diff --git a/app/component/gallery/thumbnail/thumbnail.js b/app/component/gallery/thumbnail/thumbnail.js index 97436385..2c83260c 100644 --- a/app/component/gallery/thumbnail/thumbnail.js +++ b/app/component/gallery/thumbnail/thumbnail.js @@ -7,15 +7,17 @@ module.exports = { controller: ['$log', 'picService', ThumbnailController], controllerAs: 'thumbnailCtrl', bindings: { - pic: '<' + pic: '<', + gallery: '<' } }; -function ThumbnailController($log, picService) { //eslint-disable-line +function ThumbnailController($log, picService) { $log.debug('ThumbnailController'); this.deletePic = function() { $log.debug('thumbnailCtrl.deletePic'); //hits delete pic method in the pic service + picService.deleteGalleryPic(this.gallery, this.pic); }; } diff --git a/app/service/pic-service.js b/app/service/pic-service.js index 7fc960ed..2e16fae9 100644 --- a/app/service/pic-service.js +++ b/app/service/pic-service.js @@ -41,15 +41,19 @@ function picService($q, $log, $http, Upload, authService) { service.deleteGalleryPic = function(galleryData, picData) { $log.debug('picService.deleteGalleryPic'); + $log.debug('gallery', galleryData); + $log.debug('pic', picData); return authService.getToken() .then( token => { let url = `${__API_URL__}/api/gallery/${galleryData._id}/pic/${picData._id}`; //eslint-disable-line - let headers = { - Authorization: `Bearer ${token}` + let config = { + headers: { + Authorization: `Bearer ${token}` + } }; - return $http.delete(url, headers); + return $http.delete(url, config); }) .then( res => { $log.log(res); From 95a52609b872272a55118ea3d0cefa7924bd54b7 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 4 Apr 2017 00:13:39 -0700 Subject: [PATCH 39/51] Thumbnail removed upon delete now. --- app/component/gallery/thumbnail/thumbnail.js | 2 +- app/service/pic-service.js | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/component/gallery/thumbnail/thumbnail.js b/app/component/gallery/thumbnail/thumbnail.js index 2c83260c..10b09cb8 100644 --- a/app/component/gallery/thumbnail/thumbnail.js +++ b/app/component/gallery/thumbnail/thumbnail.js @@ -17,7 +17,7 @@ function ThumbnailController($log, picService) { this.deletePic = function() { $log.debug('thumbnailCtrl.deletePic'); - //hits delete pic method in the pic service + picService.deleteGalleryPic(this.gallery, this.pic); }; } diff --git a/app/service/pic-service.js b/app/service/pic-service.js index 2e16fae9..57843d66 100644 --- a/app/service/pic-service.js +++ b/app/service/pic-service.js @@ -29,7 +29,9 @@ function picService($q, $log, $http, Upload, authService) { } }) .then( res => { + $log.debug('galleryData', galleryData); galleryData.pics.unshift(res.data); + $log.debug('pics array', galleryData.pics); return res.data; }) .catch( err => { @@ -41,8 +43,6 @@ function picService($q, $log, $http, Upload, authService) { service.deleteGalleryPic = function(galleryData, picData) { $log.debug('picService.deleteGalleryPic'); - $log.debug('gallery', galleryData); - $log.debug('pic', picData); return authService.getToken() .then( token => { @@ -57,6 +57,13 @@ function picService($q, $log, $http, Upload, authService) { }) .then( res => { $log.log(res); + for (let i = 0; i < galleryData.pics.length; i++) { + let current = galleryData.pics[i]; + if (current._id === picData._id) { + galleryData.pics.splice(i, 1); + break; + } + } }) .catch( err => { $log.error(err.message); From 30eefe4eae030a826e02c730028e50d2a1807d24 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 4 Apr 2017 10:36:05 -0700 Subject: [PATCH 40/51] Test setup. --- karma.config.js => karma.conf.js | 11 ++++++----- package.json | 7 +++++++ test/example-test.js | 7 +++++++ 3 files changed, 20 insertions(+), 5 deletions(-) rename karma.config.js => karma.conf.js (66%) create mode 100644 test/example-test.js diff --git a/karma.config.js b/karma.conf.js similarity index 66% rename from karma.config.js rename to karma.conf.js index b174dbe3..70008a2e 100644 --- a/karma.config.js +++ b/karma.conf.js @@ -1,9 +1,9 @@ -const webpackConfig = require('./webpack.config.js'); -webpackConfig.entry = {}; +const webpack = require('./webpack.config.js'); +delete webpack.entry; module.exports = function(config) { config.set({ - webpack: webpackConfig, + webpack, basePath: '', frameworks: ['jasmine'], files: [ @@ -12,14 +12,15 @@ module.exports = function(config) { exclude: [ ], preprocessors: { - 'test/**/*-test.js': ['webpack'] + 'test/**/*-test.js': ['webpack'], + 'app/entry.js': ['webpack'] }, reporters: ['mocha'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, - browsers: ['PhantomJS'], + browsers: ['Chrome'], singleRun: false, concurrency: Infinity }); diff --git a/package.json b/package.json index c9419143..9416d5e5 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,14 @@ "webpack": "^2.3.2" }, "devDependencies": { + "angular-mocks": "^1.6.4", "eslint": "^3.18.0", + "jasmine-core": "^2.5.2", + "karma": "^1.5.0", + "karma-chrome-launcher": "^2.0.0", + "karma-jasmine": "^1.1.0", + "karma-mocha-reporter": "^2.2.3", + "karma-webpack": "^2.0.3", "webpack-dev-server": "^2.4.2" } } diff --git a/test/example-test.js b/test/example-test.js new file mode 100644 index 00000000..23ae19f5 --- /dev/null +++ b/test/example-test.js @@ -0,0 +1,7 @@ +'use strict'; + +describe('Example Test', function() { + it('should pass this test', () => { + expect(true).toEqual(true); + }); +}); From 5f2ddd2dc57ebbbe30fa1f3152e064f1170e8084 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 4 Apr 2017 13:56:06 -0700 Subject: [PATCH 41/51] Karma conf file set up properly for testing. tests to get a token and create a gallery are passing. --- karma.conf.js | 4 +++- test/auth-service-test.js | 30 ++++++++++++++++++++++++ test/gallery-service-test.js | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 test/auth-service-test.js create mode 100644 test/gallery-service-test.js diff --git a/karma.conf.js b/karma.conf.js index 70008a2e..917dc042 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -7,7 +7,9 @@ module.exports = function(config) { basePath: '', frameworks: ['jasmine'], files: [ - 'test/**/*-test.js' + 'app/entry.js', + 'test/**/*-test.js', + 'node_modules/angular-mocks/angular-mocks.js' ], exclude: [ ], diff --git a/test/auth-service-test.js b/test/auth-service-test.js new file mode 100644 index 00000000..c001bd12 --- /dev/null +++ b/test/auth-service-test.js @@ -0,0 +1,30 @@ +'use strict'; + +describe('Auth Service', function() { + beforeEach(() => { + angular.mock.module('cfgram'); + angular.mock.inject(($rootScope, authService, $window, $httpBackend) => { + this.$window = $window; + this.$rootScope = $rootScope; + this.authService = authService; + this.$httpBackend = $httpBackend; + }); + }); + + describe('authService.getToken', () => { + it('should return a token', () => { + this.authService.token = null; + this.$window.localStorage.setItem('token', 'test token'); + + this.authService.getToken() + .then( token => { + expect(token).toEqual('test token'); + }) + .catch( err => { + expect(err).toEqual(null); + }); + + this.$rootScope.$apply(); + }); + }); +}); diff --git a/test/gallery-service-test.js b/test/gallery-service-test.js new file mode 100644 index 00000000..72d3400a --- /dev/null +++ b/test/gallery-service-test.js @@ -0,0 +1,45 @@ +'use strict'; + +describe('Gallery Service', function() { + + beforeEach(() => { + angular.mock.module('cfgram'); + angular.mock.inject(($rootScope, authService, galleryService, $window, $httpBackend) => { + this.$window = $window; + this.$rootScope = $rootScope; + this.authService = authService; + this.galleryService = galleryService; + this.$httpBackend = $httpBackend; + }); + }); + + describe('galleryService.createGallery', () => { + it('should create a new gallery', () => { + let galleryData = { + name: 'example gallery', + desc: 'example description' + }; + + let headers = { + 'Content-Type': 'application/json', + Accept: 'application/json', + Authorization: 'Bearer test token' + }; + + this.$httpBackend.expectPOST('http://localhost:3000/api/gallery', galleryData, headers) + .respond(200, { + _id: '1234', + username: 'testuser', + name: galleryData.name, + desc: galleryData.desc, + pics: [] + }); + + this.galleryService.createGallery(galleryData); + this.$httpBackend.flush(); + this.$rootScope.$apply(); + }); + }); + + //TODO: create delete gallery test w/ expectDELETE to API endpoint +}) From dd2648cb6ccc45ce0c44d9b84f551d9b534ef994 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 4 Apr 2017 16:17:45 -0700 Subject: [PATCH 42/51] Passing test for the delete method of the gallery service. --- app/service/gallery-service.js | 3 ++- test/auth-service-test.js | 4 ++-- test/gallery-service-test.js | 32 +++++++++++++++++++++++++++----- 3 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index e9473633..ecab6de8 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -129,7 +129,8 @@ function galleryService($q, $log, $http, authService) { let url = `${__API_URL__}/api/gallery/${galleryID}`; //eslint-disable-line let config = { headers: { - Authorization: `Bearer ${token}` + Authorization: `Bearer ${token}`, + Accept: 'application/json' } }; diff --git a/test/auth-service-test.js b/test/auth-service-test.js index c001bd12..d92dffb0 100644 --- a/test/auth-service-test.js +++ b/test/auth-service-test.js @@ -2,8 +2,8 @@ describe('Auth Service', function() { beforeEach(() => { - angular.mock.module('cfgram'); - angular.mock.inject(($rootScope, authService, $window, $httpBackend) => { + angular.mock.module('cfgram'); //eslint-disable-line + angular.mock.inject(($rootScope, authService, $window, $httpBackend) => { //eslint-disable-line this.$window = $window; this.$rootScope = $rootScope; this.authService = authService; diff --git a/test/gallery-service-test.js b/test/gallery-service-test.js index 72d3400a..4bf8c37b 100644 --- a/test/gallery-service-test.js +++ b/test/gallery-service-test.js @@ -1,10 +1,12 @@ 'use strict'; +const url = 'http://localhost:3000/api/gallery'; + describe('Gallery Service', function() { beforeEach(() => { - angular.mock.module('cfgram'); - angular.mock.inject(($rootScope, authService, galleryService, $window, $httpBackend) => { + angular.mock.module('cfgram'); //eslint-disable-line + angular.mock.inject(($rootScope, authService, galleryService, $window, $httpBackend) => { //eslint-disable-line this.$window = $window; this.$rootScope = $rootScope; this.authService = authService; @@ -26,7 +28,7 @@ describe('Gallery Service', function() { Authorization: 'Bearer test token' }; - this.$httpBackend.expectPOST('http://localhost:3000/api/gallery', galleryData, headers) + this.$httpBackend.expectPOST(url, galleryData, headers) .respond(200, { _id: '1234', username: 'testuser', @@ -41,5 +43,25 @@ describe('Gallery Service', function() { }); }); - //TODO: create delete gallery test w/ expectDELETE to API endpoint -}) + describe('galleryService.deleteGallery', () => { + it('should delete a gallery', () => { + let galleryData = { + _id: '1234', + name: 'example gallery', + desc: 'example description' + }; + + let headers = { + Authorization: 'Bearer test token', + Accept: 'application/json' + }; + + this.$httpBackend.expectDELETE(`${url}/${galleryData._id}`, headers) + .respond(204, {}); + + this.galleryService.deleteGallery(galleryData._id); + this.$httpBackend.flush(); + this.$rootScope.$apply(); + }); + }); +}); From d86d712262c775599fba9c735c4741ec102b4256 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Tue, 4 Apr 2017 17:08:24 -0700 Subject: [PATCH 43/51] Messing around with testing. --- test/gallery-service-test.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/gallery-service-test.js b/test/gallery-service-test.js index 4bf8c37b..d4dde94d 100644 --- a/test/gallery-service-test.js +++ b/test/gallery-service-test.js @@ -1,17 +1,18 @@ 'use strict'; -const url = 'http://localhost:3000/api/gallery'; +const url = `${__API_URL__}/api/gallery`; //eslint-disable-line describe('Gallery Service', function() { beforeEach(() => { angular.mock.module('cfgram'); //eslint-disable-line - angular.mock.inject(($rootScope, authService, galleryService, $window, $httpBackend) => { //eslint-disable-line + angular.mock.inject(($rootScope, authService, galleryService, $window, $httpBackend, $log) => { //eslint-disable-line this.$window = $window; this.$rootScope = $rootScope; this.authService = authService; this.galleryService = galleryService; this.$httpBackend = $httpBackend; + this.$log = $log; }); }); @@ -60,6 +61,7 @@ describe('Gallery Service', function() { .respond(204, {}); this.galleryService.deleteGallery(galleryData._id); + this.$log.debug('this', this); this.$httpBackend.flush(); this.$rootScope.$apply(); }); From c95906bc0f901243033e893210bb71b312674777 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 5 Apr 2017 10:12:42 -0700 Subject: [PATCH 44/51] Added some expect statements. --- app/service/gallery-service.js | 1 + test/auth-service-test.js | 3 +-- test/gallery-service-test.js | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index ecab6de8..15b368f0 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -145,6 +145,7 @@ function galleryService($q, $log, $http, authService) { break; } } + return res; }) .catch( err => { $log.error(err.message); diff --git a/test/auth-service-test.js b/test/auth-service-test.js index d92dffb0..ecfef731 100644 --- a/test/auth-service-test.js +++ b/test/auth-service-test.js @@ -3,11 +3,10 @@ describe('Auth Service', function() { beforeEach(() => { angular.mock.module('cfgram'); //eslint-disable-line - angular.mock.inject(($rootScope, authService, $window, $httpBackend) => { //eslint-disable-line + angular.mock.inject(($rootScope, authService, $window) => { //eslint-disable-line this.$window = $window; this.$rootScope = $rootScope; this.authService = authService; - this.$httpBackend = $httpBackend; }); }); diff --git a/test/gallery-service-test.js b/test/gallery-service-test.js index d4dde94d..ae6422de 100644 --- a/test/gallery-service-test.js +++ b/test/gallery-service-test.js @@ -38,7 +38,11 @@ describe('Gallery Service', function() { pics: [] }); - this.galleryService.createGallery(galleryData); + this.galleryService.createGallery(galleryData) + .then( gallery => { + expect(gallery._id).toEqual('1234'); + expect(gallery.name).toEqual(galleryData.name); + }); this.$httpBackend.flush(); this.$rootScope.$apply(); }); @@ -60,7 +64,10 @@ describe('Gallery Service', function() { this.$httpBackend.expectDELETE(`${url}/${galleryData._id}`, headers) .respond(204, {}); - this.galleryService.deleteGallery(galleryData._id); + this.galleryService.deleteGallery(galleryData._id) + .then( res => { + expect(res.status).toEqual(204); + }); this.$log.debug('this', this); this.$httpBackend.flush(); this.$rootScope.$apply(); From a76a170ebc3c3bfbe3edcab9196b3e75bbccc394 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Wed, 5 Apr 2017 22:10:22 -0700 Subject: [PATCH 45/51] Tests passing for edit-gallery and gallery-item components. Not sure how meaningful they are yet... --- .../gallery/gallery-item/gallery-item.js | 5 +- .../gallery/thumbnail/thumbnail.html | 1 - app/service/gallery-service.js | 1 + test/edit-gallery-component-test.js | 63 +++++++++++++++++ test/gallery-item-component-test.js | 67 +++++++++++++++++++ 5 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 test/edit-gallery-component-test.js create mode 100644 test/gallery-item-component-test.js diff --git a/app/component/gallery/gallery-item/gallery-item.js b/app/component/gallery/gallery-item/gallery-item.js index ff83bc53..1d498013 100644 --- a/app/component/gallery/gallery-item/gallery-item.js +++ b/app/component/gallery/gallery-item/gallery-item.js @@ -17,6 +17,9 @@ function GalleryItemController($log, galleryService) { this.showEditGallery = false; this.deleteGallery = function() { - galleryService.deleteGallery(this.gallery._id); + galleryService.deleteGallery(this.gallery._id) + .then( () => { + this.deleteDone(this.gallery); + }); }; } diff --git a/app/component/gallery/thumbnail/thumbnail.html b/app/component/gallery/thumbnail/thumbnail.html index cefea4f9..27a44836 100644 --- a/app/component/gallery/thumbnail/thumbnail.html +++ b/app/component/gallery/thumbnail/thumbnail.html @@ -1,5 +1,4 @@
    {{ thumbnailCtrl.pic.desc }} delete -
    diff --git a/app/service/gallery-service.js b/app/service/gallery-service.js index 15b368f0..7356effa 100644 --- a/app/service/gallery-service.js +++ b/app/service/gallery-service.js @@ -113,6 +113,7 @@ function galleryService($q, $log, $http, authService) { } } + $log.log('update res data', res.data); return res.data; }) .catch( err => { diff --git a/test/edit-gallery-component-test.js b/test/edit-gallery-component-test.js new file mode 100644 index 00000000..730d5641 --- /dev/null +++ b/test/edit-gallery-component-test.js @@ -0,0 +1,63 @@ +'use strict'; + +describe('Edit Gallery Component', function() { + + beforeEach( () => { + angular.mock.module('cfgram'); //eslint-disable-line + angular.mock.inject(($rootScope, $componentController, $httpBackend, $log, authService) => { //eslint-disable-line + this.$rootScope = $rootScope; + this.$componentController = $componentController; + this.$httpBackend = $httpBackend; + this.authService = authService; + this.$log = $log; + }); + }); + + it('should contain the proper component bindings', () => { + let mockBindings = { + gallery: { + name: 'test gallery name', + desc: 'test gallery description' + } + }; + + let editGalleryCtrl = this.$componentController('editGallery', null, mockBindings); + expect(editGalleryCtrl.gallery.name).toEqual(mockBindings.gallery.name); + expect(editGalleryCtrl.gallery.desc).toEqual(mockBindings.gallery.desc); + + this.$rootScope.$apply(); + }); + + describe('editGalleryCtrl.updateGallery', () => { + it('should make a valid PUT request', () => { + let url = 'http://localhost:3000/api/gallery/12345';//eslint-disable-line + let headers = { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + Authorization: 'Bearer test token' + }; + + this.$httpBackend.expectPUT(url, { + _id: '12345', + name: 'updated name', + desc: 'updated desc' + }, headers) + .respond(200); + + let mockBindings = { + gallery: { + _id: '12345', + name: 'updated name', + desc: 'updated desc' + } + }; + + let editGalleryCtrl = this.$componentController('editGallery', null, mockBindings); + editGalleryCtrl.updateGallery(editGalleryCtrl.gallery._id, editGalleryCtrl.gallery); + expect(editGalleryCtrl.gallery.name).toEqual('updated name'); + expect(editGalleryCtrl.gallery.desc).toEqual('updated desc'); + this.$httpBackend.flush(); + this.$rootScope.$apply(); + }); + }); +}); diff --git a/test/gallery-item-component-test.js b/test/gallery-item-component-test.js new file mode 100644 index 00000000..c68a385f --- /dev/null +++ b/test/gallery-item-component-test.js @@ -0,0 +1,67 @@ +'use strict'; + +describe('Gallery Item Component', function() { + + beforeEach(() => { + angular.mock.module('cfgram'); //eslint-disable-line + angular.mock.inject(($rootScope, $componentController, $httpBackend, authService, galleryService) => { //eslint-disable-line + this.$rootScope = $rootScope; + this.$componentController = $componentController; + this.$httpBackend = $httpBackend; + this.authService = authService; + this.galleryService = galleryService; + }); + }); + + describe('galleryItemCtrl.deleteDone', () => { + it('should call deleteDone', () => { + let mockBindings = { + gallery: { + _id: '12345', + name: 'test name', + desc: 'test description', + pics: [] + }, + deleteDone: function(data) { + expect(data.galleryData._id).toEqual('12345'); + } + }; + + let galleryItemCtrl = this.$componentController('galleryItem', null, mockBindings); + galleryItemCtrl.deleteDone({ galleryData: galleryItemCtrl.gallery }); + + this.$rootScope.$apply(); + }); + }); + + describe('galleryItemCtrl.deleteGallery', () => { + it('should delete a gallery', () => { + let mockBindings = { + gallery: { + _id: '12345', + name: 'test name', + desc: 'test description', + pics: [] + }, + deleteDone: function(data) { + expect(data._id).toEqual(mockBindings.gallery._id); + expect(data.name).toEqual(mockBindings.gallery.name); + } + }; + + let headers = { + Authorization: 'Bearer test token', + Accept: 'application/json' + }; + + this.$httpBackend.expectDELETE('http://localhost:3000/api/gallery/12345', headers) + .respond(204, {}); + + let galleryItemCtrl = this.$componentController('galleryItem', null, mockBindings); + galleryItemCtrl.deleteGallery(); + + this.$httpBackend.flush(); + this.$rootScope.$apply(); + }); + }); +}); From 0578d42e76cec35abbd58f447f49a4323ea90db3 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 6 Apr 2017 13:57:12 -0700 Subject: [PATCH 46/51] Fuzzy search on galleries working properly. Directive for social media icons displaying in footer. Sprite sheet imported. --- app/assets/images/spritesheet.png | Bin 0 -> 6989 bytes app/directive/social-icons.html | 7 +++++++ app/directive/social-icons.js | 20 ++++++++++++++++++++ app/entry.js | 14 ++++++++++++++ app/filter/gallery-search.js | 17 +++++++++++++++++ app/index.html | 4 +++- app/view/home/home.html | 3 ++- 7 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 app/assets/images/spritesheet.png create mode 100644 app/directive/social-icons.html create mode 100644 app/directive/social-icons.js create mode 100644 app/filter/gallery-search.js diff --git a/app/assets/images/spritesheet.png b/app/assets/images/spritesheet.png new file mode 100644 index 0000000000000000000000000000000000000000..73b98031739b80451a0203cdd3c9d3d299018584 GIT binary patch literal 6989 zcma)>Ra6v=)5e$BrAuJx?hYyGR=T?z1!O5{SP%qh5Lmhq>F!!OrBj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`+UTY{xr4|74|k48H;Pscuv3B-!>A1yUR?Hh@TLJm5Pnm! zp+f zj!dicIhgJ!VVFyZWuD<-<%Q3G>u8*wDveNu!(Pvt)MTo{O*C&{6+8dm{uxaTC-t^c TNFd?gn+%|)qODw~XdC%IYj025 literal 0 HcmV?d00001 diff --git a/app/directive/social-icons.html b/app/directive/social-icons.html new file mode 100644 index 00000000..ab6acbba --- /dev/null +++ b/app/directive/social-icons.html @@ -0,0 +1,7 @@ + diff --git a/app/directive/social-icons.js b/app/directive/social-icons.js new file mode 100644 index 00000000..460023fb --- /dev/null +++ b/app/directive/social-icons.js @@ -0,0 +1,20 @@ +'use strict'; + +module.exports = function() { + return { + restrict: 'EAC', + template: require('./social-icons.html'), + controller: ['$log', SocialIconsController], + bindToController: true, + controllerAs: 'socialIconsCtrl', + scope: { + tester: '@' + } + }; +}; + +function SocialIconsController($log) { + $log.debug('SocialIconsController'); + + this.icons = ['fb', 'twitter', 'instagram']; +} diff --git a/app/entry.js b/app/entry.js index 011df723..a8c2c29e 100644 --- a/app/entry.js +++ b/app/entry.js @@ -38,3 +38,17 @@ context.keys().forEach( key => { let module = context(key); cfgram.component(name, module); }); + +context = require.context('./filter/', true, /\.js$/); +context.keys().forEach( key => { + let name = camelCase(path.basename(key, '.js')); + let module = context(key); + cfgram.filter(name, module); +}); + +context = require.context('./directive/', true, /\.js$/); +context.keys().forEach( key => { + let name = camelCase(path.basename(key, '.js')); + let module = context(key); + cfgram.directive(name, module); +}); diff --git a/app/filter/gallery-search.js b/app/filter/gallery-search.js new file mode 100644 index 00000000..32609edd --- /dev/null +++ b/app/filter/gallery-search.js @@ -0,0 +1,17 @@ +'use strict'; + +module.exports = function() { + return function(galleries, searchTerm) { + let fuzzyRegex = generateFuzzyRegex(searchTerm); + + return galleries.filter(gallery => { + return fuzzyRegex.test(gallery.name.toUpperCase()); + }); + }; +}; + +function generateFuzzyRegex(input) { + if (!input) return /.*/; + let fuzzyString = '.*' + input.toUpperCase().split('').join('.*') + '.*'; + return new RegExp(fuzzyString); +} diff --git a/app/index.html b/app/index.html index 381ec277..b7a1832b 100644 --- a/app/index.html +++ b/app/index.html @@ -12,6 +12,8 @@
    -
    +
    + +
    diff --git a/app/view/home/home.html b/app/view/home/home.html index 580efe6d..1f76324c 100644 --- a/app/view/home/home.html +++ b/app/view/home/home.html @@ -2,6 +2,7 @@

    Galleries

    +
      Date: Thu, 6 Apr 2017 14:59:16 -0700 Subject: [PATCH 47/51] Sprite sheet working to display icons in footer nav tag as list. --- app/directive/_social-icons.scss | 50 ++++++++++++++++++++++++++++++++ app/directive/social-icons.html | 4 +-- app/directive/social-icons.js | 4 ++- app/index.html | 3 +- app/scss/lib/layout/_footer.scss | 8 ++--- 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 app/directive/_social-icons.scss diff --git a/app/directive/_social-icons.scss b/app/directive/_social-icons.scss new file mode 100644 index 00000000..dae334cd --- /dev/null +++ b/app/directive/_social-icons.scss @@ -0,0 +1,50 @@ +.media-icons { + float: left; + margin-left: 3vw; + position: relative; + bottom: 4vw; +} + +.sprite { + background-image: url('../assets/images/spritesheet.png'); + background-repeat: no-repeat; + display: block; + float: right; + margin-bottom: 3vw; +} + +.sprite-github { + width: 30px; + height: 30px; + background-position: -5px -5px; +} + +.sprite-gmail { + width: 30px; + height: 30px; + background-position: -45px -5px; +} + +.sprite-linkedin { + width: 30px; + height: 30px; + background-position: -5px -45px; +} + +.sprite-stackoverflow { + width: 30px; + height: 30px; + background-position: -45px -45px; +} + +.sprite-tumblr { + width: 30px; + height: 30px; + background-position: -85px -5px; +} + +.sprite-twitter { + width: 30px; + height: 30px; + background-position: -85px -45px; +} diff --git a/app/directive/social-icons.html b/app/directive/social-icons.html index ab6acbba..6e7cd565 100644 --- a/app/directive/social-icons.html +++ b/app/directive/social-icons.html @@ -1,7 +1,7 @@ -
    + + + {{ createGalleryCtrl.gallery.name | hashtagify: createGalleryCtrl.gallery.name}} + +
    name: - {{ galleryItemCtrl.gallery.name }} + {{ galleryItemCtrl.gallery.name | hashtagify: galleryItemCtrl.gallery.name }}
    diff --git a/app/filter/hashtagify.js b/app/filter/hashtagify.js new file mode 100644 index 00000000..fd8c44bd --- /dev/null +++ b/app/filter/hashtagify.js @@ -0,0 +1,15 @@ +'use strict'; + +module.exports = function() { + return function(input) { + if (!input) return 'coolhashtagbruh'; + + let stringInput = input; + if (stringInput !== typeof 'string') stringInput = input.toString(); + + let hashtag = stringInput.match(/[\w]/g); + if (hashtag) return `#${hashtag.join('')}`; + + return 'invalid hashtag'; + }; +}; From 205743ba0e83bc16aad6fb773c018dba68922a98 Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Thu, 6 Apr 2017 17:00:10 -0700 Subject: [PATCH 49/51] Functionally done. Styling now. --- app/component/gallery/create-gallery/create-gallery.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/component/gallery/create-gallery/create-gallery.html b/app/component/gallery/create-gallery/create-gallery.html index ed01f323..e31e1b20 100644 --- a/app/component/gallery/create-gallery/create-gallery.html +++ b/app/component/gallery/create-gallery/create-gallery.html @@ -13,7 +13,7 @@ required>
    - + {{ createGalleryCtrl.gallery.name | hashtagify: createGalleryCtrl.gallery.name}} From abc64edc7a17236803c46662eb7138bf8f8b6ade Mon Sep 17 00:00:00 2001 From: Dana Kulp Date: Mon, 10 Apr 2017 15:41:01 -0700 Subject: [PATCH 50/51] Playing around with cards component. --- .../gallery/gallery-item/gallery-item.html | 33 +- app/component/landing/login/login.html | 1 + app/component/navbar/navbar.html | 12 + app/entry.js | 3 +- .../lib/bootstrap/_custom-bootstrap-vars.scss | 885 ++++++++++++++++++ app/scss/lib/bootstrap/_custom-bootstrap.scss | 50 + app/scss/main.scss | 1 + app/view/landing/landing.html | 16 + package.json | 2 + webpack.config.js | 4 + 10 files changed, 992 insertions(+), 15 deletions(-) create mode 100644 app/scss/lib/bootstrap/_custom-bootstrap-vars.scss create mode 100644 app/scss/lib/bootstrap/_custom-bootstrap.scss diff --git a/app/component/gallery/gallery-item/gallery-item.html b/app/component/gallery/gallery-item/gallery-item.html index 1ee24660..c184aa21 100644 --- a/app/component/gallery/gallery-item/gallery-item.html +++ b/app/component/gallery/gallery-item/gallery-item.html @@ -1,22 +1,27 @@ - edit - delete - +
  • + edit + delete
  • diff --git a/app/component/landing/login/login.html b/app/component/landing/login/login.html index 41f502fa..a1f878e8 100644 --- a/app/component/landing/login/login.html +++ b/app/component/landing/login/login.html @@ -10,6 +10,7 @@ }">

    sign in.

    cf gram

    +
    + + + +
    +