GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: YAML RDoc Generator and Rails Website for RDoc
Homepage: http://rannotate.rubyforge.org/
Clone URL: git://github.com/conorh/rannotate.git
notes have versions and after adding they expand the section they added to


git-svn-id: 
file:///Users/conorhunt/Code/Rails/svndavrepo/rannotate/branches/no_frames
@64 016420e5-f504-0410-9c4b-e4e4ac7be119
conor (author)
Sun May 14 21:22:16 -0700 2006
commit  281c7cf74c606b0e6a0669a9003e4c3082957ca3
tree    0e71ad5dad782f6f916ae92c40134980dd2ff958
parent  8c399664a5e8ef0c8c75f45dccc60049f6a31cbd
...
38
39
40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
0
@@ -38,3 +38,20 @@ Step 7: Go to the Upload Documentation section and select the appname-0.2.3.out
0
 
0
 Step 8: Open up the URL of the documentation http://server:3000/ and there it is!
0
 
0
+== Generating documentation for rails ==
0
+
0
+Step 1: Install the version of rails you need (if it is not already installed)
0
+gem install --include-dependencies --version "1.0.0" rails
0
+
0
+Step 2: Freeze the gems for the version of rails you are documenting ex:
0
+rake environment VERSION=1.0.0 freeze_gems
0
+
0
+Step 3: Making sure the yaml_generator is installed (see above) run this rake command
0
+rake ranapi
0
+
0
+Step 4: Check the /doc directory for the output file
0
+
0
+== Troubleshooting ==
0
+
0
+For some reason under rails 1.0 there are issues with importing the documentation using YAML. Please
0
+use later versions of rails.
...
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
34
35
 
 
36
37
38
...
15
16
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
 
 
34
35
36
37
38
0
@@ -15,24 +15,24 @@ task "ranapi" do
0
   params << "--fmt=yaml"
0
   params << "--opname=rails-1.0.0"
0
   dirs = []
0
- dirs << 'vendor/rails/railties/README'
0
- dirs << 'vendor/rails/railties/CHANGELOG'
0
- dirs << 'vendor/rails/railties/MIT-LICENSE'
0
- dirs << 'vendor/rails/activerecord/README'
0
- dirs << 'vendor/rails/activerecord/CHANGELOG'
0
- dirs << 'vendor/rails/activerecord/lib/'
0
- dirs << 'vendor/rails/actionpack/README'
0
- dirs << 'vendor/rails/actionpack/CHANGELOG'
0
- dirs << 'vendor/rails/actionpack/lib/'
0
- dirs << 'vendor/rails/actionmailer/README'
0
- dirs << 'vendor/rails/actionmailer/CHANGELOG'
0
- dirs << 'vendor/rails/actionmailer/lib/'
0
- dirs << 'vendor/rails/actionwebservice/README'
0
- dirs << 'vendor/rails/actionwebservice/CHANGELOG'
0
- dirs << 'vendor/rails/actionwebservice/lib/'
0
+ dirs << 'vendor/railsd/railties/README'
0
+ dirs << 'vendor/railsd/railties/CHANGELOG'
0
+ dirs << 'vendor/railsd/railties/MIT-LICENSE'
0
+ dirs << 'vendor/railsd/activerecord/README'
0
+ dirs << 'vendor/railsd/activerecord/CHANGELOG'
0
+ dirs << 'vendor/railsd/activerecord/lib/'
0
+ dirs << 'vendor/railsd/actionpack/README'
0
+ dirs << 'vendor/railsd/actionpack/CHANGELOG'
0
+ dirs << 'vendor/railsd/actionpack/lib/'
0
+ dirs << 'vendor/railsd/actionmailer/README'
0
+ dirs << 'vendor/railsd/actionmailer/CHANGELOG'
0
+ dirs << 'vendor/railsd/actionmailer/lib/'
0
+ dirs << 'vendor/railsd/actionwebservice/README'
0
+ dirs << 'vendor/railsd/actionwebservice/CHANGELOG'
0
+ dirs << 'vendor/railsd/actionwebservice/lib/'
0
 # dirs << 'vendor/rails/activesupport/README'
0
- dirs << 'vendor/rails/activesupport/CHANGELOG'
0
- dirs << 'vendor/rails/activesupport/lib/'
0
+ dirs << 'vendor/railsd/activesupport/CHANGELOG'
0
+ dirs << 'vendor/railsd/activesupport/lib/'
0
   
0
   RDoc::RDoc.new.document(params + dirs)
0
 end
...
61
62
63
64
 
65
66
67
...
120
121
122
123
124
125
 
126
127
128
...
151
152
153
154
 
155
156
157
...
164
165
166
167
 
168
169
170
 
171
172
173
...
223
224
225
226
 
227
228
 
229
230
231
...
61
62
63
 
64
65
66
67
...
120
121
122
 
123
124
125
126
127
128
...
151
152
153
 
154
155
156
157
...
164
165
166
 
167
168
169
 
170
171
172
173
...
223
224
225
 
226
227
 
228
229
230
231
0
@@ -61,7 +61,7 @@ class DocController < ApplicationController
0
   
0
   # Used by AJAX to display inline notes
0
   def notes
0
- render_notes(params[:category], params[:name], params[:content_url])
0
+ render_notes(params[:container_name], params[:note_group])
0
   end
0
   
0
   # Used by AJAX to display inline source code
0
@@ -120,9 +120,9 @@ class DocController < ApplicationController
0
   
0
   # Get a container (file,class, module) and everything necessary to display it's documentation
0
   def get_container(cont_type)
0
- logger.level = Logger::DEBUG
0
     @container_name = @params[:name]
0
     @version = @params[:version] # this can be nil if the most recent version is requested
0
+ @expand = @params[:expand]
0
     @ra_container = RaContainer.find_highest_version(@container_name, cont_type, @version)
0
     unless(@ra_container)
0
       @error = "Could not find: " + @container_name
0
@@ -151,7 +151,7 @@ class DocController < ApplicationController
0
     
0
     # Divide up the code objects into the various types
0
     @ra_code_objects = {}
0
- results.each do |obj|
0
+ results.each do |obj|
0
       unless @ra_code_objects.has_key?(obj.class) then @ra_code_objects[obj.class] = [] end
0
       @ra_code_objects[obj.class].push(obj)
0
     end
0
@@ -164,10 +164,10 @@ class DocController < ApplicationController
0
     
0
     # Get a list of counts of the different categories of notes for this container
0
     # TODO: make this more active recordish
0
- results = Note.connection.select_all("SELECT category, count(name) AS count FROM notes WHERE name = '" + @container_name + "' GROUP BY category");
0
+ results = Note.connection.select_all("SELECT note_group, count(container_name) AS count FROM notes WHERE container_name = '" + @container_name + "' GROUP BY note_group");
0
     @note_count = {}
0
     for result in results
0
- @note_count[result['category']] = result['count']
0
+ @note_count[result['note_group']] = result['count']
0
     end
0
 
0
     @container_type = @ra_container.class.type_string
0
@@ -223,9 +223,9 @@ class DocController < ApplicationController
0
   end
0
   
0
   # Render the notes inline
0
- def render_notes(container_type, container_name, current_url)
0
+ def render_notes(container_name, note_group)
0
     render_component(:controller => 'notes', :action => 'list',
0
- :params=> {:no_layout => true, :category=>container_type, :name=>container_name, :return_url=>current_url }
0
+ :params=> {:no_layout => true, :container_name=>container_name, :note_group=>note_group }
0
     )
0
   end
0
   
...
3
4
5
6
7
8
 
 
9
10
 
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
28
29
30
31
32
33
34
 
35
36
37
 
38
39
40
 
41
42
 
43
44
45
46
47
48
49
 
 
 
50
51
52
53
 
 
 
 
 
 
54
55
56
...
60
61
62
 
63
64
 
 
 
65
66
67
68
69
70
71
 
 
 
 
72
73
74
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
77
78
...
3
4
5
 
 
 
6
7
8
 
9
10
11
12
13
 
 
 
 
 
 
 
 
 
 
 
 
 
14
15
16
 
 
 
 
 
17
18
19
20
21
22
23
 
24
25
26
27
28
 
 
 
 
 
 
29
30
31
32
 
 
 
33
34
35
36
37
38
39
40
41
...
45
46
47
48
49
 
50
51
52
53
54
55
 
 
 
 
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
0
@@ -3,54 +3,39 @@ class NotesController < ApplicationController
0
   
0
   # Display a list of notes
0
   def list
0
- @category = params[:category]
0
- @name = params[:name]
0
- @content_url = params[:return_url]
0
+ @container_name = params[:container_name]
0
+ @note_group = params[:note_group]
0
     
0
- @notes = Note.find(:all, :conditions => ["category = ? AND name = ?", @category, @name], :order=> "created_at ASC")
0
+ @notes = Note.find(:all, :conditions => ["container_name = ? AND note_group = ?", @container_name, @note_group], :order=> "created_at ASC")
0
     
0
     if(params[:no_layout])
0
       render :layout=>false
0
     end
0
- end
0
-
0
- # Show all immediate children of this note. This only works for classes right now. Because...
0
- # A note is the immediate child of another note if the parent has the format 'somename' and the child the format 'somename.blah'
0
- # currently only methods have this format
0
- def overview
0
- @category = params[:category]
0
- @name = params[:name]
0
- @content_url = params[:return_url]
0
-
0
- searchName = @name + Note::METHOD_SEPARATOR + '%';
0
- @notes = Note.find_by_sql(["SELECT DISTINCT name FROM notes WHERE category = ? AND name LIKE ?", @category, searchName])
0
- end
0
+ end
0
   
0
   # Display a list of notes for the entire site.. up to 30
0
- def list_new
0
- @category = params[:category]
0
- @name = params[:name]
0
- @content_url = params[:return_url]
0
-
0
+ def list_new
0
     @notes = Note.find(:all, :limit => 20, :order=> "created_at DESC")            
0
   end
0
   
0
+ # Generate an RSS feed of the 20 newest notes
0
   def rss
0
     @notes = Note.find(:all, :limit => 20, :order=> "created_at DESC")
0
- render :layout => false
0
+ render :layout => false
0
   end
0
   
0
+ # Create a note
0
   def new
0
- @note = Note.new
0
- params[:id]
0
- params[:type]
0
- @note.category = ""
0
- @note.name = ""
0
- @note.content_url = ""
0
+ @note = Note.new(get_note_params(params[:id], params[:type]))
0
+ @note.ref_id = params[:id]
0
+ @note.ref_type = params[:type]
0
   end
0
-
0
- def preview
0
- @note = Note.new(params[:note])
0
+
0
+ # Preview a note
0
+ def preview
0
+ note_params = get_note_params(params[:note][:ref_id], params[:note][:ref_type])
0
+
0
+ @note = Note.new(note_params.merge(params[:note]))
0
     @note.created_at = Time.now
0
     @note.skip_ban_validation = true
0
     @note.valid?
0
@@ -60,18 +45,63 @@ class NotesController < ApplicationController
0
   end
0
   end
0
 
0
+ # Save the note to the DB
0
   def create
0
- @note = Note.new(params[:note])
0
+ note_params = get_note_params(params[:note][:ref_id], params[:note][:ref_type])
0
+
0
+ @note = Note.new(note_params.merge(params[:note]))
0
     @note.ip_address = request.remote_ip;
0
     if !@note.save
0
       render :action => 'preview'
0
- else
0
- expire_page(:controller => "doc", :action => 'files', :name => @note.name)
0
- expire_page(:controller => "doc", :action => 'modules', :name => @note.name)
0
- expire_page(:controller => "doc", :action => 'classes', :name => @note.name)
0
+ else
0
+ expire_page(:controller => "doc", :action => 'files', :name => @note.container_name)
0
+ expire_page(:controller => "doc", :action => 'modules', :name => @note.container_name)
0
+ expire_page(:controller => "doc", :action => 'classes', :name => @note.container_name)
0
       expire_page :action => "list"
0
       render :action => 'success'
0
     end
0
   end
0
+
0
+private
0
+
0
+ # Given the id and type of the object that this note is being attached to
0
+ # get the necessary information to create the note
0
+ def get_note_params(id, type_string)
0
+ case type_string
0
+ when RaModule.to_s then return get_container_params(id, type_string)
0
+ when RaClass.to_s then return get_container_params(id, type_string)
0
+ when RaFile.to_s then return get_container_params(id, type_string)
0
+ when RaMethod.to_s then return get_method_params(id, type_string)
0
+ when RaInFile.to_s then return get_codeobj_params(id, type_string)
0
+ when RaAttribute.to_s then return get_codeobj_params(id, type_string)
0
+ when RaConstant.to_s then return get_codeobj_params(id, type_string)
0
+ when RaInclude.to_s then return get_codeobj_params(id, type_string)
0
+ when RaRequire.to_s then return get_codeobj_params(id, type_string)
0
+ when RaAlias.to_s then return get_codeobj_params(id, type_string)
0
+ end
0
+
0
+ return {}
0
+ end
0
+
0
+ def get_container_params(id, type_string)
0
+ type = RaContainer.find(id)
0
+ return {:container_name => type.full_name, :ra_container_id => type.id,
0
+ :note_group => type_string, :note_type => type_string,
0
+ :version => type.ra_library.ver_string }
0
+ end
0
+
0
+ def get_method_params(id, type_string)
0
+ type = RaMethod.find(id)
0
+ return {:container_name => type.ra_container.full_name, :ra_container_id => type.ra_container.id,
0
+ :note_group => type.name, :note_type => type_string,
0
+ :version => type.ra_container.ra_library.ver_string }
0
+ end
0
+
0
+ def get_codeobj_params(id, type_string)
0
+ type = RaContainer.find(id)
0
+ return {:container_name => type.full_name, :ra_container_id => id,
0
+ :note_group => type_string, :note_type => type_string,
0
+ :version => type.ra_library.ver_string}
0
+ end
0
   
0
 end
0
\ No newline at end of file
...
8
9
10
11
 
12
13
14
 
 
15
16
17
...
29
30
31
 
32
33
34
35
36
37
 
38
39
40
 
 
41
42
43
44
 
45
46
47
48
49
 
 
50
51
52
 
53
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
56
57
 
58
59
60
61
 
 
 
62
63
64
65
 
66
67
 
68
69
70
...
8
9
10
 
11
12
 
 
13
14
15
16
17
...
29
30
31
32
33
34
35
36
37
 
38
39
 
 
40
41
42
43
44
 
45
46
47
48
 
 
49
50
51
52
 
53
54
 
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
 
79
80
81
 
 
82
83
84
85
86
87
 
88
89
 
90
91
92
93
0
@@ -8,10 +8,10 @@ module DocHelper
0
       note_count[category] ? note_count[category] : 0
0
     end
0
 
0
- # markup the source code using the syntax helper
0
+ # markup the source code using the syntax helper
0
     def markup_source_code(code)
0
- syntax = Syntax::Convertors::HTML.for_syntax "ruby"
0
- return syntax.convert(code)
0
+ syntax = Syntax::Convertors::HTML.for_syntax "ruby"
0
+ return syntax.convert(code)
0
     end
0
 
0
   # show a link to display the source code for a method
0
@@ -29,42 +29,65 @@ module DocHelper
0
      return html
0
     end
0
 
0
+ # Write out javascript to show or hide a section
0
     def show_or_hide(section)
0
       return "Element.visible('#{section}') ? Element.hide('#{section}') : Element.show('#{section}')"
0
     end
0
 
0
   # show the number of notes in a category for a container and show a link to display the notes
0
- def show_notes_link(category)
0
+ def show_notes_link(container_name, note_group, ref_id = nil, ref_type = nil)
0
       # in the doc_controller we count up the notes, so output them here
0
- if(@note_count[category])
0
- count = @note_count[category].to_i
0
+ if(@note_count[note_group])
0
+ count = @note_count[note_group].to_i
0
         
0
         # construct a javascript function that either hides the notes div if it's showing already,
0
         # or gets the notes via an Ajax call and shows it
0
- element = "notes_" + category
0
+ element = "notes_" + note_group
0
         element_add = element + "_add"
0
         function = "Element.visible('#{element}') ? Element.hide('#{element}') : " +
0
                   remote_function(
0
- :update => 'notes_' + category,
0
- :url => { :action => 'notes', :name=>@container_name, :category=>category, :content_url=> @container_url },
0
+ :update => 'notes_' + note_group,
0
+ :url => { :action => 'notes', :container_name=>container_name, :note_group=>note_group },
0
                     :complete => "Element.show('#{element}'); Element.show('#{element_add}');")
0
       
0
- html = "<b>" + link_to_function(pluralize(count, "note"), function) + "</b>"
0
+ html = "<b>" + link_to_function(pluralize(count, "note"), function) + "</b>"
0
       else
0
- html = get_add_note_link(category)
0
+ if(ref_id == nil)
0
+ html = get_add_note_link(@ra_container.id, note_group)
0
+ else
0
+ html = get_add_note_link(ref_id, ref_type)
0
+ end
0
+ end
0
+
0
+ return html
0
+ end
0
+
0
+ # Check to see if we should be displaying a set of notes on load of the page
0
+ def check_display(name)
0
+ if(@expand == name)
0
+ return "";
0
+ else
0
+ return "display: none;"
0
+ end
0
+ end
0
+
0
+ # Display the notes on load of the page if ncessary
0
+ def check_show_notes(name, note_group, container_name)
0
+ if(@expand == name)
0
+ return render_notes(container_name, note_group)
0
       end
0
-
0
- return html
0
+ return ""
0
     end
0
     
0
- def get_add_note_link(category)
0
- return link_to('Add New Note', {:controller => 'notes', :action => 'new', :category => category, :name => @container_name, :content_url => @container_url})
0
+ # Get a link to add notes
0
+ def get_add_note_link(id, type)
0
+ return link_to('Add New Note', {:controller => 'notes', :action => 'new', :type=>type, :id=>id })
0
     end
0
 
0
   # render the notes for the class
0
- def render_notes(container_type, container_name, current_url)
0
+ def render_notes(container_name, note_group)
0
       render_component(:controller => 'notes', :action=>'list',
0
- :params=> {:no_layout => true, :category=>container_type, :name=>container_name, :return_url=>current_url }
0
+ :params=> {:no_layout => true, :container_name=>container_name, :note_group=>note_group }
0
       )     
0
     end
0
 
...
20
21
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24
25
...
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
0
@@ -20,6 +20,25 @@ module NotesHelper
0
     return h(newEmail)
0
   end
0
   
0
+ def get_return_url(note)
0
+ container = RaContainer.type_to_route(note.ra_container.type.to_s)
0
+
0
+ case note.note_type
0
+ when RaModule.to_s then return url_for(:controller => 'doc', :action => "modules", :name => note.container_name, :anchor => 'usernotes')
0
+ when RaClass.to_s then return url_for(:controller => 'doc', :action => "classes", :name => note.container_name, :anchor => 'usernotes')
0
+ when RaFile.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'usernotes')
0
+ when RaMethod.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => note.note_group, :expand => note.note_group)
0
+ when RaInFile.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'infiles', :expand => 'infiles')
0
+ when RaAttribute.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'attributes', :expand => 'attributes')
0
+ when RaConstant.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'constants', :expand => 'constants')
0
+ when RaInclude.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'includes', :expand => 'includes')
0
+ when RaRequire.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'requires', :expand => 'requires')
0
+ when RaAlias.to_s then return url_for(:controller => 'doc', :action => container, :name => note.container_name, :anchor => 'aliases', :expand => 'aliases')
0
+ end
0
+
0
+ return url_for(:controller => 'doc', :action => "index")
0
+ end
0
+
0
   # Syntax highlight the input
0
   # Transform line breaks into HTML
0
   # If summary input parameter is set then limit text to 40 characters and replace newlines with spaces
...
1
 
 
2
3
4
5
6
7
8
 
9
10
11
12
13
 
 
14
15
16
...
28
29
30
31
32
33
34
35
 
 
 
 
 
36
37
38
...
82
83
84
85
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
87
88
...
92
93
94
95
 
96
97
98
...
 
1
2
3
 
 
 
4
5
6
7
8
9
10
 
 
11
12
13
14
15
...
27
28
29
 
 
 
 
 
30
31
32
33
34
35
36
37
...
81
82
83
 
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
108
109
110
 
111
112
113
114
0
@@ -1,16 +1,15 @@
0
-class Note < ActiveRecord::Base
0
+class Note < ActiveRecord::Base
0
+ belongs_to :ra_container
0
   
0
- # This character is used after a class name to separate the method name. (ex. SomeClass::Child.method)
0
- METHOD_SEPARATOR = '.'
0
-
0
   # This attribute is used to store the URL of the documentation this note refers to
0
   # this is not stored in the DB as it can change depending on the URL that the documentation is accessed from
0
   attr_accessor :content_url, :skip_ban_validation
0
+ attr_accessor :ref_id, :ref_type
0
   
0
   validates_length_of :email, :in => 5..40
0
   validates_length_of :text, :in => 10..1000
0
- validates_presence_of :name
0
- validates_presence_of :category
0
+ validates_presence_of :container_name
0
+ validates_presence_of :note_group
0
 
0
   def initialize(params = nil)
0
     super(params)
0
@@ -28,11 +27,11 @@ class Note < ActiveRecord::Base
0
         errors.add_to_base("Your IP subnet has been banned from posting due to abuse. Please contact the system administrator for more information")
0
       end      
0
   
0
- timeLimit = 1.minute.ago
0
- count = Note.count(["created_at > ? AND ip_address = ?", timeLimit, ip_address])
0
- if(count > 0)
0
- errors.add_to_base("Your IP address has already posted in the last minute, please wait a minute or so before posting again.")
0
- end
0
+ # timeLimit = 1.minute.ago
0
+ # found = Note.find(:first, :conditions => ["created_at > ? AND ip_address = ?", timeLimit, ip_address])
0
+ # if(found != nil)
0
+ # errors.add_to_base("Your IP address has already posted in the last minute, please wait a minute or so before posting again.")
0
+ # end
0
     end
0
     
0
     if(!errors.empty?)
0
@@ -82,7 +81,24 @@ class Note < ActiveRecord::Base
0
                                 
0
   end  
0
 
0
- protected
0
+ def get_display
0
+ case self.note_type
0
+ when RaModule.to_s then return container_name
0
+ when RaClass.to_s then return container_name
0
+ when RaFile.to_s then return container_name
0
+ when RaMethod.to_s then return "Method " + note_group + " of " + container_name
0
+ when RaInFile.to_s then return "InFiles section of " + container_name
0
+ when RaAttribute.to_s then return "Attributes section of " + container_name
0
+ when RaConstant.to_s then return "Constants section of " + container_name
0
+ when RaInclude.to_s then return "Includes section of " + container_name
0
+ when RaRequire.to_s then return "Requires section of " + container_name
0
+ when RaAlias.to_s then return "Aliases sectionof " + container_name
0
+ end
0
+
0
+ return container_name + " - " + note_group
0
+ end
0
+
0
+protected
0
 
0
   # Create a SQL datetime from the select_datetime form helper fields
0
   def Note.create_datetime(values)
0
@@ -92,7 +108,7 @@ class Note < ActiveRecord::Base
0
   
0
     date = values[:year] + '-' + values[:month] + '-' + values[:day] + ' ' + values[:hour] + ':' + values[:minute]
0
     return date
0
- end
0
+ end
0
 
0
 end
0
 
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 class RaInFile < ActiveRecord::Base
0
 
0
+ belongs_to :ra_container
0
+
0
   def RaInFile.type_string
0
     return 'infile'
0
   end
...
7
8
9
10
 
 
 
 
11
12
 
13
14
15
...
26
27
28
29
 
30
31
32
33
 
34
35
36
...
7
8
9
 
10
11
12
13
14
 
15
16
17
18
...
29
30
31
 
32
33
34
35
 
36
37
38
39
0
@@ -7,9 +7,12 @@
0
       <%= render :partial => 'doc/partials/container_sidebar' %>
0
     </TD>
0
     <TD class="container_body_td">
0
- <span class="container_header"><%= @ra_container.class.type_string.capitalize %> <%= @container_name %></span> <% if(@version) then %>Version <%= @version %><% end %>
0
+ <a href="<%= @container_url %>" style="text-decoration: none;">
0
+ <span class="container_header">
0
+ <%= @ra_container.class.type_string.capitalize %> <%= @container_name %></span></a>
0
+ <% if(@version) then %>Version <%= @version %><% end %>
0
     <br/>
0
- [ <a href="#notes"><%= pluralize(get_count(@note_count, @container_type), "Note") %></a> ]
0
+ [ <a href="#notes"><%= pluralize(get_count(@note_count, @ra_container.class.to_s), "Note") %></a> ]
0
     [ <%= link_to 'History', {:action => 'history', :name => @container_name, :type => @ra_container.class.to_s } %> ]
0
 
0
 <% if(@ra_container.ra_comment.comment.length > 0) %>
0
@@ -26,11 +29,11 @@
0
 <p>
0
 <a name="notes"></a>
0
 <div class="section_title">
0
-<span class="note_link"> <%= link_to('Add New Note', {:controller => 'notes', :action => 'new', :category => @container_type, :name => @container_name, :content_url => @container_url}) %></span>
0
+<span class="note_link"><%= get_add_note_link(@ra_container, @ra_container.class.to_s) %></span>
0
 <div onClick="<%= show_or_hide("usernotes") %>">User Added Notes</div>
0
     </div>
0
     <div id="usernotes">
0
- <%= render_notes(@container_type, @container_name, @container_url) %>
0
+ <%= render_notes(@container_name, @ra_container.class.to_s) %>
0
   </div>
0
    </td>
0
   </tr>
...
20
21
22
23
 
 
 
24
25
26
 
27
28
29
30
...
20
21
22
 
23
24
25
26
27
 
28
29
30
31
32
0
@@ -20,10 +20,12 @@ For more information on rannotate see <a href="http://rannotate.rubyforge.org">R
0
 <a name="notes"></a>
0
 <div style="font-size: 80%">
0
 <div class="section_title">
0
-<span class="note_link"> <%= link_to('Add New Note', {:controller => 'notes', :action => 'new', :category => 'index', :name => 'index', :content_url => url_for(:action => 'index') }) %></span>
0
+<span class="note_link">
0
+<%= link_to('Add New Note', {:controller => 'notes', :action => 'new', :type => 'index', :id => 0}) %>
0
+</span>
0
 User Added Notes
0
     </div>
0
-<%= render_notes "index", "index", url_for(:action => 'index') %>
0
+<%= render_notes("index", "index") %>
0
 </div>
0
 </td></tr>
0
 </table>
0
\ No newline at end of file
...
1
2
 
 
 
 
 
 
3
4
 
5
6
 
7
8
9
...
12
13
14
15
 
 
 
 
 
16
17
...
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
...
19
20
21
 
22
23
24
25
26
27
28
0
@@ -1,9 +1,16 @@
0
 <div class="section_title">
0
-<span class="note_link"><%= show_notes_link('attributes') %></span>
0
+
0
+<div class="note_link">
0
+<%= show_notes_link(@ra_container.full_name, "RaAttribute") %>
0
+<span id="notes_RaAttribute_add" style="<%= check_display("attributes") %>">&nbsp;<%= get_add_note_link(@ra_container.id, "RaAttribute") %>&nbsp;</span>
0
+</div>
0
+
0
 <div onClick="<%= show_or_hide("attributes") %>">Attributes</div>
0
 </div>
0
+
0
 <div id="attributes">
0
 <table border='0' cellpadding='5'>
0
+<a name="attributes"></a>
0
   <% for attribute in @ra_code_objects[RaAttribute] %>
0
   <tr valign='top'>
0
     <td class='attr-rw'>[<%= attribute.read_write %>]</td>
0
@@ -12,5 +19,9 @@
0
   </tr>
0
     <% end %>
0
 </table>
0
-<div id="notes_attributes" style="display:none; margin-top: 5px;"></div>
0
+
0
+<div id="notes_RaAttribute" style="<%= check_display("attributes") %> margin-top: 5px;">
0
+<%= check_show_notes("attributes", "RaAttribute", @ra_container.full_name) %>
0
+</div>
0
+
0
 </div>
0
\ No newline at end of file
...
1
2
3
 
 
 
 
4
5
 
 
 
 
 
 
6
7
8
9
 
 
 
 
 
10
11
...
1
 
 
2
3
4
5
6
 
7
8
9
10
11
12
13
14
15
 
16
17
18
19
20
21
22
0
@@ -1,10 +1,21 @@
0
 <div class="section_title">
0
-<span class="note_link"><%= show_notes_link('children') %></span>
0
-<div onClick="<%= show_or_hide("childcm") %>">Child Classes and Modules</div>
0
+
0
+<div class="note_link">
0
+<%= show_notes_link(@ra_container.full_name, "RaChildren") %>
0
+<span id="notes_RaChildren_add" style="<%= check_display("children") %>">&nbsp;<%= get_add_note_link(@ra_container.id, "RaChildren") %>&nbsp;</span>
0
 </div>
0
-<div id="childcm">
0
+
0
+<div onClick="<%= show_or_hide("children") %>">Child Classes and Modules</div>
0
+</div>
0
+
0
+<div id="children">
0
+<a name="children"></a>
0
 <% for child in @ra_children %>
0
 <%= child.class.type_string.capitalize %> <%= link_to_container(child) %><br/>
0
 <% end %>
0
-<div id="notes_children" style="display:none; margin-top: 5px;"></div>
0
+
0
+<div id="notes_RaChildren" style="<%= check_display("children") %> margin-top: 5px;">
0
+<%= check_show_notes("children", "RaChildren", @ra_container.full_name) %>
0
+</div>
0
+
0
 </div>
0
\ No newline at end of file