From 33fd426afb5be89cecc5c4f0bd8e996d678e8580 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Tue, 20 Jan 2015 18:40:52 +0500 Subject: [PATCH] [#369] pull request: diff tab --- app/assets/stylesheets/views/diff.css.sass | 5 +- app/helpers/diff_helper.rb | 5 +- app/views/projects/git/commits/diff.html.haml | 40 ---------------- app/views/projects/git/commits/diff.html.slim | 46 +++++++++++++++++++ .../pull_requests/_pull_diff.html.slim | 24 +++++++--- 5 files changed, 68 insertions(+), 52 deletions(-) delete mode 100644 app/views/projects/git/commits/diff.html.haml create mode 100644 app/views/projects/git/commits/diff.html.slim diff --git a/app/assets/stylesheets/views/diff.css.sass b/app/assets/stylesheets/views/diff.css.sass index ca13f297d..9d32cfe4a 100644 --- a/app/assets/stylesheets/views/diff.css.sass +++ b/app/assets/stylesheets/views/diff.css.sass @@ -78,8 +78,5 @@ table.table.diff.inline margin-top: 5px div.file div.top - height: 28px + min-height: 28px background: #ededed - - .pull-left, .pull-right - margin: 6px 10px 0px 10px diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index f39194fad..f1353f461 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -1,4 +1,7 @@ module DiffHelper + MAX_FILES_WITHOUT_COLLAPSE = 25 + MAX_LINES_WITHOUT_COLLAPSE = 50 + def render_diff_stats(stats) path = @pull.try(:id) ? polymorphic_path([@project, @pull]) : '' @@ -20,7 +23,7 @@ module DiffHelper end def wrap_header_list(stats, list) - is_stats_open = stats.count <= 25 ? 'in' : '' + is_stats_open = stats.count <= MAX_FILES_WITHOUT_COLLAPSE ? 'in' : '' res = ["
"] res << "
" res << "