Issue #149
This commit is contained in:
parent
61e6751ea6
commit
5baa5fad0a
8 changed files with 18 additions and 14 deletions
|
@ -21,13 +21,4 @@ module CommitsHelper
|
||||||
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
|
link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit),
|
||||||
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
|
:remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Cause some errors with trucate & encoding use this method
|
|
||||||
def truncate_commit_message(commit, size = 60)
|
|
||||||
message = commit.message
|
|
||||||
message.length > size ? (message[0..(size - 1)] + "...") : message
|
|
||||||
# if special characters occurs
|
|
||||||
rescue
|
|
||||||
commit.message
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
||||||
%p
|
%p
|
||||||
%strong
|
%strong
|
||||||
= truncate_commit_message(commit)
|
= commit.truncated_message
|
||||||
= link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
|
= link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right"
|
||||||
= link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
|
= link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right"
|
||||||
%span
|
%span
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
%h3
|
%h3
|
||||||
= "[ #{@commit.committer} ] #{truncate_commit_message(@commit, 80)}"
|
= "[ #{@commit.committer} ] #{@commit.truncated_message(40)}"
|
||||||
-#= link_to 'Back', project_commits_path(@project), :class => "button"
|
-#= link_to 'Back', project_commits_path(@project), :class => "button"
|
||||||
%table.round-borders
|
%table.round-borders
|
||||||
%tr
|
%tr
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
= image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;"
|
||||||
%p{:style => "margin-bottom: 3px;"}
|
%p{:style => "margin-bottom: 3px;"}
|
||||||
%strong
|
%strong
|
||||||
= link_to truncate_commit_message(commit, 60), project_commit_path(@project, :id => commit.id)
|
= link_to commit.truncated_message(60), project_commit_path(@project, :id => commit.id)
|
||||||
|
|
||||||
%span
|
%span
|
||||||
%span.author
|
%span.author
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
- css_class = "dash_commit"
|
- css_class = "dash_commit"
|
||||||
- commit = parent
|
- commit = parent
|
||||||
- item_code = commit.author.email
|
- item_code = commit.author.email
|
||||||
- link_item_name = truncate_commit_message(commit, 50)
|
- link_item_name = commit.truncated_message(50)
|
||||||
- link_to_item = project_commit_path(@project, :id => commit.id)
|
- link_to_item = project_commit_path(@project, :id => commit.id)
|
||||||
- else
|
- else
|
||||||
- css_class = "dash_wall"
|
- css_class = "dash_wall"
|
||||||
|
|
|
@ -12,4 +12,4 @@
|
||||||
= time_ago_in_words(content_commit.committed_date)
|
= time_ago_in_words(content_commit.committed_date)
|
||||||
ago
|
ago
|
||||||
%td
|
%td
|
||||||
= link_to truncate_commit_message(content_commit, 40), project_commit_path(@project, content_commit)
|
= link_to content_commit.truncated_message(40), project_commit_path(@project, content_commit)
|
||||||
|
|
|
@ -6,3 +6,7 @@ Grit::Blob.class_eval do
|
||||||
include Utils::FileHelper
|
include Utils::FileHelper
|
||||||
include Utils::Colorize
|
include Utils::Colorize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Grit::Commit.class_eval do
|
||||||
|
include CommitExt
|
||||||
|
end
|
||||||
|
|
9
lib/commit_ext.rb
Normal file
9
lib/commit_ext.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
module CommitExt
|
||||||
|
# Cause of encoding rails truncate raise error
|
||||||
|
# this method is temporary decision
|
||||||
|
def truncated_message(size = 80)
|
||||||
|
message.length > size ? (message[0..(size - 1)] + "...") : message
|
||||||
|
rescue
|
||||||
|
"-- invalid encoding for commit message"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue