Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added more styling and also fixed bug with code_file

  • Loading branch information...
commit 712ae18583851447404486cc8b9c23abae00a5fe 1 parent 8e0e131
Ian Ownbey authored
View
1  app/models/code_comment.rb
@@ -122,6 +122,7 @@ def good_version_before(n)
# Takes two versions, and exports the second one.
def export v1, v2
Dir.chdir(RAILS_ROOT + "/code")
+ p self.owner.code_file.full_name
@file = File.new(self.owner.code_file.full_name, 'r+')
if v1.nil? && owner.is_a?(CodeFile)
# v1 is nil and owner is a file, just throw it at start at file
View
2  app/models/code_container.rb
@@ -8,7 +8,7 @@ class CodeContainer < ActiveRecord::Base
has_many :code_containers
belongs_to :code_container
has_one :code_comment, :as => :owner, :dependent => :destroy
- has_one :code_file
+ belongs_to :code_file
has_many :in_files
has_many :code_files, :through => :in_files
View
11 app/views/documentation/_show_comment.html.erb
@@ -0,0 +1,11 @@
+<% if object.code_comment -%>
+ <div class="comment">
+ <%= rdoc_html_parse(object.code_comment.body) %>
+ <div class="meta">Last updated by <%= object.code_comment.user.name rescue "Admin"%> at <%= object.code_comment.created_at.to_s(:short) %> <%= link_to "edit", edit_comment_path(object.code_comment.id)%>
+ </div>
+ </div>
+<% else -%>
+ <div class="comment">
+ No comment yet. <%= link_to "Add One!", new_comment_path(object.path)%>
+ </div>
+<% end -%>
View
11 app/views/documentation/_show_method.html.erb
@@ -1,11 +0,0 @@
-<% if method.code_comment -%>
- <div class="comment">
- <%= rdoc_html_parse(method.code_comment.body) %>
- <div class="meta">Last updated by <%= method.code_comment.user.name rescue "Admin"%> at <%= method.code_comment.created_at.to_s(:short) %> <%= link_to "edit", edit_comment_path(method.code_comment.id)%>
- </div>
- </div>
-<% else -%>
- <div class="comment">
- No comment yet. <%= link_to "Add One!", new_comment_path(method.path)%>
- </div>
-<% end -%>
View
3  app/views/documentation/show.html.erb
@@ -13,8 +13,7 @@
</div>
<div id="documentation">
- <%= rdoc_html_parse(@requested_object.code_comment.try(:body)) %>
-
+ <%= render :partial => 'show_comment', :locals => {:object => @requested_object}%>
<% unless @constants.empty? %>
<div class="section-head">Constants</div>
<div id="constants">
View
2  app/views/documentation/show_method.html.erb
@@ -6,4 +6,4 @@
</h1>
<p><%= @requested_object.code_container.full_name %></p>
</div>
-<%= render :partial => "show_method", :locals => {:method => @requested_object} %>
+<%= render :partial => "show_comment", :locals => {:object => @requested_object} %>
View
2  db/migrate/20080504001717_create_code_comments.rb
@@ -2,7 +2,7 @@ class CreateCodeComments < ActiveRecord::Migration
def self.up
create_table :code_comments do |t|
t.text :body, :raw_body
- t.integer :owner_id, :user_id
+ t.integer :owner_id, :user_id, :code_file_id
t.string :owner_type
t.boolean :exported, :uses_begin, :default => false
t.boolean :skip, :default => false
View
2  lib/core_ext.rb
@@ -10,7 +10,7 @@ def wrap(width, hanging_indent = 0, magic_lists = false, skip_tabs = true)
lines = self.split(/\n/)
lines.collect! do |line|
- if line =~ /^(.*).$/
+ if line =~ /^(.*)\.$/
if line =~ /^\s+/ && skip_tabs
line
else
View
2  lib/parsing.rb
@@ -174,7 +174,7 @@ def process_type_or_module(obj, parent)
when :classes
CodeClass.create_or_update_by_full_name_and_code_container_id(:code_file_id => CodeFile.find_by_full_name(obj.file).try(:id), :code_container_id => parent.id, :name => obj.name, :full_name => obj.full_name, :superclass => obj.superclass, :line_code => obj.line)
end
- comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class unless obj.comment.blank?
+ comment = CodeComment.create_or_update_by_owner_id_and_owner_type :exported_body => obj.comment, :owner_id => p.id, :owner_type => p.class, :code_file_id => CodeFile.find_by_full_name(obj.file).try(:id) unless obj.comment.blank?
@containers << p.id
@comments << comment.id if comment
@current_container = p
View
9 lib/rdoc/parse_rb.rb
@@ -412,11 +412,14 @@ def parse_class(container, single, tk, comment, &block)
end
cls = container.add_class(cls_type, name, superclass)
- cls.file, cls.line = @top_level.file_absolute_name, @scanner.reader.content.split("\n")[tk.line_no - 1]
+
read_documentation_modifiers(cls, CLASS_MODIFIERS)
cls.record_location(@top_level)
parse_statements(cls)
cls.comment = comment
+ unless comment.empty?
+ cls.file, cls.line = @top_level.file_absolute_name, @scanner.reader.content.split("\n")[tk.line_no - 1]
+ end
when TkLSHFT
case name = get_class_specification
@@ -446,11 +449,13 @@ def parse_module(container, single, tk, comment)
# skip_tkspace
name = name_t.name
mod = container.add_module(NormalModule, name)
- mod.file, mod.line = @top_level.file_absolute_name, @scanner.reader.content.split("\n")[tk.line_no - 1]
mod.record_location(@top_level)
read_documentation_modifiers(mod, CLASS_MODIFIERS)
parse_statements(mod)
mod.comment = comment
+ unless comment.empty?
+ mod.file, mod.line = @top_level.file_absolute_name, @scanner.reader.content.split("\n")[tk.line_no - 1]
+ end
end
# Look for the name of a class of module (optionally with a leading :: or
Please sign in to comment.
Something went wrong with that request. Please try again.