most pages under pseudo-nav behavior
authorec2-user <ec2-user@fcdev4.finalsclub.org>
Sun, 13 Nov 2011 06:08:17 +0000 (06:08 +0000)
committerec2-user <ec2-user@fcdev4.finalsclub.org>
Sun, 13 Nov 2011 06:08:17 +0000 (06:08 +0000)
public/index.html
public/javascripts/main.js

index c8ef418f6bcca6fbacc0c4f99adde1fa1216bf37..b2dde817a5c453bde6d85b63fa41ed54ea56810b 100644 (file)
                                                <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>
@@ -88,7 +88,7 @@
 
                        <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">&nbsp;
+                                                       </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">&nbsp;
+                                                       </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>
index 06ab9473f65c7aa2ab80b07188a348a0e23ba3a5..a002d073674759fb89bec23012a52633965f26b5 100644 (file)
@@ -30,8 +30,9 @@ function showSchools(matches, cb) {
        $.get("/schools", {}, function(response) {
 
                var schools = []
-               if(typeof response == 'object') 
+               if(typeof response == 'object') {
                        schools = response.schools
+               }
 
                ProtoDiv.replicate("PROTO_school", schools);
 
@@ -44,19 +45,25 @@ function showSchools(matches, cb) {
 
 
 // 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")
+
        });
 }
 
@@ -126,44 +133,46 @@ response = {
 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");
 }
 
 
@@ -179,6 +188,12 @@ function hideAllPages() {
 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 },
 ];
 
 
@@ -203,6 +218,10 @@ function showPage() {
                }
        }
 
+       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({
@@ -228,7 +247,7 @@ function goPage(path) {
 /* 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()