From eb06dd79f8285c5a375bbbe796d6e92ab7080cab Mon Sep 17 00:00:00 2001 From: Riyad Preukschas Date: Thu, 2 Aug 2012 02:31:45 +0200 Subject: [PATCH] Update views for GFM --- app/controllers/refs_controller.rb | 1 + app/views/commits/_commit.html.haml | 2 +- app/views/commits/_commit_box.html.haml | 4 ++-- app/views/commits/index.atom.builder | 2 +- app/views/events/_commit.html.haml | 2 +- app/views/issues/_show.html.haml | 2 +- app/views/issues/show.html.haml | 4 ++-- app/views/merge_requests/_merge_request.html.haml | 2 +- app/views/merge_requests/show/_mr_box.html.haml | 2 +- app/views/milestones/_milestone.html.haml | 2 +- app/views/milestones/show.html.haml | 4 ++-- app/views/refs/_tree_commit.html.haml | 2 +- app/views/refs/blame.html.haml | 2 +- app/views/repositories/_branch.html.haml | 2 +- app/views/repositories/_feed.html.haml | 2 +- app/views/repositories/tags.html.haml | 2 +- 16 files changed, 19 insertions(+), 18 deletions(-) diff --git a/app/controllers/refs_controller.rb b/app/controllers/refs_controller.rb index d180e70..a261f2a 100644 --- a/app/controllers/refs_controller.rb +++ b/app/controllers/refs_controller.rb @@ -90,6 +90,7 @@ class RefsController < ApplicationController @repo = project.repo @commit = project.commit(@ref) + @commit = CommitDecorator.decorate(@commit) @tree = Tree.new(@commit.tree, project, @ref, params[:path]) @tree = TreeDecorator.new(@tree) @hex_path = Digest::SHA1.hexdigest(params[:path] || "/") diff --git a/app/views/commits/_commit.html.haml b/app/views/commits/_commit.html.haml index 9824161..b4f8f91 100644 --- a/app/views/commits/_commit.html.haml +++ b/app/views/commits/_commit.html.haml @@ -7,7 +7,7 @@ %strong.cgray= commit.author_name – = image_tag gravatar_icon(commit.author_email), :class => "avatar", :width => 16 - = link_to 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, :id => commit.id), :class => "row_title" %span.committed_ago = time_ago_in_words(commit.committed_date) diff --git a/app/views/commits/_commit_box.html.haml b/app/views/commits/_commit_box.html.haml index 6994de4..5edaaf9 100644 --- a/app/views/commits/_commit_box.html.haml +++ b/app/views/commits/_commit_box.html.haml @@ -11,10 +11,10 @@ = link_to tree_project_ref_path(@project, @commit.id), :class => "browse-button primary grouped" do %strong Browse Code ยป %h3.commit-title.page_title - = commit_msg_with_link_to_issues(@project, @commit.title) + = gfm @commit.title - if @commit.description.present? %pre.commit-description - = commit_msg_with_link_to_issues(@project, @commit.description) + = gfm @commit.description .commit-info .row .span4 diff --git a/app/views/commits/index.atom.builder b/app/views/commits/index.atom.builder index 86c9fc0..cca7045 100644 --- a/app/views/commits/index.atom.builder +++ b/app/views/commits/index.atom.builder @@ -17,7 +17,7 @@ xml.feed "xmlns" => "http://www.w3.org/2005/Atom", "xmlns:media" => "http://sear xml.name commit.author_name xml.email commit.author_email end - xml.summary commit.description + xml.summary gfm(commit.description) end end end diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index d6c5546..ca0f29e 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -5,5 +5,5 @@ %strong.cdark= commit.author_name – = image_tag gravatar_icon(commit.author_email), :class => "avatar", :width => 16 - = truncate(commit.title, :length => 50) rescue "--broken encoding" + = gfm truncate(commit.title, :length => 50), project_commit_path(project, :id => commit.id) rescue "--broken encoding" diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml index 574777b..df89268 100644 --- a/app/views/issues/_show.html.haml +++ b/app/views/issues/_show.html.haml @@ -24,7 +24,7 @@ - else = image_tag "no_avatar.png", :class => "avatar" - %p= link_to truncate(issue.title, :length => 100), project_issue_path(issue.project, issue), :class => "row_title" + %p= link_to_gfm truncate(issue.title, :length => 100), project_issue_path(issue.project, issue), :class => "row_title" %span.update-author %small.cdark= "##{issue.id}" diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml index 4e8bcb8..c653377 100644 --- a/app/views/issues/show.html.haml +++ b/app/views/issues/show.html.haml @@ -31,7 +31,7 @@ .alert-message.error.status_info Closed - else .alert-message.success.status_info Open - = @issue.title + = gfm @issue.title .middle_box_content %cite.cgray Created by @@ -46,7 +46,7 @@ - if @issue.milestone - milestone = @issue.milestone %cite.cgray and attached to milestone - %strong= link_to truncate(milestone.title, :length => 20), project_milestone_path(milestone.project, milestone) + %strong= link_to_gfm truncate(milestone.title, :length => 20), project_milestone_path(milestone.project, milestone) .right - @issue.labels.each do |label| diff --git a/app/views/merge_requests/_merge_request.html.haml b/app/views/merge_requests/_merge_request.html.haml index 5cd9b9b..59af97a 100644 --- a/app/views/merge_requests/_merge_request.html.haml +++ b/app/views/merge_requests/_merge_request.html.haml @@ -16,7 +16,7 @@ = merge_request.target_branch = image_tag gravatar_icon(merge_request.author_email), :class => "avatar" - %p= link_to truncate(merge_request.title, :length => 80), project_merge_request_path(merge_request.project, merge_request), :class => "row_title" + %p= link_to_gfm truncate(merge_request.title, :length => 80), project_merge_request_path(merge_request.project, merge_request), :class => "row_title" %span.update-author %small.cdark= "##{merge_request.id}" diff --git a/app/views/merge_requests/show/_mr_box.html.haml b/app/views/merge_requests/show/_mr_box.html.haml index b542dac..bb8bf1c 100644 --- a/app/views/merge_requests/show/_mr_box.html.haml +++ b/app/views/merge_requests/show/_mr_box.html.haml @@ -5,7 +5,7 @@ .alert-message.error.status_info Closed - else .alert-message.success.status_info Open - = @merge_request.title + = gfm @merge_request.title .middle_box_content %div diff --git a/app/views/milestones/_milestone.html.haml b/app/views/milestones/_milestone.html.haml index 81ec92e..06cf630 100644 --- a/app/views/milestones/_milestone.html.haml +++ b/app/views/milestones/_milestone.html.haml @@ -7,7 +7,7 @@ - if can? current_user, :admin_milestone, milestone.project = link_to 'Edit', edit_project_milestone_path(milestone.project, milestone), :class => "btn small edit-milestone-link grouped" %h4 - = link_to truncate(milestone.title, :length => 100), project_milestone_path(milestone.project, milestone), :class => "row_title" + = link_to_gfm truncate(milestone.title, :length => 100), project_milestone_path(milestone.project, milestone), :class => "row_title" %small = milestone.expires_at %br diff --git a/app/views/milestones/show.html.haml b/app/views/milestones/show.html.haml index 7ec49b5..1a73181 100644 --- a/app/views/milestones/show.html.haml +++ b/app/views/milestones/show.html.haml @@ -21,7 +21,7 @@ .alert-message.error.status_info Closed - else .alert-message.success.status_info Open - = @milestone.title + = gfm @milestone.title %small.right= @milestone.expires_at .middle_box_content @@ -51,7 +51,7 @@ = link_to [@project, issue] do %span.badge.badge-info ##{issue.id} – - = link_to truncate(issue.title, :length => 60), [@project, issue] + = link_to_gfm truncate(issue.title, :length => 60), [@project, issue] %br = paginate @issues, :theme => "gitlab" diff --git a/app/views/refs/_tree_commit.html.haml b/app/views/refs/_tree_commit.html.haml index 7da8ae1..2c8cd93 100644 --- a/app/views/refs/_tree_commit.html.haml +++ b/app/views/refs/_tree_commit.html.haml @@ -1,3 +1,3 @@ - if tm %strong= link_to "[#{tm.user_name}]", project_team_member_path(@project, tm) -= link_to truncate(content_commit.title, :length => tm ? 30 : 50), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" += link_to_gfm truncate(content_commit.title, :length => tm ? 30 : 50), project_commit_path(@project, content_commit.id), :class => "tree-commit-link" diff --git a/app/views/refs/blame.html.haml b/app/views/refs/blame.html.haml index 0fc08e0..6d036c9 100644 --- a/app/views/refs/blame.html.haml +++ b/app/views/refs/blame.html.haml @@ -33,7 +33,7 @@ %td.blame_commit   %code= link_to commit.short_id, project_commit_path(@project, :id => commit.id) - = link_to truncate(commit.title, :length => 30), project_commit_path(@project, :id => commit.id), :class => "row_title" rescue "--broken encoding" + = link_to_gfm truncate(commit.title, :length => 30), project_commit_path(@project, :id => commit.id), :class => "row_title" rescue "--broken encoding" %td.lines = preserve do %pre diff --git a/app/views/repositories/_branch.html.haml b/app/views/repositories/_branch.html.haml index 3efe83e..6b2698d 100644 --- a/app/views/repositories/_branch.html.haml +++ b/app/views/repositories/_branch.html.haml @@ -11,7 +11,7 @@ %code= commit.short_id = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = truncate(commit.title, :length => 40) + = gfm truncate(commit.title, :length => 40) %td %span.update-author.right = time_ago_in_words(commit.committed_date) diff --git a/app/views/repositories/_feed.html.haml b/app/views/repositories/_feed.html.haml index a9a1181..a9b9fd0 100644 --- a/app/views/repositories/_feed.html.haml +++ b/app/views/repositories/_feed.html.haml @@ -13,7 +13,7 @@ = link_to project_commits_path(@project, commit.id) do %code= commit.short_id = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = truncate(commit.title, :length => 40) + = gfm truncate(commit.title, :length => 40) %td %span.right.cgray = time_ago_in_words(commit.committed_date) diff --git a/app/views/repositories/tags.html.haml b/app/views/repositories/tags.html.haml index d09c40e..8db6c53 100644 --- a/app/views/repositories/tags.html.haml +++ b/app/views/repositories/tags.html.haml @@ -17,7 +17,7 @@ = link_to project_commit_path(@project, commit.id) do %code= commit.short_id = image_tag gravatar_icon(commit.author_email), :class => "", :width => 16 - = truncate(commit.title, :length => 40) + = gfm truncate(commit.title, :length => 40) %td %span.update-author.right = time_ago_in_words(commit.committed_date) -- libgit2 0.21.2