From ff16f2d7b64e26ca0a26c865e545dd40ca76c57a Mon Sep 17 00:00:00 2001 From: rcpeters Date: Thu, 28 May 2015 12:13:12 -0700 Subject: [PATCH 1/6] update readme, phase 1 --- .gitignore | 3 ++- readme.MD => README.md | 16 +++++++++++----- package.json | 4 +++- 3 files changed, 16 insertions(+), 7 deletions(-) rename readme.MD => README.md (68%) diff --git a/.gitignore b/.gitignore index cfd50c6..7230da5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ hackathon.sublime-project hackathon.sublime-workspace -node_modules \ No newline at end of file +node_modules +.sass-cache/ diff --git a/readme.MD b/README.md similarity index 68% rename from readme.MD rename to README.md index f423756..8226e6f 100644 --- a/readme.MD +++ b/README.md @@ -4,25 +4,31 @@ An step by step live demo to explain how the Oauth2 dance works in the ORCID API [Install it!](https://nodejs.org/) -### Install dependencies +### Install Gulp + +``` +sudo npm install --global gulp +``` ``` npm install gulp --save-dev ``` +### Install dependencies + ``` -npm install gulp-ruby-sass gulp-autoprefixer gulp-minify-css gulp-uglify gulp-rename gulp-concat gulp-notify gulp-cache gulp-livereload gulp-plumber --save-dev +npm install ``` ### Run web server ``` python3 -m http.server 8000 - +``` or +``` python -m SimpleHTTPServer 8000 - ``` ### Run gulp @@ -31,4 +37,4 @@ python -m SimpleHTTPServer 8000 gulp ``` -Source JavaScript and SCSS files are under /src folder, do not modify files that are in the root (/CSS and /JS) \ No newline at end of file +Source JavaScript and SCSS files are under /src folder, do not modify files that are in the root (/CSS and /JS) diff --git a/package.json b/package.json index 50bab7c..bed7e8c 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,9 @@ "gulp-uglify": "^1.2.0", "gulp-jshint": "^1.10.0" }, - "devDependencies": {}, + "devDependencies": { + "gulp": "^3.8.11" + }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, From 737f5046525e65cef88a694517df984fb6642c3b Mon Sep 17 00:00:00 2001 From: rcpeters Date: Thu, 28 May 2015 13:00:50 -0700 Subject: [PATCH 2/6] remove uneeded command --- README.md | 4 --- css/style.min.css | 2 +- js/app.js | 76 +++++++++++++++++++++++++++++++++++++---------- js/app.min.js | 2 +- 4 files changed, 63 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 8226e6f..aff7b66 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,6 @@ An step by step live demo to explain how the Oauth2 dance works in the ORCID API sudo npm install --global gulp ``` -``` -npm install gulp --save-dev -``` - ### Install dependencies ``` diff --git a/css/style.min.css b/css/style.min.css index e42e402..ec3d9b8 100644 --- a/css/style.min.css +++ b/css/style.min.css @@ -1 +1 @@ -body{color:#494A4C;font-family:'Gill Sans W02',Helvetica,sans-serif}h1,h2,h3{color:#a6ce39}label,p,ul{font-size:18px}table{margin:40px 20px;background-color:#fff;border-radius:16px;box-shadow:0 0 5px #999}td{padding:16px;color:#9B9B9B;font-size:1.2em}tr{border-bottom:1px solid #d2d2d2;vertical-align:center}.api-chart img{width:64px}.api-chart h3{text-transform:uppercase}tr:last-of-type{border-bottom:none}.btn-default{background:#338caf;color:#FFF;border:none}.btn-default:hover{background:#a6ce39;color:#FFF;border:none}.wizard-btn-container{text-align:right;position:absolute;left:15px;right:15px;bottom:15px;border-top:1px solid #d2d2d2;padding-top:15px}.wizard-btn-container .wizard-nav-btn,.wizard-btn-container .wizard-nav-btn:hover,.wizard-btn-container input[type=submit],.wizard-btn-container input[type=submit]:hover{background:#f3f3f3;border:none;background-image:linear-gradient(#fbfbfb,#f3f3f3);border:1px solid rgba(0,0,0,.1);border-radius:2px;box-shadow:0 1px 1px rgba(0,0,0,.1);margin-left:15px;margin-right:0;height:30px;color:#444;display:inline-block;font-weight:700;margin-bottom:0;padding:4px 12px;text-decoration:none;text-shadow:none}.wizard-btn-container .wizard-nav-btn.disabled-button,.wizard-btn-container .wizard-nav-btn.disabled-button:hover,.wizard-btn-container input[type=submit].disabled-button,.wizard-btn-container input[type=submit].disabled-button:hover{background-color:#e4e4e4;background-image:linear-gradient(#e8e8e8,#e4e4e4);color:#c2c2c2;border-radius:2px;box-shadow:none}.steps-pane-container{border:none;float:left;min-width:15%;width:auto;height:100vh;box-sizing:border-box;background:#FFF;border-right:1px solid #d2d2d2}.steps-pane-container ul{list-style:none;padding:0;margin:0}.steps-pane-container ul li{border-bottom:1px solid #d2d2d2;text-shadow:none;cursor:default;padding:15px;color:#9b9b9b;position:relative;font-size:18px}.steps-pane-container ul li.current-step{text-shadow:none;background:#338caf;border-color:#a6ce39;border-style:none solid none none;border-width:5px;color:#FFF;font-weight:700}.steps-pane-container ul li.completed-step{color:#777;text-shadow:none}.steps-pane-container ul li.clickable-step-link{cursor:pointer}.steps-pane-container ul li.clickable-step-link:hover{color:#333}.steps-pane-container .logo{width:100%;text-align:left;padding:6px 0 0 15px;height:60px;border-bottom:1px solid #d2d2d2}.wizard-ext-container{overflow:hidden;box-sizing:border-box;box-shadow:0 0 4px rgba(0,0,0,.3)}.contents-pane-container{float:left;padding:15px;min-width:85%;width:auto;height:100vh;position:relative;box-sizing:border-box;background:#F8F8F8;border:none}.contents-pane{overflow:auto;position:absolute;left:15px;right:15px;top:15px;bottom:61px;border:none;padding-left:2px}.hidden-form-slide{display:none}.disabled-button{color:rgba(0,0,0,.3)} \ No newline at end of file +body{color:#494A4C;font-family:'Gill Sans W02',Helvetica,sans-serif}h1,h2,h3{color:#a6ce39}label,ol,p,ul{font-size:18px}table{margin:40px 20px;background-color:#fff;border-radius:16px;box-shadow:0 0 5px #999}td{padding:16px;color:#9B9B9B;font-size:1.2em}tr{border-bottom:1px solid #d2d2d2;vertical-align:center}.api-chart img{width:64px}.api-chart h3{text-transform:uppercase}tr:last-of-type{border-bottom:none}.btn-default{background:#338caf;color:#FFF;border:none}.btn-default:hover{background:#a6ce39;color:#FFF;border:none}.wizard-btn-container{text-align:right;position:absolute;left:15px;right:15px;bottom:15px;border-top:1px solid #d2d2d2;padding-top:15px}.wizard-btn-container .wizard-nav-btn,.wizard-btn-container .wizard-nav-btn:hover,.wizard-btn-container input[type=submit],.wizard-btn-container input[type=submit]:hover{background:#f3f3f3;border:none;background-image:linear-gradient(#fbfbfb,#f3f3f3);border:1px solid rgba(0,0,0,.1);border-radius:2px;box-shadow:0 1px 1px rgba(0,0,0,.1);margin-left:15px;margin-right:0;height:30px;color:#444;display:inline-block;font-weight:700;margin-bottom:0;padding:4px 12px;text-decoration:none;text-shadow:none}.wizard-btn-container .wizard-nav-btn.disabled-button,.wizard-btn-container .wizard-nav-btn.disabled-button:hover,.wizard-btn-container input[type=submit].disabled-button,.wizard-btn-container input[type=submit].disabled-button:hover{background-color:#e4e4e4;background-image:linear-gradient(#e8e8e8,#e4e4e4);color:#c2c2c2;border-radius:2px;box-shadow:none}.steps-pane-container{border:none;float:left;min-width:15%;width:auto;height:100vh;box-sizing:border-box;background:#FFF;border-right:1px solid #d2d2d2}.steps-pane-container ul{list-style:none;padding:0;margin:0}.steps-pane-container ul li{border-bottom:1px solid #d2d2d2;text-shadow:none;cursor:default;padding:15px;color:#9b9b9b;position:relative;font-size:18px}.steps-pane-container ul li.current-step{text-shadow:none;background:#338caf;border-color:#a6ce39;border-style:none solid none none;border-width:5px;color:#FFF;font-weight:700}.steps-pane-container ul li.completed-step{color:#777;text-shadow:none}.steps-pane-container ul li.clickable-step-link{cursor:pointer}.steps-pane-container ul li.clickable-step-link:hover{color:#333}.steps-pane-container .logo{width:100%;text-align:left;padding:6px 0 0 15px;height:60px;border-bottom:1px solid #d2d2d2}.wizard-ext-container{overflow:hidden;box-sizing:border-box;box-shadow:0 0 4px rgba(0,0,0,.3)}.contents-pane-container{float:left;padding:15px;min-width:85%;width:auto;height:100vh;position:relative;box-sizing:border-box;background:#F8F8F8;border:none}.contents-pane{overflow:auto;position:absolute;left:15px;right:15px;top:15px;bottom:61px;border:none;padding-left:2px}.hidden-form-slide{display:none}.disabled-button{color:rgba(0,0,0,.3)}.token_items pre{background-color:#fff;overflow:hidden}.token_items,.token_items a{width:60%;float:left;margin:0;padding:0;outline:0}.token_items a:hover,.token_items a:visited{text-decoration:none}.key,.value{float:left}.token_items_descriptions{width:20%;margin-left:20px;margin-top:60px}.token_items_descriptions,p.description{padding:0;float:left} \ No newline at end of file diff --git a/js/app.js b/js/app.js index 15f79de..97469d4 100644 --- a/js/app.js +++ b/js/app.js @@ -8,7 +8,7 @@ wizardNgModule.controller('stepsController', ['$scope','wizardSrvc','$location', $scope.steps = [ {'title' : 'Introduction'}, {'title' : 'Accessing the API'}, - {'title' : 'Technologies'}, + {'title' : 'Using the API'}, {'title' : 'Get access token'}, {'title' : 'Get token'}, {'title' : 'Show token'}, @@ -18,9 +18,12 @@ wizardNgModule.controller('stepsController', ['$scope','wizardSrvc','$location', $scope.init = function() { var code = $location.search()['code']; + if (code === undefined || code === null) { console.log('Nothing here'); } else { + //strip extra characters from code + code = code.substr(0,6); $scope.wizardSrvc.current = 4; } } @@ -64,12 +67,13 @@ wizardNgModule.controller('authorizationCodeController', ['$scope','$cookies', ' apiUri = apiUri.replace('[api_url]', 'sandbox.orcid.org'); apiUri = apiUri.replace('[client_id]', $scope.form.client_id); apiUri = apiUri.replace('[redirect_uri]', 'http://' + location.hostname + ':8000'); - apiUri = apiUri.replace('[scope]', $scope.form.scope); + apiUri = apiUri.replace('[scope]', '/activities/read-limited /activities/update /orcid-profile/read-limited'); console.log(apiUri); // Save values in cookies so we can use them later - $cookies.put('current', $scope.wizardSrvc.current); //Current Wizard location + //Current Wizard location + $cookies.put('current', $scope.wizardSrvc.current); $cookies.put('orcid_oauth2_client_id', $scope.form.client_id); $cookies.put('orcid_oauth2_redirect_uri', 'http://' + location.hostname+ ':8000'); @@ -79,8 +83,6 @@ wizardNgModule.controller('authorizationCodeController', ['$scope','$cookies', ' }, 125); }; - - }]); wizardNgModule.controller('tokenController', ['$scope','$location', '$cookies', '$http', function($scope, $location, $cookies, $http){ @@ -91,33 +93,38 @@ wizardNgModule.controller('tokenController', ['$scope','$location', '$cookies', $scope.orcid=false; $scope.scope=false; $scope.token_type=false; - - /* THIS CONTROLLER NEEDS TO BE UPDATED */ - + $scope.access_token=null; + $scope.user_orcid=null; + $scope.access_code = null; + $scope.client_id = null; + $scope.show_xml=false; + /* Only for dev environment */ if (location.hostname == 'localhost'){ $scope.client_secret = '8fa38bea-48e2-4238-9479-e55448ffa225'; } - - $scope.access_code = null; - $scope.client_id = null; - + $scope.getCode = function() { + $scope.access_code = $location.search()['code']; $scope.client_id = $cookies.get('orcid_oauth2_client_id'); // If the code is not specified, return the view // to the root view if ($scope.access_code === undefined || $scope.access_code === null) { $location.path("/"); + } else{ + //strip extra characters from code + var rawCode = $location.search()['code']; + $scope.access_code = rawCode.substr(0,6); } }; - $scope.exchangeCode = function() { + $scope.exchangeCode = function() { $http({ url:'http://pub.sandbox.orcid.org/oauth/token', method:'post', headers: {'Content-Type': 'application/x-www-form-urlencoded', - 'Accept': 'application/json', + 'Accept': 'application/json' }, transformRequest: function(obj) { var str = []; @@ -137,6 +144,8 @@ wizardNgModule.controller('tokenController', ['$scope','$location', '$cookies', .success (function(data){ $scope.wizardSrvc.current = 5; $scope.token = data; + $scope.access_token = data.access_token; + $scope.user_orcid = data.orcid; }) .error(function(data, status, headers, config){ console.log("***OOPS "+status + " H: "+ angular.toJson(data)); @@ -157,7 +166,7 @@ wizardNgModule.controller('tokenController', ['$scope','$location', '$cookies', break; case 'expiration': $scope.show_expires_in=true; - break; + break; case 'name': $scope.show_name=true; break; @@ -173,7 +182,44 @@ wizardNgModule.controller('tokenController', ['$scope','$location', '$cookies', } }; + + + + + + + + + + + + + + + + + $scope.readRecord = function() { + $scope.show_xml=true; + }; + + + + + + + + + + + + + + + + + + $scope.getCode(); }]); diff --git a/js/app.min.js b/js/app.min.js index fd22121..18f7300 100644 --- a/js/app.min.js +++ b/js/app.min.js @@ -1 +1 @@ -var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Technologies"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):e.wizardSrvc.current=4},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]",e.form.scope),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.access_code=null,e.client_id=null,e.getCode=function(){e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),(void 0===e.access_code||null===e.access_code)&&o.path("/")},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file +var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Using the API"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):(o=o.substr(0,6),e.wizardSrvc.current=4)},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]","/activities/read-limited /activities/update /orcid-profile/read-limited"),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,e.access_token=null,e.user_orcid=null,e.access_code=null,e.client_id=null,e.show_xml=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.getCode=function(){if(e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),void 0===e.access_code||null===e.access_code)o.path("/");else{var c=o.search().code;e.access_code=c.substr(0,6)}},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o,e.access_token=o.access_token,e.user_orcid=o.orcid}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.readRecord=function(){e.show_xml=!0},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file From f908bf96c1785cbf977977460941b3138dea2a85 Mon Sep 17 00:00:00 2001 From: rcpeters Date: Fri, 29 May 2015 02:22:06 -0700 Subject: [PATCH 3/6] add express and live reload --- README.md | 13 +------------ gulpfile.js | 33 ++++++++++++++++++++++++++++++++- package.json | 5 ++++- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index aff7b66..606e571 100644 --- a/README.md +++ b/README.md @@ -16,18 +16,7 @@ sudo npm install --global gulp npm install ``` -### Run web server - -``` -python3 -m http.server 8000 -``` -or - -``` -python -m SimpleHTTPServer 8000 -``` - -### Run gulp +### Run gulp, includes express web server ``` gulp diff --git a/gulpfile.js b/gulpfile.js index 7f86980..60b762f 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -10,6 +10,22 @@ var gulp = require('gulp'), livereload = require('gulp-livereload'), plumber = require('gulp-plumber'); +// run livereload +gulp.task('livereload', function() { + tinylr = require('tiny-lr')(); + tinylr.listen(35729); +}); + +function notifyLiveReload(event) { + var fileName = require('path').relative(__dirname, event.path); + + tinylr.changed({ + body: { + files: [fileName] + } + }); +} + gulp.task('styles', function () { return (sass('./src/scss')) @@ -38,10 +54,25 @@ gulp.task('scripts', function() { gulp.task('watch', function() { gulp.watch('./src/scss/*.scss', ['styles']); gulp.watch('./src/js/*.js', ['scripts']); + gulp.watch('./js/*', notifyLiveReload); + gulp.watch('./css/*', notifyLiveReload); + gulp.watch('./img/*', notifyLiveReload); + gulp.watch('./index.html', notifyLiveReload); }); +// run express +gulp.task('express', function() { + var express = require('express'); + var app = express(); + app.use(require('connect-livereload')({port: 35729})); + app.use(express.static(__dirname)); + app.listen(8000); +}); + + + // Default task -gulp.task('default', ['watch'], function() { +gulp.task('default', ['express','livereload','watch'], function() { gulp.start('styles','scripts'); }); diff --git a/package.json b/package.json index bed7e8c..8d1cfbb 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,10 @@ "gulp-jshint": "^1.10.0" }, "devDependencies": { - "gulp": "^3.8.11" + "connect-livereload": "^0.5.3", + "express": "^4.12.4", + "gulp": "^3.8.11", + "tiny-lr": "^0.1.5" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 3b0a01528f7a54ea71c4a3b8bccb94db0af44a46 Mon Sep 17 00:00:00 2001 From: rcpeters Date: Fri, 29 May 2015 02:54:48 -0700 Subject: [PATCH 4/6] reorg layout --- .gitignore | 1 + gulpfile.js | 17 +++++++++-------- js/app.min.js | 1 - {css => public/css}/fonts.min.css | 0 {css => public/css}/style.min.css | 0 .../28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf | Bin .../2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff | Bin .../3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot | Bin .../41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff | Bin .../53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf | Bin .../59939f92-3d8b-46f6-8852-3a0db259dea0.svg | 0 .../5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff | Bin .../782849e5-a129-4cc1-8fa5-934ae2a82537.svg | 0 .../7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg | 0 .../a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff | Bin .../a4c5f6d1-f02d-4144-aadf-10f97a718263.eot | Bin .../b88d89de-e476-4fd9-83a7-15f1178d78bd.eot | Bin .../c7502fea-5840-46ed-9666-3479a56bf828.ttf | Bin .../cba5f716-e0e3-43b2-accd-b5f4173e4695.svg | 0 .../da53b951-50dc-4a3c-a55a-932bdde8347e.ttf | Bin .../df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot | Bin .../ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff | Bin .../f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg | 0 .../f54382aa-da70-46c5-bb6f-735919625300.ttf | Bin .../f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot | Bin {img => public/img}/ID_symbol.svg | 0 .../img}/glyphicons-28-search-A6CE39.svg | 0 .../img}/glyphicons-31-pencil-A6CE39.svg | 0 .../glyphicons-365-cloud-upload-A6CE39.svg | 0 .../img}/glyphicons-433-plus-A6CE39.svg | 0 .../img}/glyphicons-52-eye-open-A6CE39.svg | 0 .../img}/glyphicons-86-repeat-A6CE39.svg | 0 {img => public/img}/id-logo.png | Bin {img => public/img}/orcid-logo.png | Bin index.html => public/index.html | 0 {js => public/js}/.DS_Store | Bin {js => public/js}/app.js | 1 + public/js/app.min.js | 1 + {js => public/js}/controllers.js | 0 src/.DS_Store | Bin 6148 -> 0 bytes 40 files changed, 12 insertions(+), 9 deletions(-) delete mode 100644 js/app.min.js rename {css => public/css}/fonts.min.css (100%) rename {css => public/css}/style.min.css (100%) rename {fonts => public/fonts}/28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf (100%) rename {fonts => public/fonts}/2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff (100%) rename {fonts => public/fonts}/3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot (100%) rename {fonts => public/fonts}/41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff (100%) rename {fonts => public/fonts}/53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf (100%) rename {fonts => public/fonts}/59939f92-3d8b-46f6-8852-3a0db259dea0.svg (100%) rename {fonts => public/fonts}/5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff (100%) rename {fonts => public/fonts}/782849e5-a129-4cc1-8fa5-934ae2a82537.svg (100%) rename {fonts => public/fonts}/7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg (100%) rename {fonts => public/fonts}/a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff (100%) rename {fonts => public/fonts}/a4c5f6d1-f02d-4144-aadf-10f97a718263.eot (100%) rename {fonts => public/fonts}/b88d89de-e476-4fd9-83a7-15f1178d78bd.eot (100%) rename {fonts => public/fonts}/c7502fea-5840-46ed-9666-3479a56bf828.ttf (100%) rename {fonts => public/fonts}/cba5f716-e0e3-43b2-accd-b5f4173e4695.svg (100%) rename {fonts => public/fonts}/da53b951-50dc-4a3c-a55a-932bdde8347e.ttf (100%) rename {fonts => public/fonts}/df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot (100%) rename {fonts => public/fonts}/ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff (100%) rename {fonts => public/fonts}/f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg (100%) rename {fonts => public/fonts}/f54382aa-da70-46c5-bb6f-735919625300.ttf (100%) rename {fonts => public/fonts}/f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot (100%) rename {img => public/img}/ID_symbol.svg (100%) rename {img => public/img}/glyphicons-28-search-A6CE39.svg (100%) rename {img => public/img}/glyphicons-31-pencil-A6CE39.svg (100%) rename {img => public/img}/glyphicons-365-cloud-upload-A6CE39.svg (100%) rename {img => public/img}/glyphicons-433-plus-A6CE39.svg (100%) rename {img => public/img}/glyphicons-52-eye-open-A6CE39.svg (100%) rename {img => public/img}/glyphicons-86-repeat-A6CE39.svg (100%) rename {img => public/img}/id-logo.png (100%) rename {img => public/img}/orcid-logo.png (100%) rename index.html => public/index.html (100%) rename {js => public/js}/.DS_Store (100%) rename {js => public/js}/app.js (99%) create mode 100644 public/js/app.min.js rename {js => public/js}/controllers.js (100%) delete mode 100644 src/.DS_Store diff --git a/.gitignore b/.gitignore index 7230da5..fb4a2e7 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ hackathon.sublime-project hackathon.sublime-workspace node_modules .sass-cache/ +**/.DS_Store diff --git a/gulpfile.js b/gulpfile.js index 60b762f..764a800 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,6 +9,7 @@ var gulp = require('gulp'), cache = require('gulp-cache'), livereload = require('gulp-livereload'), plumber = require('gulp-plumber'); + // run livereload gulp.task('livereload', function() { @@ -27,25 +28,27 @@ function notifyLiveReload(event) { } +// Styles gulp task gulp.task('styles', function () { return (sass('./src/scss')) .on('error', function (err) { console.log(err.message); }) .pipe(plumber()) .pipe(rename({ suffix: '.min' })) .pipe(minifycss()) - .pipe(gulp.dest('./css')) + .pipe(gulp.dest('./public/css')) .pipe(notify({ message: 'Styles task complete' })); }); + // Scripts gulp.task('scripts', function() { return gulp.src('./src/js/*.js') .pipe(plumber()) .pipe(concat('app.js')) - .pipe(gulp.dest('./js')) + .pipe(gulp.dest('./public/js')) .pipe(rename({ suffix: '.min' })) .pipe(uglify()) - .pipe(gulp.dest('./js')) + .pipe(gulp.dest('./public/js')) .pipe(notify({ message: 'Custom Scripts task complete' })); }); @@ -55,22 +58,20 @@ gulp.task('watch', function() { gulp.watch('./src/scss/*.scss', ['styles']); gulp.watch('./src/js/*.js', ['scripts']); gulp.watch('./js/*', notifyLiveReload); - gulp.watch('./css/*', notifyLiveReload); - gulp.watch('./img/*', notifyLiveReload); - gulp.watch('./index.html', notifyLiveReload); + gulp.watch('./public/*', notifyLiveReload); }); + // run express gulp.task('express', function() { var express = require('express'); var app = express(); app.use(require('connect-livereload')({port: 35729})); - app.use(express.static(__dirname)); + app.use(express.static(__dirname + '/public')); app.listen(8000); }); - // Default task gulp.task('default', ['express','livereload','watch'], function() { gulp.start('styles','scripts'); diff --git a/js/app.min.js b/js/app.min.js deleted file mode 100644 index 18f7300..0000000 --- a/js/app.min.js +++ /dev/null @@ -1 +0,0 @@ -var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Using the API"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):(o=o.substr(0,6),e.wizardSrvc.current=4)},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]","/activities/read-limited /activities/update /orcid-profile/read-limited"),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,e.access_token=null,e.user_orcid=null,e.access_code=null,e.client_id=null,e.show_xml=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.getCode=function(){if(e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),void 0===e.access_code||null===e.access_code)o.path("/");else{var c=o.search().code;e.access_code=c.substr(0,6)}},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o,e.access_token=o.access_token,e.user_orcid=o.orcid}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.readRecord=function(){e.show_xml=!0},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file diff --git a/css/fonts.min.css b/public/css/fonts.min.css similarity index 100% rename from css/fonts.min.css rename to public/css/fonts.min.css diff --git a/css/style.min.css b/public/css/style.min.css similarity index 100% rename from css/style.min.css rename to public/css/style.min.css diff --git a/fonts/28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf b/public/fonts/28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf similarity index 100% rename from fonts/28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf rename to public/fonts/28878a98-b041-4ebc-a448-f6d4b50c87b2.ttf diff --git a/fonts/2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff b/public/fonts/2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff similarity index 100% rename from fonts/2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff rename to public/fonts/2b43682c-fbbf-4d2c-aa8f-53c5e9c07b89.woff diff --git a/fonts/3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot b/public/fonts/3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot similarity index 100% rename from fonts/3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot rename to public/fonts/3d3ae305-c5f8-44e9-a93f-68343ef13a1e.eot diff --git a/fonts/41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff b/public/fonts/41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff similarity index 100% rename from fonts/41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff rename to public/fonts/41a107ac-0cb7-4bdf-92fa-3953ffd3624e.woff diff --git a/fonts/53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf b/public/fonts/53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf similarity index 100% rename from fonts/53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf rename to public/fonts/53ead41e-c0ab-44c3-bb7c-74d70d2c7ed7.ttf diff --git a/fonts/59939f92-3d8b-46f6-8852-3a0db259dea0.svg b/public/fonts/59939f92-3d8b-46f6-8852-3a0db259dea0.svg similarity index 100% rename from fonts/59939f92-3d8b-46f6-8852-3a0db259dea0.svg rename to public/fonts/59939f92-3d8b-46f6-8852-3a0db259dea0.svg diff --git a/fonts/5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff b/public/fonts/5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff similarity index 100% rename from fonts/5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff rename to public/fonts/5b426dca-cc4e-4627-9ff8-9f4dc55b0290.woff diff --git a/fonts/782849e5-a129-4cc1-8fa5-934ae2a82537.svg b/public/fonts/782849e5-a129-4cc1-8fa5-934ae2a82537.svg similarity index 100% rename from fonts/782849e5-a129-4cc1-8fa5-934ae2a82537.svg rename to public/fonts/782849e5-a129-4cc1-8fa5-934ae2a82537.svg diff --git a/fonts/7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg b/public/fonts/7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg similarity index 100% rename from fonts/7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg rename to public/fonts/7bf70546-8c62-412f-9a7f-ea4d750a97b9.svg diff --git a/fonts/a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff b/public/fonts/a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff similarity index 100% rename from fonts/a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff rename to public/fonts/a02a57aa-1a49-4b8c-ab1d-08fbd790aabe.woff diff --git a/fonts/a4c5f6d1-f02d-4144-aadf-10f97a718263.eot b/public/fonts/a4c5f6d1-f02d-4144-aadf-10f97a718263.eot similarity index 100% rename from fonts/a4c5f6d1-f02d-4144-aadf-10f97a718263.eot rename to public/fonts/a4c5f6d1-f02d-4144-aadf-10f97a718263.eot diff --git a/fonts/b88d89de-e476-4fd9-83a7-15f1178d78bd.eot b/public/fonts/b88d89de-e476-4fd9-83a7-15f1178d78bd.eot similarity index 100% rename from fonts/b88d89de-e476-4fd9-83a7-15f1178d78bd.eot rename to public/fonts/b88d89de-e476-4fd9-83a7-15f1178d78bd.eot diff --git a/fonts/c7502fea-5840-46ed-9666-3479a56bf828.ttf b/public/fonts/c7502fea-5840-46ed-9666-3479a56bf828.ttf similarity index 100% rename from fonts/c7502fea-5840-46ed-9666-3479a56bf828.ttf rename to public/fonts/c7502fea-5840-46ed-9666-3479a56bf828.ttf diff --git a/fonts/cba5f716-e0e3-43b2-accd-b5f4173e4695.svg b/public/fonts/cba5f716-e0e3-43b2-accd-b5f4173e4695.svg similarity index 100% rename from fonts/cba5f716-e0e3-43b2-accd-b5f4173e4695.svg rename to public/fonts/cba5f716-e0e3-43b2-accd-b5f4173e4695.svg diff --git a/fonts/da53b951-50dc-4a3c-a55a-932bdde8347e.ttf b/public/fonts/da53b951-50dc-4a3c-a55a-932bdde8347e.ttf similarity index 100% rename from fonts/da53b951-50dc-4a3c-a55a-932bdde8347e.ttf rename to public/fonts/da53b951-50dc-4a3c-a55a-932bdde8347e.ttf diff --git a/fonts/df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot b/public/fonts/df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot similarity index 100% rename from fonts/df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot rename to public/fonts/df888e01-3d42-4e4a-bbb8-7b8bbd7d55f0.eot diff --git a/fonts/ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff b/public/fonts/ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff similarity index 100% rename from fonts/ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff rename to public/fonts/ecb83bdf-e0aa-4a30-9394-c5a32be731ff.woff diff --git a/fonts/f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg b/public/fonts/f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg similarity index 100% rename from fonts/f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg rename to public/fonts/f317c23c-bff8-4972-b8d3-db5a0da45fdf.svg diff --git a/fonts/f54382aa-da70-46c5-bb6f-735919625300.ttf b/public/fonts/f54382aa-da70-46c5-bb6f-735919625300.ttf similarity index 100% rename from fonts/f54382aa-da70-46c5-bb6f-735919625300.ttf rename to public/fonts/f54382aa-da70-46c5-bb6f-735919625300.ttf diff --git a/fonts/f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot b/public/fonts/f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot similarity index 100% rename from fonts/f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot rename to public/fonts/f5eeb9ee-aa7f-48ee-8450-4034d3587f6d.eot diff --git a/img/ID_symbol.svg b/public/img/ID_symbol.svg similarity index 100% rename from img/ID_symbol.svg rename to public/img/ID_symbol.svg diff --git a/img/glyphicons-28-search-A6CE39.svg b/public/img/glyphicons-28-search-A6CE39.svg similarity index 100% rename from img/glyphicons-28-search-A6CE39.svg rename to public/img/glyphicons-28-search-A6CE39.svg diff --git a/img/glyphicons-31-pencil-A6CE39.svg b/public/img/glyphicons-31-pencil-A6CE39.svg similarity index 100% rename from img/glyphicons-31-pencil-A6CE39.svg rename to public/img/glyphicons-31-pencil-A6CE39.svg diff --git a/img/glyphicons-365-cloud-upload-A6CE39.svg b/public/img/glyphicons-365-cloud-upload-A6CE39.svg similarity index 100% rename from img/glyphicons-365-cloud-upload-A6CE39.svg rename to public/img/glyphicons-365-cloud-upload-A6CE39.svg diff --git a/img/glyphicons-433-plus-A6CE39.svg b/public/img/glyphicons-433-plus-A6CE39.svg similarity index 100% rename from img/glyphicons-433-plus-A6CE39.svg rename to public/img/glyphicons-433-plus-A6CE39.svg diff --git a/img/glyphicons-52-eye-open-A6CE39.svg b/public/img/glyphicons-52-eye-open-A6CE39.svg similarity index 100% rename from img/glyphicons-52-eye-open-A6CE39.svg rename to public/img/glyphicons-52-eye-open-A6CE39.svg diff --git a/img/glyphicons-86-repeat-A6CE39.svg b/public/img/glyphicons-86-repeat-A6CE39.svg similarity index 100% rename from img/glyphicons-86-repeat-A6CE39.svg rename to public/img/glyphicons-86-repeat-A6CE39.svg diff --git a/img/id-logo.png b/public/img/id-logo.png similarity index 100% rename from img/id-logo.png rename to public/img/id-logo.png diff --git a/img/orcid-logo.png b/public/img/orcid-logo.png similarity index 100% rename from img/orcid-logo.png rename to public/img/orcid-logo.png diff --git a/index.html b/public/index.html similarity index 100% rename from index.html rename to public/index.html diff --git a/js/.DS_Store b/public/js/.DS_Store similarity index 100% rename from js/.DS_Store rename to public/js/.DS_Store diff --git a/js/app.js b/public/js/app.js similarity index 99% rename from js/app.js rename to public/js/app.js index 97469d4..02e4c18 100644 --- a/js/app.js +++ b/public/js/app.js @@ -4,6 +4,7 @@ var wizardNgModule = angular.module('wizardApp',['ngCookies','ngResource']) $resourceProvider.defaults.stripTrailingSlashes = true; }]); +alert('here'); wizardNgModule.controller('stepsController', ['$scope','wizardSrvc','$location', function($scope, wizardSrvc, $location){ $scope.steps = [ {'title' : 'Introduction'}, diff --git a/public/js/app.min.js b/public/js/app.min.js new file mode 100644 index 0000000..e30480b --- /dev/null +++ b/public/js/app.min.js @@ -0,0 +1 @@ +var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);alert("here"),wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Using the API"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):(o=o.substr(0,6),e.wizardSrvc.current=4)},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]","/activities/read-limited /activities/update /orcid-profile/read-limited"),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,e.access_token=null,e.user_orcid=null,e.access_code=null,e.client_id=null,e.show_xml=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.getCode=function(){if(e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),void 0===e.access_code||null===e.access_code)o.path("/");else{var c=o.search().code;e.access_code=c.substr(0,6)}},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o,e.access_token=o.access_token,e.user_orcid=o.orcid}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.readRecord=function(){e.show_xml=!0},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file diff --git a/js/controllers.js b/public/js/controllers.js similarity index 100% rename from js/controllers.js rename to public/js/controllers.js diff --git a/src/.DS_Store b/src/.DS_Store deleted file mode 100644 index 43353c9e421ba213ad6daedb6d2a9c2854878b8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~&2G~`5XW~@xAljFj3}rQm%Sq8;3$E#HxtT%15zZTR*0ft$A&Djyix2lLRKW7 zIq(jA^BSnYjR)YuYamWA`;jPZ+GDGNcBI+=cz0(k|19r%5kj~#jvENM2q6=kt6@WP zg7IccHGPM<6yuhK@k??yc3Qdi7Of>k&3%vF_^^<7)$4I z812$z(sMWNu&fAamW&os_xETPvq^`IvpC-mWW7Ba7lWRAwL3}E`>b^G3>o;!RzW;DIefj3?yZ0YHe)@bU-xh}D zOxP8rGx-96fpXLbKaT7YjD24~HlMeE?e|I8>^?1~ETN@EoGlS6WGh5il%ML1ijdM+_{}p`WOEzS2sn zOh;H9KCrqoRwooJ?hf^dn2xY7RkxaeCUBI%ioA6B{(txM^Z(H#eWeL#0{;~OZ0rO( z9e5XK5gvg0N-L?*1Ezlj1P0w`0_RHL EFG{e?dH?_b From bf62abc6b0cd36ae242ab7b100a72fc23582c2ca Mon Sep 17 00:00:00 2001 From: rcpeters Date: Fri, 29 May 2015 02:55:23 -0700 Subject: [PATCH 5/6] reorg layout --- public/js/.DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 public/js/.DS_Store diff --git a/public/js/.DS_Store b/public/js/.DS_Store deleted file mode 100644 index 5008ddfcf53c02e82d7eee2e57c38e5672ef89f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0 Date: Fri, 29 May 2015 02:59:20 -0700 Subject: [PATCH 6/6] add non-minimized css --- gulpfile.js | 1 + public/js/app.js | 1 - public/js/app.min.js | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 764a800..94d04c8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -33,6 +33,7 @@ gulp.task('styles', function () { return (sass('./src/scss')) .on('error', function (err) { console.log(err.message); }) .pipe(plumber()) + .pipe(gulp.dest('./public/css')) .pipe(rename({ suffix: '.min' })) .pipe(minifycss()) .pipe(gulp.dest('./public/css')) diff --git a/public/js/app.js b/public/js/app.js index 02e4c18..97469d4 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -4,7 +4,6 @@ var wizardNgModule = angular.module('wizardApp',['ngCookies','ngResource']) $resourceProvider.defaults.stripTrailingSlashes = true; }]); -alert('here'); wizardNgModule.controller('stepsController', ['$scope','wizardSrvc','$location', function($scope, wizardSrvc, $location){ $scope.steps = [ {'title' : 'Introduction'}, diff --git a/public/js/app.min.js b/public/js/app.min.js index e30480b..18f7300 100644 --- a/public/js/app.min.js +++ b/public/js/app.min.js @@ -1 +1 @@ -var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);alert("here"),wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Using the API"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):(o=o.substr(0,6),e.wizardSrvc.current=4)},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]","/activities/read-limited /activities/update /orcid-profile/read-limited"),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,e.access_token=null,e.user_orcid=null,e.access_code=null,e.client_id=null,e.show_xml=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.getCode=function(){if(e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),void 0===e.access_code||null===e.access_code)o.path("/");else{var c=o.search().code;e.access_code=c.substr(0,6)}},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o,e.access_token=o.access_token,e.user_orcid=o.orcid}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.readRecord=function(){e.show_xml=!0},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file +var wizardNgModule=angular.module("wizardApp",["ngCookies","ngResource"]).config(["$locationProvider","$resourceProvider",function(e,o){e.html5Mode(!0),o.defaults.stripTrailingSlashes=!0}]);wizardNgModule.controller("stepsController",["$scope","wizardSrvc","$location",function(e,o,t){e.steps=[{title:"Introduction"},{title:"Accessing the API"},{title:"Using the API"},{title:"Get access token"},{title:"Get token"},{title:"Show token"},{title:"Read record"},{title:"Update record"}],e.init=function(){var o=t.search().code;void 0===o||null===o?console.log("Nothing here"):(o=o.substr(0,6),e.wizardSrvc.current=4)},e.wizardSrvc=o,e.init()}]),wizardNgModule.controller("controlsController",["$scope","wizardSrvc",function(e,o){e.wizardSrvc=o,e.next=function(){o.next()},e.finish=function(){o.finish()},e.back=function(){o.back()}}]),wizardNgModule.controller("authorizationCodeController",["$scope","$cookies","wizardSrvc",function(e,o,t){"localhost"==location.hostname&&(e.form={},e.form.client_id="APP-1X454QYQ66U6XW7X"),e.authString="http://[api_url]/oauth/authorize?client_id=[client_id]&response_type=code&redirect_uri=[redirect_uri]&scope=[scope]",e.wizardSrvc=t,e.getAuthorizationCode=function(){var t=e.authString;t=t.replace("[api_url]","sandbox.orcid.org"),t=t.replace("[client_id]",e.form.client_id),t=t.replace("[redirect_uri]","http://"+location.hostname+":8000"),t=t.replace("[scope]","/activities/read-limited /activities/update /orcid-profile/read-limited"),console.log(t),o.put("current",e.wizardSrvc.current),o.put("orcid_oauth2_client_id",e.form.client_id),o.put("orcid_oauth2_redirect_uri","http://"+location.hostname+":8000"),setTimeout(function(){window.location.href=t},125)}}]),wizardNgModule.controller("tokenController",["$scope","$location","$cookies","$http",function(e,o,t,c){e.show_access_token=!1,e.expires_in=!1,e.name=!1,e.orcid=!1,e.scope=!1,e.token_type=!1,e.access_token=null,e.user_orcid=null,e.access_code=null,e.client_id=null,e.show_xml=!1,"localhost"==location.hostname&&(e.client_secret="8fa38bea-48e2-4238-9479-e55448ffa225"),e.getCode=function(){if(e.access_code=o.search().code,e.client_id=t.get("orcid_oauth2_client_id"),void 0===e.access_code||null===e.access_code)o.path("/");else{var c=o.search().code;e.access_code=c.substr(0,6)}},e.exchangeCode=function(){c({url:"http://pub.sandbox.orcid.org/oauth/token",method:"post",headers:{"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},transformRequest:function(e){var o=[];for(var t in e)o.push(encodeURIComponent(t)+"="+encodeURIComponent(e[t]));var c=o.join("&");return console.log("****RETURNING "+c),c},data:{client_id:e.client_id,client_secret:e.client_secret,grant_type:"authorization_code",redirect_uri:"http://localhost:8000",code:e.access_code}}).success(function(o){e.wizardSrvc.current=5,e.token=o,e.access_token=o.access_token,e.user_orcid=o.orcid}).error(function(e,o,t,c){console.log("***OOPS "+o+" H: "+angular.toJson(e))})},e.show=function(o){switch(e.show_access_token=!1,e.show_expires_in=!1,e.show_name=!1,e.show_orcid=!1,e.show_scope=!1,e.show_token_type=!1,console.log(o),o){case"token":e.show_access_token=!0;break;case"expiration":e.show_expires_in=!0;break;case"name":e.show_name=!0;break;case"orcid":e.show_orcid=!0;break;case"scope":e.show_scope=!0;break;case"type":e.show_token_type=!0}},e.readRecord=function(){e.show_xml=!0},e.getCode()}]),wizardNgModule.service("wizardSrvc",["$rootScope",function(e){var o={current:0,elements:document.getElementsByClassName("step"),back:function(){o.current>0&&o.current--},next:function(){o.current==o.elements.length-1?o.current=0:o.current++},finish:function(){o.current=0}};return o}]); \ No newline at end of file