Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix for groups issues

  • Loading branch information...
commit c09363f58b7b484b8fe32dcd5d56eb7a53ddc683 1 parent d127721
Scott Chacon authored June 15, 2011
3  TODO.txt
... ...
@@ -1,8 +1,7 @@
1 1
 TODO
2 2
 
3  
-* cross-link rocco code
  3
+* broken changelog & index page highlighting
4 4
 
5  
-* fix to group chooser
6 5
 
7 6
 * version history for types, too
8 7
 
5  lib/docurium.rb
@@ -14,6 +14,7 @@ def initialize(config_file)
14 14
     raise "You need to specify a config file" if !config_file
15 15
     raise "You need to specify a valid config file" if !valid_config(config_file)
16 16
     @sigs = {}
  17
+    @groups = {}
17 18
     clear_data
18 19
   end
19 20
 
@@ -122,7 +123,8 @@ def generate_docs
122 123
         :versions => versions.reverse,
123 124
         :github   => @options['github'],
124 125
         :name     => @options['name'],
125  
-        :signatures => @sigs
  126
+        :signatures => @sigs,
  127
+        :groups   => @groups
126 128
       }
127 129
       File.open("project.json", 'w+') do |f|
128 130
         f.write(project.to_json)
@@ -260,6 +262,7 @@ def group_functions
260 262
         group = value[:file].gsub('.h', '').gsub('/', '_')
261 263
       end
262 264
       @data[:functions][key][:group] = group
  265
+      @groups[key] = group
263 266
       func[group] ||= []
264 267
       func[group] << key
265 268
       func[group].sort!
26  site/js/docurium.js
@@ -10,7 +10,7 @@ $(function() {
10 10
 
11 11
     loadVersions: function() {
12 12
       $.getJSON("project.json", function(data) {
13  
-        docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name})
  13
+        docurium.set({'versions': data.versions, 'github': data.github, 'signatures': data.signatures, 'name': data.name, 'groups': data.groups})
14 14
         if(data.name) {
15 15
           $('#site-title').text(data.name + ' API')
16 16
           document.title = data.name + ' API'
@@ -100,11 +100,18 @@ $(function() {
100 100
       }
101 101
     },
102 102
 
  103
+    getGroup: function(gname) {
  104
+      var groups = docurium.get('data')['groups']
  105
+      for(var i in groups) {
  106
+        if(groups[i][0] == gname) {
  107
+          return groups[i]
  108
+        }
  109
+      }
  110
+    },
  111
+
103 112
     showFun: function(gname, fname) {
104  
-      id = '#groupItem' + gname
105  
-      ref = parseInt($(id).attr('ref'))
  113
+      group = docurium.getGroup(gname)
106 114
 
107  
-      group = docurium.get('data')['groups'][ref]
108 115
       fdata = docurium.get('data')['functions']
109 116
       gname = group[0]
110 117
       functions = group[1]
@@ -200,7 +207,7 @@ $(function() {
200 207
 
201 208
       // Show other functions in this group
202 209
       also = $('<div>').addClass('also')
203  
-      flink = $('<a href="#" ref="' + ref.toString() + '" id="groupItem' + group[0] + '">' + group[0] + '</a>')
  210
+      flink = $('<a href="#' + docurium.get('version') + '/group/' + group[0] + '">' + group[0] + '</a>')
204 211
       flink.click( docurium.showGroup )
205 212
       also.append("Also in ")
206 213
       also.append(flink)
@@ -259,14 +266,16 @@ $(function() {
259 266
         content.append($('<h3>').append(version))
260 267
         cl = $('<div>').addClass('changelog')
261 268
 
  269
+        console.log(version)
  270
+
262 271
         for(var type in changelog[version]) {
263 272
           adds = changelog[version][type]
264 273
           adds.sort()
265 274
           addsection = $('<p>')
266 275
           for(var j in adds) {
267 276
             add = adds[j]
268  
-            gname = docurium.groupOf(add)
269 277
             if(type != 'deletes') {
  278
+              gname = docurium.groupOf(add)
270 279
               addlink = $('<a>').attr('href', '#' + groupLink(gname, add, version)).append(add)
271 280
             } else {
272 281
               addlink = add
@@ -392,9 +401,8 @@ $(function() {
392 401
       return text
393 402
     },
394 403
 
395  
-    groupHash: false,
396 404
     groupOf: function (func) {
397  
-      return this.get('data').functions[func].group
  405
+      return this.get('groups')[func]
398 406
     },
399 407
 
400 408
     addHotlinks: function() {
@@ -488,7 +496,7 @@ $(function() {
488 496
       menu.append(filelist)
489 497
 
490 498
       // Examples List
491  
-      if(data['examples'].length > 0) {
  499
+      if(data['examples'] && (data['examples'].length > 0)) {
492 500
         title = $('<h3><a href="#">Examples</a></h3>').click( this.collapseSection )
493 501
         menu.append(title)
494 502
         filelist = $('<ul>')

0 notes on commit c09363f

Please sign in to comment.
Something went wrong with that request. Please try again.