Skip to content

Commit

Permalink
Add last modified date
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Palmer committed Oct 6, 2008
1 parent ea24051 commit da8e1a4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions controllers/TreeController.rb
Expand Up @@ -51,10 +51,10 @@ def item_was_selected(notification)
Thread.start do
doc = @main_view.mainFrame.DOMDocument
app = NSApplication.sharedApplication.delegate
branch = app.active_branch
file = item.fullPath.sub(app.repository_location, '')
commit = app.repo.commit(branch.to_s)
blob = commit.tree/file.to_s
branch = app.active_branch.to_s
file = item.fullPath.sub(app.repository_location, '').to_s
commit = app.repo.commit(branch)
blob = commit.tree/file

set_html('title', File.basename(file))
element = doc.getElementById(ELEMENTS[:blame])
Expand All @@ -63,13 +63,13 @@ def item_was_selected(notification)
unless blob.nil?
set_html('hash', blob.id)

render_last_commit_html(app, branch, file)
last_commit_html(app, branch, file)

if IMAGE_MIMES.include?(blob.mime_type)
return display_as_image(blob, item)
end

blame = Grit::Blob.blame(app.repo, commit.id, file.to_s)
blame = Grit::Blob.blame(app.repo, commit.id, file)

blame_list = doc.createElement('ul')
blame_list.setAttribute__('id', ELEMENTS[:list])
Expand All @@ -95,14 +95,14 @@ def item_was_selected(notification)
end
end

private

def render_last_commit_html(branch, file)
last_commit = app.repo.log(branch, file)
puts last_commit
#active_commit.authored_date.to_system_time
def last_commit_html(app, branch, file)
last_commit = app.repo.log(branch, file).last
cdate = last_commit.authored_date.to_system_time
set_html("date", "Last Modified: #{cdate} by #{last_commit.author.name}")
end

private

def display_as_image(blob, outline_item)
doc = @main_view.mainFrame.DOMDocument
img = doc.createElement('img')
Expand Down

0 comments on commit da8e1a4

Please sign in to comment.