protodiv demo work 3/head
authorJoe Hitchens <joe@sleepless.com>
Fri, 11 Nov 2011 20:41:55 +0000 (12:41 -0800)
committerJoe Hitchens <joe@sleepless.com>
Fri, 11 Nov 2011 20:41:55 +0000 (12:41 -0800)
public/courses.html
public/schools.html

index e1354f0dabd93853d9598c1e1a3677f6eb5641f6..9980363ef0cb266d6229b5f3d0eb98b827b66302 100644 (file)
@@ -18,7 +18,7 @@
        <body>
 
 
-               <!-- masthead will be included dynamically -->
+               <!-- This is the masthead - include dynamically -->
                <div class="masthead"><div class="logbar"><div class="loginstatus">&nbsp;
                                </div></div><div class="navbar"><table><tr><td><a href="/"><img src="/images/finals-club-wht.png" class="logo"/></a></td><td class="menu"><a href="/schools">Courses</a><a href="http://blog.finalsclub.org">Blog</a><a href="/archive">Archive</a><a href="/press">Press</a><a href="/register">Create an Account</a><!-- span(class='sub_menu')--><a href="/login" class="special">Login</a></td></tr></table></div><div class="logbar">&nbsp;
                </div></div>
                        var school = document.location.search.match(/school=([^&]+)/)[1]
                        $("#school_name").html(school);
 
-                       // this will actually come from an AJAX call to a REST interface at "/api?..."
-                       var courses = [
-                               { id: "4e6d1e9b42bbef522c000a8f", name: "History 12: Introduction to the Middle East" },
-                               { id: "4e8aa3f62e4b97e67b001f47", name: "ANTH160AC/ISF 160: The Forms of Folklorek" }
-                       ]
 
-                       ProtoDiv.replicate("course_proto", courses);
+                       var courses = []
+                       if(false) {
+                               /*
+                               $.get("/api", { act: "getCourses", school: school }, function(r) {
+                                       courses = JSON.parse(r)
+                                       ProtoDiv.replicate("course_proto", courses);
+                               })
+                               */
+                       }
+                       else {
+                               var courses = [
+                                       { id: "4e6d1e9b42bbef522c000a8f", name: "History 12: Introduction to the Middle East" },
+                                       { id: "4e8aa3f62e4b97e67b001f47", name: "ANTH160AC/ISF 160: The Forms of Folklorek" }
+                               ]
+                               ProtoDiv.replicate("course_proto", courses);
+                       }
 
                        </script>
                </div>
@@ -55,7 +65,7 @@
 
 
 
-               <!-- This is the footer - will be included dynamically -->
+               <!-- This is the footer - include dynamically -->
                <div class="footer"><table><tr><td class="col1"><div class="logo"><img src="/images/finals-club-wht.png" title="FinalsClub.org" class="lilogo"/></div><div>Copyright 2011</div><div>All Rights Reserved</div></td><td class="col2"><a href="/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><a href="http://blog.finalsclub.org/team.html">Team</a></td></tr></table></div><div class="footerer"><p>This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License
                        </p><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png"/></a><a href="http://mixpanel.com/f/partner"><img alt="Real Time Web Analytics" src="http://mixpanel.com/site_media/images/partner/badge_blue.png" style="border-width:0;margin:2px;"/></a></p></div>
 
index 4085545d226741994527bbd1d66eef9f9e07ea83..ec1195cbc5e4af9a1a91405d0ccb2f6d2e1d2419 100644 (file)
@@ -18,7 +18,7 @@
        <body>
 
 
-               <!-- masthead will be included dynamically -->
+               <!-- This is the masthead - include dynamically -->
                <div class="masthead"><div class="logbar"><div class="loginstatus">&nbsp;
                                </div></div><div class="navbar"><table><tr><td><a href="/"><img src="/images/finals-club-wht.png" class="logo"/></a></td><td class="menu"><a href="/schools">Courses</a><a href="http://blog.finalsclub.org">Blog</a><a href="/archive">Archive</a><a href="/press">Press</a><a href="/register">Create an Account</a><!-- span(class='sub_menu')--><a href="/login" class="special">Login</a></td></tr></table></div><div class="logbar">&nbsp;
                </div></div>
 
                                <!-- This is the prototype div -->
                                <div class="school" id=schoolproto>
-                                       <h2><a href="courses.html?school=__name__">__name__</a></h2>
+                                       <div class=name>
+                                               <a href="courses.html?school=__name__">__name__</a>
+                                               (__numCourses__ courses)
+                                       </div>
                                </div>
 
 
                        </div>
                        <script>
 
-                       // this will actually come from an AJAX call to a REST interface at "/api?..."
-                       var schools = [
-                               { name: "Berkeley" }
-                       ]
+                       var schools = []
+
+                       if(false) {
+                               // this is what will really happen when we're done
+                               $.get("/api", { act: "getSchools" }, function(r) {
+                                       schools = JSON.parse(r)
+                                       ProtoDiv.replicate("schoolproto", schools);
+                               });
+                       } else {
+                               // this is just to demonstrate
+                               schools = [
+                                       { name: "Berkeley", numCourses: 2 },
+                                       { name: "Brown", numCourses: 5 },
+                                       { name: "Columbia", numCourses: 0 },
+                               ];
+                               ProtoDiv.replicate("schoolproto", schools);
+                       }
 
-                       ProtoDiv.replicate("schoolproto", schools);
 
                        </script>
                </div>
@@ -53,7 +68,7 @@
 
 
 
-               <!-- This is the footer - will be included dynamically -->
+               <!-- This is the footer - include dynamically -->
                <div class="footer"><table><tr><td class="col1"><div class="logo"><img src="/images/finals-club-wht.png" title="FinalsClub.org" class="lilogo"/></div><div>Copyright 2011</div><div>All Rights Reserved</div></td><td class="col2"><a href="/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><a href="http://blog.finalsclub.org/team.html">Team</a></td></tr></table></div><div class="footerer"><p>This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License
                        </p><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/us/88x31.png"/></a><a href="http://mixpanel.com/f/partner"><img alt="Real Time Web Analytics" src="http://mixpanel.com/site_media/images/partner/badge_blue.png" style="border-width:0;margin:2px;"/></a></p></div>