tweak crazy mikes

This commit is contained in:
Sam Caldwell 2017-03-23 17:07:03 -04:00
parent 425a5abac3
commit 9498f5129e
2 changed files with 5 additions and 3 deletions

View File

@ -16,7 +16,7 @@
<div class="hero-image"></div>
<div class="nav-bar" id="nav-bar">
<template id="nav-bar-btn">
<div id="nav-btn-{{order}}" class="nav-btn">{{name}}</div>
<div id="nav-btn-{{name}}" class="nav-btn">{{name}}</div>
</template>
</div>
<div id="page-contents">

View File

@ -6,8 +6,10 @@ function spawnNavBar(defaultPage) {
field this.currentPage = defaultPage;
assert currentPage(this.currentPage);
on message Syndicate.UI.globalEvent('.nav-btn', 'click', $e) {
// INVARIANT: the text content of each nav bar button is the page name
this.currentPage = e.originalTarget.textContent;
// INVARIANT: the id of each nav bar button is of the form 'nav-btn-Name',
// where Name is the name of the page associated with that button
var newPage = e.target.id.match(/nav-btn-(.*)/)[1];
this.currentPage = newPage;
}
}
}