forked from ga-wdi-boston/jquery-ajax-get-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update from browser-template and talk template
Refresh for cohort 016 Close #26
- Loading branch information
Jeffrey Horn
committed
Jan 19, 2017
1 parent
68dd40f
commit ae94234
Showing
21 changed files
with
481 additions
and
348 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
exclude: 'node_modules/*' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,8 +69,8 @@ We'll take a stepped approach: | |
1. Invoke the collection retrieval method from the submit handler passing the | ||
success and fail callbacks. | ||
|
||
## [License](LICENSE) | ||
## [License](LICENSE) | ||
|
||
1. All content is licensed under a CCBYNCSA 4.0 license. | ||
1. All software code is licensed under GNU GPLv3. For commercial use or | ||
alternative licensing, please contact [email protected]. | ||
1. All content is licensed under a CCBYNCSA 4.0 license. | ||
1. All software code is licensed under GNU GPLv3. For commercial use or | ||
alternative licensing, please contact [email protected]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
'use strict'; | ||
|
||
const config = { | ||
apiOrigins: { | ||
production: 'https://ga-wdi-boston.herokuapp.com', | ||
}, | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
'use strict'; | ||
|
||
// user require with a reference to bundle the file and use it in this file | ||
// var example = require('./example'); | ||
const setAPIOrigin = require('../../lib/set-api-origin'); | ||
const config = require('./config'); | ||
|
||
// use require without a reference to ensure a file is bundled | ||
require('./example'); | ||
|
||
const bookEvents = require('./books/events'); | ||
|
||
// On document ready | ||
$(() => { | ||
|
||
setAPIOrigin(location, config); | ||
}); | ||
|
||
// use require with a reference to bundle the file and use it in this file | ||
// const example = require('./example'); | ||
|
||
// use require without a reference to ensure a file is bundled | ||
require('./example'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
const store = { | ||
}; | ||
|
||
module.exports = store; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"tests": { | ||
"src": ["vendor.bundle.js", "bundle.js"], | ||
"src": ["public/vendor.js", "public/application.js"], | ||
"options": { | ||
"specs": "specs.js" | ||
"specs": "public/specs.js" | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
'use strict'; | ||
|
||
const ghPagesList = [ | ||
'index.html', | ||
'favicon.ico', | ||
'public', | ||
].join(' '); | ||
|
||
module.exports = { | ||
'git-is-clean': { | ||
// `$(git status --porcelain)` will evaluate to the empty string if the | ||
// working directory is clean. | ||
// `test -z` will exit 0 (true) if its argument is an empty string. | ||
// If it doesn't exit true, `(git status && false)` will show why the | ||
// repository isn't clean and exit false causing the grunt tasks to end. | ||
command: 'test -z "$(git status --porcelain)" || (git status && false)', | ||
}, | ||
'git-push-master': { | ||
command: 'git push origin master', | ||
}, | ||
'deploy-prepare': { | ||
command: [ | ||
'git checkout master', | ||
'git branch -D gh-pages || echo "so not removed"', | ||
'git checkout --orphan gh-pages', | ||
'git rm --cached \'*\'', | ||
].join(' && '), | ||
}, | ||
'deploy-publish': { | ||
command: [ | ||
'touch .nojekyll', | ||
`git add --force .nojekyll ${ghPagesList}`, | ||
'git commit -m "deploy task"', | ||
'git push origin gh-pages --force', | ||
'git clean -x -d --force --exclude=node_modules', | ||
'git checkout master', | ||
].join(' && '), | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
'use strict'; | ||
|
||
const addNestedValue = function (pojo, name, value) { | ||
const recurse = function recurse(pojo, keys, value) { | ||
value = decodeURIComponent(value); | ||
let key = decodeURIComponent(keys.shift()); | ||
let next = keys[0]; | ||
if (next === '') { // key is an array | ||
pojo[key] = pojo[key] || []; | ||
pojo[key].push(value); | ||
} else if (next) { // key is a parent key | ||
pojo[key] = pojo[key] || {}; | ||
recurse(pojo[key], keys, value); | ||
} else { // key is the key for value | ||
pojo[key] = value; | ||
} | ||
|
||
return pojo; | ||
}; | ||
|
||
let keys = name.split('[').map((k) => k.replace(/]$/, '')); | ||
return recurse(pojo, keys, value); | ||
}; | ||
|
||
module.exports = addNestedValue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
const addNestedValue = require('./add-nested-value'); | ||
|
||
const parseNestedQuery = queryString => | ||
queryString.split('&') | ||
.reduce((memo, element) => { | ||
if (element) { | ||
let keyValuePair = element.split('='); | ||
memo = addNestedValue(memo, keyValuePair[0], keyValuePair[1]); | ||
} | ||
|
||
return memo; | ||
}, {}); | ||
|
||
module.exports = parseNestedQuery; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
'use strict'; | ||
|
||
const parseNestedQuery = require('./parse-nested-query'); | ||
|
||
/* | ||
possibilites to handle and example URLs: | ||
client local, api local | ||
http://localhost:7165/ | ||
client local, api remote | ||
http://localhost:7165/?environment=production | ||
client remote, api local | ||
https://ga-wdi-boston.github.io/browser-template/?environment=development | ||
This will require allowing "unsafe scripts" in Chrome | ||
client remote, api remote | ||
https://ga-wdi-boston.github.io/browser-template/ | ||
*/ | ||
|
||
const setAPIOrigin = (location, config) => { | ||
// strip the leading `'?'` | ||
const search = parseNestedQuery(location.search.slice(1)); | ||
|
||
if (search.environment === 'development' || | ||
location.hostname === 'localhost' && | ||
search.environment !== 'production') { | ||
if (!(config.apiOrigin = config.apiOrigins.development)) { | ||
let port = +('GA'.split('').reduce((p, c) => | ||
p + c.charCodeAt().toString(16), '') | ||
); | ||
config.apiOrigin = `http://localhost:${port}`; | ||
} | ||
} else { | ||
config.apiOrigin = config.apiOrigins.production; | ||
} | ||
}; | ||
|
||
module.exports = setAPIOrigin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters