site/js/docurium.js in docurium-0.1.0 vs site/js/docurium.js in docurium-0.2.0
- old
+ new
@@ -63,13 +63,13 @@
collapseSection: function(data) {
$(this).next().toggle(100)
return false
},
- showIndexPage: function() {
+ showIndexPage: function(replace) {
version = docurium.get('version')
- ws.saveLocation(version)
+ ws.navigate(version, {replace: replace})
data = docurium.get('data')
content = $('.content')
content.empty()
@@ -167,21 +167,23 @@
// Show Function History
sigs = $('<div>').addClass('signatures')
sigs.append($('<h3>').append("versions"))
sigHist = docurium.get('signatures')[fname]
+ var list = $('<ul>')
for(var i in sigHist.exists) {
ver = sigHist.exists[i]
link = $('<a>').attr('href', '#' + groupLink(gname, fname, ver)).append(ver)
if(sigHist.changes[ver]) {
link.addClass('changed')
}
if(ver == docurium.get('version')) {
link.addClass('current')
}
- sigs.append(link)
+ list.append($('<li>').append(link))
}
+ sigs.append(list)
content.append(sigs)
// Link to Function Def on GitHub
link = this.github_file(fdata[fname].file, fdata[fname].line, fdata[fname].lineto)
flink = $('<a>').attr('target', 'github').attr('href', link).append(fdata[fname].file)
@@ -296,11 +298,11 @@
}
tdata = docurium.get('data')['types'][ref]
tname = tdata[0]
data = tdata[1]
- ws.saveLocation(typeLink(tname))
+ ws.navigate(typeLink(tname))
content = $('.content')
content.empty()
content.append($('<h1>').addClass('funcTitle').append(tname).append($("<small>").append(data.type)))
@@ -349,11 +351,11 @@
}
group = docurium.get('data')['groups'][ref]
fdata = docurium.get('data')['functions']
gname = group[0]
- ws.saveLocation(groupLink(gname));
+ ws.navigate(groupLink(gname));
functions = group[1]
$('.content').empty()
$('.content').append($('<h1>').append(gname + ' functions'))
@@ -539,11 +541,11 @@
if (value.length < 3) {
return false
}
this.searchResults = []
- ws.saveLocation(searchLink(value))
+ ws.navigate(searchLink(value))
data = docurium.get('data')
// look for functions (name, comment, argline)
for (var name in data.functions) {
@@ -594,11 +596,11 @@
}
})
- var Workspace = Backbone.Controller.extend({
+ var Workspace = Backbone.Router.extend({
routes: {
"": "main",
":version": "main",
":version/group/:group": "group",
@@ -608,10 +610,12 @@
"p/changelog": "changelog",
},
main: function(version) {
docurium.setVersion(version)
- docurium.showIndexPage()
+ // when asking for '/', replace with 'HEAD' instead of redirecting
+ var replace = version == undefined
+ docurium.showIndexPage(replace)
},
group: function(version, gname) {
docurium.setVersion(version)
docurium.showGroup(null, gname)