From 94d364e8cc84d82d278fee3881f5fab48a149ed2 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Tue, 10 Sep 2013 13:15:49 +0300 Subject: [PATCH] UI fixes for commits lists --- app/assets/stylesheets/sections/commits.scss | 12 +++++++++++- app/assets/stylesheets/sections/events.scss | 17 ++++------------- app/assets/stylesheets/sections/merge_requests.scss | 7 ------- app/helpers/commits_helper.rb | 5 +++-- app/views/events/_commit.html.haml | 8 +++----- app/views/projects/commits/_inline_commit.html.haml | 9 +++++++++ 6 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 app/views/projects/commits/_inline_commit.html.haml diff --git a/app/assets/stylesheets/sections/commits.scss b/app/assets/stylesheets/sections/commits.scss index f661276..b0cf8b1 100644 --- a/app/assets/stylesheets/sections/commits.scss +++ b/app/assets/stylesheets/sections/commits.scss @@ -469,7 +469,6 @@ li.commit { } .commit_short_id { - float: left; min-width: 65px; font-family: $monospace_font; } @@ -494,4 +493,15 @@ li.commit { @extend .cgray; } } + + &.inline-commit { + .commit-row-title { + font-size: 13px; + } + + .committed_ago { + float: right; + @extend .cgray; + } + } } diff --git a/app/assets/stylesheets/sections/events.scss b/app/assets/stylesheets/sections/events.scss index 80ee6b6..fd5c80f 100644 --- a/app/assets/stylesheets/sections/events.scss +++ b/app/assets/stylesheets/sections/events.scss @@ -56,10 +56,6 @@ margin-left: 35px; margin-right: 100px; - .commit p { - color: #666; - padding-top: 5px; - } .event-info { color: #666; } @@ -107,13 +103,6 @@ } } - ul { - .avatar { - width: 18px; - margin: 2px 4px; - } - } - &:last-child { border:none } .event_commits { @@ -124,12 +113,14 @@ background: transparent; padding: 3px; border: none; - font-size: 12px; + color: #666; + .commit-row-title { + font-size: 12px; + } } &.commits-stat { display: block; padding: 3px; - margin-top: 3px; &:hover { background: none; diff --git a/app/assets/stylesheets/sections/merge_requests.scss b/app/assets/stylesheets/sections/merge_requests.scss index e7b464f..aa61cae 100644 --- a/app/assets/stylesheets/sections/merge_requests.scss +++ b/app/assets/stylesheets/sections/merge_requests.scss @@ -64,13 +64,6 @@ margin: 0; padding: 0; padding: 5px 0; - .avatar { position:relative } - .commit-author-name, - .dash, - .committed_ago, - .browse_code_link_holder { - display: none; - } list-style: none; &:hover { background: none; diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index e889b39..f8f84ff 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -56,8 +56,9 @@ module CommitsHelper end end - def commit_to_html commit, project - escape_javascript(render 'projects/commits/commit', commit: commit, project: project) unless commit.nil? + def commit_to_html(commit, project, inline = true) + template = inline ? "inline_commit" : "commit" + escape_javascript(render "projects/commits/#{template}", commit: commit, project: project) unless commit.nil? end def diff_line_content(line) diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index b50faf5..4d4b240 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -1,7 +1,5 @@ %li.commit - %p + .commit-row-title = link_to commit[:id][0..8], project_commit_path(project, commit[:id]), class: "commit_short_id", alt: '' - %span= commit[:author][:name] - – - = image_tag gravatar_icon(commit[:author][:email]), class: "avatar", width: 16 - = gfm escape_once(truncate(commit[:message], length: 50)) rescue "--broken encoding" +   + = gfm escape_once(truncate(commit[:message], length: 70)) rescue "--broken encoding" diff --git a/app/views/projects/commits/_inline_commit.html.haml b/app/views/projects/commits/_inline_commit.html.haml new file mode 100644 index 0000000..5be8460 --- /dev/null +++ b/app/views/projects/commits/_inline_commit.html.haml @@ -0,0 +1,9 @@ +%li.commit.inline-commit + .commit-row-title + = link_to commit.short_id(8), project_commit_path(project, commit), class: "commit_short_id" +   + = link_to_gfm truncate(commit.title, length: 40), project_commit_path(project, commit.id), class: "commit-row-message" + %time.committed_ago{ datetime: commit.committed_date, title: commit.committed_date.stamp("Aug 21, 2011 9:23pm") } + = time_ago_in_words(commit.committed_date) + ago +   -- libgit2 0.21.2