Use Commit#show instead of Commits#show to view a single commit

Commits#show (plural) is going to be for showing commit history on a
specific path.
This commit is contained in:
Robert Speicher 2012-09-17 10:06:56 -04:00
parent a21abce94f
commit b389247c02
10 changed files with 40 additions and 28 deletions

View file

@ -26,25 +26,25 @@ class CommitsController < ApplicationController
end
end
def show
result = CommitLoad.new(project, current_user, params).execute
# def show
# result = CommitLoad.new(project, current_user, params).execute
@commit = result[:commit]
# @commit = result[:commit]
if @commit
@suppress_diff = result[:suppress_diff]
@note = result[:note]
@line_notes = result[:line_notes]
@notes_count = result[:notes_count]
@comments_allowed = true
else
return git_not_found!
end
# if @commit
# @suppress_diff = result[:suppress_diff]
# @note = result[:note]
# @line_notes = result[:line_notes]
# @notes_count = result[:notes_count]
# @comments_allowed = true
# else
# return git_not_found!
# end
if result[:status] == :huge_commit
render "huge_commit" and return
end
end
# if result[:status] == :huge_commit
# render "huge_commit" and return
# end
# end
def compare
result = Commit.compare(project, params[:from], params[:to])

View file

@ -25,6 +25,10 @@ module StaticModel
id
end
def new_record?
false
end
def persisted?
false
end

View file

@ -1,16 +1,15 @@
%li.commit
.browse_code_link_holder
%p
%strong= link_to "Browse Code »", tree_project_ref_path(@project, commit.id), class: "right"
%strong= link_to "Browse Code »", tree_project_ref_path(@project, commit), class: "right"
%p
= link_to commit.short_id(8), project_commit_path(@project, id: commit.id), class: "commit_short_id"
= link_to commit.short_id(8), project_commit_path(@project, commit), class: "commit_short_id"
%strong.commit-author-name= commit.author_name
%span.dash &ndash;
= image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16
= link_to_gfm truncate(commit.title, length: 50), project_commit_path(@project, id: commit.id), class: "row_title"
= link_to_gfm truncate(commit.title, length: 50), project_commit_path(@project, commit.id), class: "row_title"
%span.committed_ago
= time_ago_in_words(commit.committed_date)
ago
&nbsp;

View file

@ -1,7 +1,7 @@
- commit = CommitDecorator.decorate(commit)
%li.commit
%p
= link_to commit.short_id(8), project_commit_path(project, id: commit.id), class: "commit_short_id"
= link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id"
%span= commit.author_name
&ndash;
= image_tag gravatar_icon(commit.author_email), class: "avatar", width: 16

View file

@ -32,8 +32,8 @@
= commit.author_name
%td.blame_commit
&nbsp;
%code= link_to commit.short_id, project_commit_path(@project, id: commit.id)
= link_to_gfm truncate(commit.title, length: 30), project_commit_path(@project, id: commit.id), class: "row_title" rescue "--broken encoding"
%code= link_to commit.short_id, project_commit_path(@project, commit)
= link_to_gfm truncate(commit.title, length: 30), project_commit_path(@project, commit), class: "row_title" rescue "--broken encoding"
%td.lines
= preserve do
%pre

View file

@ -7,7 +7,7 @@
- if branch.name == @project.root_ref
%span.label default
%td
= link_to project_commit_path(@project, id: commit.id) do
= link_to project_commit_path(@project, commit) do
%code= commit.short_id
= image_tag gravatar_icon(commit.author_email), class: "", width: 16