-
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.
Merge branch 'master' of github.com:t-minus-ten/apollo
- Loading branch information
Showing
35 changed files
with
14,101 additions
and
720 deletions.
There are no files selected for viewing
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,20 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"jquery": true, | ||
"es6": true | ||
}, | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
"rules": { | ||
"semi": 2 | ||
}, | ||
"globals": { | ||
"jQuery": true, | ||
"$": true | ||
} | ||
} |
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,38 @@ | ||
import Router from './modules/DomBasedRouter'; | ||
import { commonInit, commonFinalize } from './modules/commonScripts'; | ||
import { frontPageInit } from './modules/frontPageScripts'; | ||
|
||
/** | ||
* ES6 module implementation of Paul Irish's DOM based routing | ||
* @link https://gist.github.com/nathanaelnsmith/efc1ce2dd0b78db11632d47727361319 | ||
* | ||
* Javascript in `common` will fire on every page. The init() functions of each | ||
* route, starting with `common`, will fire first. Once the init() functions of | ||
* all routes have fired, the finalize() functions will fire. | ||
* | ||
* To add a page specific js, add the classname for a page, replacing all hyphens | ||
* with underscores (ex: 'front-page' should be 'front_page'). | ||
* | ||
* See: assets/js/modules/DomBasedRouter.js | ||
* | ||
*/ | ||
let routes = { | ||
'common': { | ||
init() { | ||
commonInit(); | ||
}, | ||
finalize() { | ||
commonFinalize(); | ||
} | ||
}, | ||
'front_page': { | ||
init() { | ||
frontPageInit(); | ||
} | ||
} | ||
}; | ||
|
||
let router = new Router(routes); | ||
|
||
router.load(); | ||
|
This file was deleted.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
app/themes/mission-control/assets/js/modules/DomBasedRouter.js
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,30 @@ | ||
/** | ||
* ES6 module implementation of Paul Irish's DOM based routing | ||
* @link https://gist.github.com/nathanaelnsmith/efc1ce2dd0b78db11632d47727361319 | ||
* | ||
*/ | ||
|
||
export default (routes) => { | ||
return { | ||
fire (func,funcname, args){ | ||
funcname = (funcname === undefined) ? 'init' : funcname; | ||
if (func !== '' && routes[func] && typeof routes[func][funcname] == 'function'){ | ||
routes[func][funcname](args); | ||
} | ||
}, | ||
load() { | ||
var bodyId = document.body.id; | ||
let Router = this; | ||
// hit up common first. | ||
Router.fire('common'); | ||
|
||
// do all the classes too. | ||
$.each(document.body.className.replace(/-/g, '_').split(/\s+/),function(i,classnm){ | ||
Router.fire(classnm); | ||
Router.fire(classnm,bodyId); | ||
}); | ||
|
||
Router.fire('common','finalize'); | ||
} | ||
}; | ||
}; |
27 changes: 22 additions & 5 deletions
27
app/themes/mission-control/assets/js/modules/commonScripts.js
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,9 +1,26 @@ | ||
/** | ||
* Module for js that fires on all pages. | ||
* This is an example of how you could break down a js file into parts | ||
* with es6. Here the `commonInit()` function will fire on all pages | ||
* because that function is called in the `init()` function of `common` | ||
* in app.js. | ||
* | ||
* `commonFinalize()` will fire on all pages once the `init()` functions | ||
* of each route in app.js have been fired. It is called in the | ||
* `finalize()` function of `common` in app.js. | ||
* | ||
*/ | ||
import { sampleMessage, sampleAddModule } from './sampleModule'; | ||
|
||
module.exports = function() { | ||
// This function will fire on init() in app.js | ||
export function commonInit() { | ||
console.log('See commonInit() in commonScripts.js \n' + | ||
'--- \n' + | ||
sampleMessage() + '\n' + | ||
sampleAddModule(3,3) | ||
); | ||
} | ||
|
||
console.log('We have liftoff.'); | ||
|
||
}; | ||
// This function will fire on finalize() in app.js | ||
export function commonFinalize() { | ||
console.log('See commonFinalize() in commonScripts.js'); | ||
} |
12 changes: 12 additions & 0 deletions
12
app/themes/mission-control/assets/js/modules/frontPageScripts.js
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,12 @@ | ||
/** | ||
* This is an example of how you could break down parts of js with es6. | ||
* | ||
* Here the `frontPageInit()` function will fire only on pages with a | ||
* body class of `front_page`. | ||
* | ||
*/ | ||
export function frontPageInit() { | ||
|
||
console.log( 'See frontPageInit() in frontPageScripts.js' ); | ||
|
||
} |
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,8 @@ | ||
// Export a message | ||
export const sampleMessage = () => 'This is the sampleMessage const from sampleModule.js'; | ||
|
||
// Export a basic addition function | ||
export function sampleAddModule(a, b = 2) { | ||
let val = a + b; | ||
return `The value of the sampleAddModule() is ${val}`; | ||
} |
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
47 changes: 47 additions & 0 deletions
47
app/themes/mission-control/assets/sass/partials/utilities/_reset.scss
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,47 @@ | ||
// Eric Meyer CSS reset | ||
// @link https://meyerweb.com/eric/tools/css/reset/ | ||
|
||
|
||
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; | ||
} |
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
Oops, something went wrong.