<td class="menu">
<a href="javascript:goPage('/schools')">Start Here!</a>
<a href="http://blog.finalsclub.org">Blog</a>
- <a href="javascript:goArchivedSubjects()">Archive</a>
- <a href="javascript:goPress()">Press</a>
- <a href="javascript:goRegister()">Create an Account</a>
- <a href="javascript:goLogin()" class="special">Login</a>
+ <a href="javascript:goPage('/archive')">Archive</a>
+ <a href="javascript:goPage('/press')">Press</a>
+ <a href="javascript:goPage('/register')">Create an Account</a>
+ <a href="javascript:goPage('/login')" class="special">Login</a>
</td>
</tr>
</table>
<div class=page id=pg_schools>
<h1>Universities</h1>
- <div class="school" id=PROTO_school onclick="goCourses('__name__', '___id__', __i__)">
+ <div class="school" id=PROTO_school onclick="goPage('/school/___id__')">
<div class=name>__name__</div>
<div class=desc>__description__</div>
</div>
+ <div class=page id=pg_login>
+ <h1>Login</h1>
+ <form id="credentials" action="/login" method="POST">
+ <div class="zarea">
+ <div class="row">
+ <div class="label">
+ <label for="email">Email</label>
+ </div>
+ <div class="field">
+ <input type="text" name="email" size="15" value="joe@sleepless.com">
+ </div>
+ </div>
+ <div class="row">
+ <div class="label">
+ <label for="password">Password</label>
+ </div>
+ <div class="field">
+ <input type="password" name="password" size="15">
+ </div>
+ </div>
+ <div class="row">
+ <div class="label">
+ </div>
+ <div class="field">
+ <button class="major">Login</button>
+ <span class="reglink">
+ <a href="/resetpw">Forgot password?</a>
+ </span>
+ </div>
+ </div>
+ <div class="row">
+ <div class="label">
+ </div>
+ <div class="field">
+ <span class="reglink">
+ <a href="/register">Create an Account</a>
+ </span>
+ </div>
+ </div>
+ </div>
+ </form>
+ </div>
+
+
<div class=page id=pg_conduct>
<div class="conduct">
<h1>Code of Conduct</h1>
+ <div class=page id=pg_notfound>
+ <h1>Page Not Found</h1>
+ Sorry, there is no content for this page.
+ </div>
+
+
</div>
<div>All Rights Reserved</div>
</td>
<td class="col2">
- <a href="javascript:goConduct()">Code of Conduct</a>
+ <a href="javascript:goPage('/conduct')">Code of Conduct</a>
<a href="http://blog.finalsclub.org/about.html">About</a>
<a href="http://blog.finalsclub.org/contact.html">Contact</a>
<a href="http://blog.finalsclub.org/legal.html">Legal</a>
$.get("/schools", {}, function(response) {
var schools = []
- if(typeof response == 'object')
+ if(typeof response == 'object') {
schools = response.schools
+ }
ProtoDiv.replicate("PROTO_school", schools);
// go to the page that lists the courses for a specific school
-var courses = []
-function goCourses(schoolName, schoolId, a) {
+function showCourses(matches, cb) {
+
+ var schoolId = matches[1]
+
ProtoDiv.reset("PROTO_course");
- hideAllPages();
+
$.get("/school/"+schoolId, {}, function(response) {
- courses = []
+
+ var courses = []
if(typeof response == 'object') {
var school = response.school
$("#school_name").html(school.name);
courses = school.courses
}
+
ProtoDiv.replicate("PROTO_course", courses);
- goPage("courses", "/courses/"+schoolId)
+
+ cb("courses")
+
});
}
var archivedSubjects = []
// go to the page that lists the archived subject names
-function goArchivedSubjects() {
- hideAllPages();
+function showArchive(matches, cb) {
- // fake data
+ // xxx fake data
archivedSubjects = [
{ id: 83, title: "Anthropology" },
{ id: 44, title: "CORE-Foreign Cultures" },
{ id: 80, title: "CORE-Historical Study" }
]
- ProtoDiv.reset("PROTO_archived_subjects");
- ProtoDiv.replicate("PROTO_archived_subjects", archivedSubjects);
+ ProtoDiv.reset("PROTO_archived_subjects")
+ ProtoDiv.replicate("PROTO_archived_subjects", archivedSubjects)
- goPage("archive");
+ cb("archive")
}
-
// go to the account registration page
-function goRegister() {
- hideAllPages();
+function showRegister(matches, cb) {
// xxx clear fields?
// xxx change FORM to use AJAX
- goPage("register");
+ cb("register");
+}
+
+
+function showLogin(matches, cb) {
+ cb("login");
}
+
+
// go to the press articles page
-function goPress() {
- hideAllPages();
- goPage("press");
+function showPress(matches, cb) {
+ cb("press");
}
// go to the "code of conduct" page
-function goConduct() {
- hideAllPages();
- goPage("conduct");
+function showConduct(matches, cb) {
+ cb("conduct");
}
var pageVectors = [
{ regex: /^\/(index.html)?$/, func: showHome },
{ regex: /^\/schools/, func: showSchools },
+ { regex: /^\/school\/([a-f0-9]{24})/, func: showCourses },
+ { regex: /^\/login/, func: showLogin },
+ { regex: /^\/register/, func: showRegister },
+ { regex: /^\/press/, func: showPress },
+ { regex: /^\/archive/, func: showArchive },
+ { regex: /^\/conduct/, func: showConduct },
];
}
}
+ if(i == pageVectors.length) {
+ $("#pg_notfound").fadeIn(100);
+ $('html, body').animate({ scrollTop: 0 }, 100);
+ }
// scroll to top of page (as if we'd done a real page fetch)
//$('html, body').animate({ scrollTop: 0 }, 100);
/*$('html, body').animate({
/* Simulates a "back" browser navigation.
*/
function goBack(event) {
- var state = event.state; alert("pop: "+o2j(state));
+ var state = event.state; //alert("pop: "+o2j(state));
showPage()