Permalink
Browse files

Add simple page-alias support; for example "/about/resume" and "/resu…

…me" both go to the same page.

If set, "title" on subpage anchor is set as the page title.
Adds stub for about page.
  • Loading branch information...
jschementi committed Jul 12, 2010
1 parent b4ae694 commit 3582175c811d82add3fb846e0eaa807958746543
Showing with 44 additions and 21 deletions.
  1. +6 −3 TODO
  2. +30 −15 public/app.js
  3. +2 −0 views/_about.erb
  4. +0 −1 views/_home.erb
  5. +6 −2 views/layout.erb
View
9 TODO
@@ -1,11 +1,14 @@
-URGENT About page
+URGENT About page content
+URGENT project page content
+URGENT writing page content
URGENT more thought-through sitemap
URGENT footer
-Sub-navigation
-use "lightbox" for flickr pictures
+
+Sub-navigation UI
make links work in twitter message
Project pages
My "public" appearances / talking events
+
theme for only main page? Should I pick black or white?
Switch from blogger to a self-hosted blog engine, or make new blogger template
Maybe use the "J" navigation from a old 2004-2005 design
View
@@ -53,7 +53,20 @@ var hideBackground = function() {
$('#background').hide()
}
-var navigateTo = function(topic) {
+var title = document.title;
+
+var routes = {
+ '/home': '/',
+ '/resume': '/about/resume'
+}
+
+var navigateTo = function(navevent) {
+ var topic = navevent.path;
+
+ if (routes[topic] != null) {
+ topic = routes[topic];
+ }
+
var isHome = function() { return topic == '/' }
if (!isHome()) {
@@ -67,11 +80,23 @@ var navigateTo = function(topic) {
actualTopic = topic.replace(/^\//, '++')
$('.topic').hide();
- var jtopic = $('a[name=' + actualTopic + ']').parent();
+ topicElement = $('a[name=' + actualTopic + ']');
+ var jtopic = topicElement.parent();
jtopic.show();
+ toplevel_topic = isHome() ? '/' : ('/' + topic.split('/')[1])
+
$('#navigation a').removeAttr('id');
- $('#navigation a[href=#' + topic + ']').attr('id', 'active');
+ $('#navigation a[href=#' + toplevel_topic + ']').attr('id', 'active');
+
+ if (topicElement.attr('title') == '') {
+ var names = $.map(navevent.pathNames, function(n) {
+ return n.substr(0, 1).toUpperCase() + n.substr(1);
+ }).concat(navevent.parameters.id ? navevent.parameters.id.split('.') : []);
+ $.address.title([title].concat(names).join(' > '));
+ } else {
+ $.address.title(topicElement.attr('title'));
+ }
}
var islandMouseIn = function () {
@@ -218,7 +243,7 @@ var generateHomepagePhotoFeed = function(rsp) {
a.html(img);
$('#home-photos').append(a);
});
- $("a[rel='flickr-latest']").lightBox();
+ $("a[rel='flickr-latest']").lightBox({fixedNavigation:true});
});
}
);
@@ -277,14 +302,4 @@ $(document).ready(function() {
setBackground(document.body.id);
})
-var title = document.title;
-
-$.address.change(function (event) {
- navigateTo(event.path);
-
- var names = $.map(event.pathNames, function(n) {
- return n.substr(0, 1).toUpperCase() + n.substr(1);
- }).concat(event.parameters.id ? event.parameters.id.split('.') : []);
-
- $.address.title([title].concat(names).join(' > '));
-});
+$.address.change(navigateTo);
View
@@ -0,0 +1,2 @@
+<p>Need more general info about me ...</p>
+<p><a href="#/about/resume">Resume</a></p>
View
@@ -15,7 +15,6 @@
<i style='float: left; padding: 0.5em; font-size: 1.3em;'>and</i>
<a rel='external-about' href="http://www.facebook.com/profile.php?id=29100024" title="Jimmy Schementi" target="_blank" style="display: block; float: left; background-image: url(http://badge.facebook.com/badge/29100024.194.1526369336.png); border: 0; width: 120px; height: 26px; margin-top: 4px;">&nbsp;</a>
-
<div style="clear: left; padding-top: 0.3em; font-size: 18px;">
<a href="resume" rel="address:/resume">Resume</a> (<a href="jimmy_schementi.pdf">pdf</a> | <a href="jimmy_schementi.txt">txt</a>)
</div>
View
@@ -10,7 +10,6 @@
<script src="jquery.address-1.2.js" type="text/javascript"></script>
<script src="jquery.jfeed.js" type="text/javascript"></script>
<script src="jquery.lightbox-0.5.js" type="text/javascript"></script>
- <script src="jquery.idTabs.pack.js" type="text/javascript"></script>
<link type="text/css" media="screen" rel="stylesheet" href="colorbox/example5/colorbox.css" />
<link type="text/css" media="screen" rel="stylesheet" href="jquery.lightbox-0.5.css" />
@@ -89,8 +88,13 @@
<%= erb :_assistment, :layout => false %>
</div>
+ <div id="about" class="topic subpage" style="display: none">
+ <a name="/about"></a>
+ <%= erb :_about, :layout => false %>
+ </div>
+
<div id="resume" class="topic subpage" style="display: none">
- <a name="/resume"></a>
+ <a name="/about/resume" title="Jimmy Schementi - Software Developer"></a>
<%= erb :_resume, :layout => false %>
</div>

0 comments on commit 3582175

Please sign in to comment.