Permalink
Browse files

fix for groups issues

  • Loading branch information...
schacon committed Jun 15, 2011
1 parent d127721 commit c09363f58b7b484b8fe32dcd5d56eb7a53ddc683
Showing with 22 additions and 12 deletions.
  1. +1 −2 TODO.txt
  2. +4 −1 lib/docurium.rb
  3. +17 −9 site/js/docurium.js
View
@@ -1,8 +1,7 @@
TODO
-* cross-link rocco code
+* broken changelog & index page highlighting
-* fix to group chooser
* version history for types, too
View
@@ -14,6 +14,7 @@ def initialize(config_file)
raise "You need to specify a config file" if !config_file
raise "You need to specify a valid config file" if !valid_config(config_file)
@sigs = {}
+ @groups = {}
clear_data
end
@@ -122,7 +123,8 @@ def generate_docs
:versions => versions.reverse,
:github => @options['github'],
:name => @options['name'],
- :signatures => @sigs
+ :signatures => @sigs,
+ :groups => @groups
}
File.open("project.json", 'w+') do |f|
f.write(project.to_json)
@@ -260,6 +262,7 @@ def group_functions
group = value[:file].gsub('.h', '').gsub('/', '_')
end
@data[:functions][key][:group] = group
+ @groups[key] = group
func[group] ||= []
func[group] << key
func[group].sort!
View
@@ -10,7 +10,7 @@ $(function() {
loadVersions: function() {
$.getJSON("project.json", function(data) {
- docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name})
+ docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name, 'groups': data.groups})
if(data.name) {
$('#site-title').text(data.name + ' API')
document.title = data.name + ' API'
@@ -100,11 +100,18 @@ $(function() {
}
},
+ getGroup: function(gname) {
+ var groups = docurium.get('data')['groups']
+ for(var i in groups) {
+ if(groups[i][0] == gname) {
+ return groups[i]
+ }
+ }
+ },
+
showFun: function(gname, fname) {
- id = '#groupItem' + gname
- ref = parseInt($(id).attr('ref'))
+ group = docurium.getGroup(gname)
- group = docurium.get('data')['groups'][ref]
fdata = docurium.get('data')['functions']
gname = group[0]
functions = group[1]
@@ -200,7 +207,7 @@ $(function() {
// Show other functions in this group
also = $('<div>').addClass('also')
- flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>')
+ flink = $('<a href="#' + docurium.get('version') + '/group/' + group[0] + '">' + group[0] + '</a>')
flink.click( docurium.showGroup )
also.append("Also in ")
also.append(flink)
@@ -259,14 +266,16 @@ $(function() {
content.append($('<h3>').append(version))
cl = $('<div>').addClass('changelog')
+ console.log(version)
+
for(var type in changelog[version]) {
adds = changelog[version][type]
adds.sort()
addsection = $('<p>')
for(var j in adds) {
add = adds[j]
- gname = docurium.groupOf(add)
if(type != 'deletes') {
+ gname = docurium.groupOf(add)
addlink = $('<a>').attr('href', '#' + groupLink(gname, add, version)).append(add)
} else {
addlink = add
@@ -392,9 +401,8 @@ $(function() {
return text
},
- groupHash: false,
groupOf: function (func) {
- return this.get('data').functions[func].group
+ return this.get('groups')[func]
},
addHotlinks: function() {
@@ -488,7 +496,7 @@ $(function() {
menu.append(filelist)
// Examples List
- if(data['examples'].length > 0) {
+ if(data['examples'] && (data['examples'].length > 0)) {
title = $('<h3><a href="#">Examples</a></h3>').click( this.collapseSection )
menu.append(title)
filelist = $('<ul>')

0 comments on commit c09363f

Please sign in to comment.