From 8c061c19a669974bda3fb4b98da00dc68c33eb4f Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 23 Dec 2014 22:49:00 +0500 Subject: [PATCH] [#369] pull request: diff tab --- app/helpers/diff_helper.rb | 4 ++-- app/views/projects/pull_requests/_nav_tabs.html.slim | 2 +- .../{_pull_diff.html.haml => _pull_diff.html.slim} | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) rename app/views/projects/pull_requests/{_pull_diff.html.haml => _pull_diff.html.slim} (93%) diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 9b930bda5..164e4020c 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -1,7 +1,7 @@ module DiffHelper def render_diff_stats(stats) path = @pull.try(:id) ? polymorphic_path([@project, @pull]) : '' - res = [""] + res = ["
"] stats.each_with_index do |stat, ind| res << "" res << "" @@ -36,7 +36,7 @@ module DiffHelper end prepare(args.merge({filepath: filepath, comments: comments, in_discussion: in_discussion})) - res = '
#{link_to stat.filename.rtruncate(120), "#{path}#diff-#{ind}"}
' + res = '
' res << '' res << renderer(diff_display.data) #diff_display.render(Git::Diff::InlineCallback.new comments, path) res << tr_line_comments(comments) if in_discussion diff --git a/app/views/projects/pull_requests/_nav_tabs.html.slim b/app/views/projects/pull_requests/_nav_tabs.html.slim index fc9ef12ed..b6bd65570 100644 --- a/app/views/projects/pull_requests/_nav_tabs.html.slim +++ b/app/views/projects/pull_requests/_nav_tabs.html.slim @@ -6,7 +6,7 @@ ul.nav.nav-tabs#pull_tabs role = 'tablist' href = '#discussion' ]= t 'pull_requests.tabs.discussion' -if @stats li role = 'presentation' - a[ data-toggle = 'diff' + a[ data-toggle = 'tab' role = 'tab' aria-controls = 'diff' href = "#diff" ]= "#{t'pull_requests.tabs.diff'} (#{@stats.count})" diff --git a/app/views/projects/pull_requests/_pull_diff.html.haml b/app/views/projects/pull_requests/_pull_diff.html.slim similarity index 93% rename from app/views/projects/pull_requests/_pull_diff.html.haml rename to app/views/projects/pull_requests/_pull_diff.html.slim index afbc97420..1c30a02f8 100644 --- a/app/views/projects/pull_requests/_pull_diff.html.haml +++ b/app/views/projects/pull_requests/_pull_diff.html.slim @@ -1,6 +1,6 @@ - commit_id = pull_diff.deleted_file ? @pull.to_commit.id : @pull.from_commit.id .file - %a{name: "diff-#{pull_diff_counter}"} + a name = "diff-#{pull_diff_counter}" .top .l= h(pull_diff.renamed_file ? "#{pull_diff.a_path.rtruncate 60}=>#{pull_diff.b_path.rtruncate 60}" : pull_diff.b_path.rtruncate(120)) - if @pull.from_project.present?