Commit bcf55312f7e59704b57f2cc4ef7893f55ffab770
1 parent
9265de3d
Exists in
master
and in
4 other branches
fixed #132
Showing
4 changed files
with
10 additions
and
3 deletions
Show diff stats
app/helpers/commits_helper.rb
@@ -21,4 +21,11 @@ module CommitsHelper | @@ -21,4 +21,11 @@ module CommitsHelper | ||
21 | link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit), | 21 | link_to "More", project_commits_path(@project, :offset => offset.to_i + limit.to_i, :limit => limit), |
22 | :remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link" | 22 | :remote => true, :class => "lite_button vm", :style => "text-align:center; width:930px; ", :id => "more-commits-link" |
23 | end | 23 | end |
24 | + | ||
25 | + def truncate_commit_message(commit, size = 60) | ||
26 | + truncate(commit.message, :length => size) | ||
27 | + # if special characters occurs | ||
28 | + rescue | ||
29 | + commit.message.length > size ? (commit.message[0..(size - 1)] + "...") : commit.message | ||
30 | + end | ||
24 | end | 31 | end |
app/views/commits/_commits.html.haml
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" | 11 | = image_tag "no_avatar.png", :class => "left", :width => 40, :style => "padding-right:5px;" |
12 | %p | 12 | %p |
13 | %strong | 13 | %strong |
14 | - = commit.message.length > 60 ? (commit.message[0..59] + "...") : commit.message | 14 | + = truncate_commit_message(commit) |
15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" | 15 | = link_to "Browse Code", tree_project_path(@project, :commit_id => commit.id), :class => "lite_button", :style => "float:right" |
16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" | 16 | = link_to truncate(commit.id.to_s, :length => 16), project_commit_path(@project, :id => commit.id), :class => "lite_button", :style => "width:120px;float:right" |
17 | %span | 17 | %span |
app/views/commits/show.html.haml
1 | %h3 | 1 | %h3 |
2 | - = "[ #{@commit.committer} ] #{truncate @commit.message, :length => 80}" | 2 | + = "[ #{@commit.committer} ] #{truncate_commit_message(@commit, 80)}" |
3 | -#= link_to 'Back', project_commits_path(@project), :class => "button" | 3 | -#= link_to 'Back', project_commits_path(@project), :class => "button" |
4 | %table.round-borders | 4 | %table.round-borders |
5 | %tr | 5 | %tr |
app/views/projects/_tree_item.html.haml
@@ -12,4 +12,4 @@ | @@ -12,4 +12,4 @@ | ||
12 | = time_ago_in_words(content_commit.committed_date) | 12 | = time_ago_in_words(content_commit.committed_date) |
13 | ago | 13 | ago |
14 | %td | 14 | %td |
15 | - = link_to truncate(content_commit.message, :length => 40), project_commit_path(@project, content_commit) | 15 | + = link_to truncate_commit_message(content_commit, 40), project_commit_path(@project, content_commit) |