Last active
November 16, 2017 09:29
-
-
Save deap82/bf1cd2b8790ec2fee14746e64380f505 to your computer and use it in GitHub Desktop.
Aurelia Gist - boilerplate with routing (and visible log)
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
<template> | |
<ul id="menu"> | |
<li><a href="#/Welcome">Welcome</a></li> | |
<li><a href="#/Products">Products</a></li> | |
<li><a href="#/Contact">Contact</a></li> | |
</ul> | |
<div id="content"> | |
<router-view></router-view> | |
</div> | |
<div id="output-wrapper"> | |
<div id="output"></div> | |
<button type="button" onclick="document.getElementById('output').innerHTML='';">Clear</button> | |
</div> | |
</template> |
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
import { OutputService as output } from 'output-service'; | |
export class App { | |
configureRouter(config, router) { | |
console.log('configureRouter'); | |
config.map([ | |
{ route: '', redirect: 'Welcome' }, | |
{ route: 'Welcome', name: 'Welcome', moduleId: 'page-welcome' }, | |
{ route: 'Products', name: 'Products', moduleId: 'page-products' }, | |
{ route: 'Contact', name: 'Contact', moduleId: 'page-contact' } | |
]); | |
} | |
} |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Aurelia</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<link rel="stylesheet" href="styles.css" /> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script> | |
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script> | |
<script> | |
require(['aurelia-bootstrapper']); | |
</script> | |
</body> | |
</html> |
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
export class OutputService { | |
static log(message) { | |
var outputEl = document.getElementById('output'); | |
var currentContent = outputEl.innerHTML; | |
outputEl.innerHTML = message + '<br />' + currentContent; | |
console.log(message); | |
} | |
} |
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
<template> | |
<h1>Contact</h1> | |
</template> |
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
import { OutputService as console } from 'output-service'; | |
export class Contact { | |
} |
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
<template> | |
<h1>Products</h1> | |
</template> |
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
import { OutputService as console } from 'output-service'; | |
export class Products { | |
} |
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
<template> | |
<h1>Welcome</h1> | |
</template> |
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
import { OutputService as console } from 'output-service'; | |
export class Welcome { | |
} |
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
html, html *, html *:before, html *:after { | |
box-sizing: border-box; | |
} | |
body { | |
padding: 0; | |
margin: 0; | |
font-family: sans-serif; | |
} | |
#content { | |
padding: 10px; | |
} | |
#menu { | |
background: #26418f; | |
color: white !important; | |
padding: 10px; | |
margin: 0; | |
} | |
#menu li { | |
display: inline-block; | |
} | |
#menu li + li { | |
margin-left: 10px; | |
border-left: 1px solid white; | |
padding-left: 10px; | |
} | |
#menu li a { | |
color: white; | |
text-decoration: none; | |
} | |
#output-wrapper { | |
padding: 0px 0 10px 10px; | |
border-top: 1px solid orange; | |
background: #FFFFA5; | |
position: absolute; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
height: 150px; | |
font-family: Consolas; | |
} | |
#output-wrapper #output { | |
padding-top: 10px; | |
overflow-y: auto; | |
height: calc(100% - 30px); | |
} | |
#output-wrapper button { | |
position: absolute; | |
bottom: 10px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment