Commit 8827eea8 authored by Phil Hughes's avatar Phil Hughes

Updated commits UI

Closes #14633
parent 915ad255
...@@ -7,74 +7,84 @@ ...@@ -7,74 +7,84 @@
margin-right: 9px; margin-right: 9px;
} }
.lists-separator { .commit-header {
margin: 10px 0; padding: 5px 10px;
border-color: #ddd; background-color: $background-color;
border-top: 1px solid $border-color;
border-bottom: 1px solid $border-color;
font-size: 14px;
&:first-child {
border-top-width: 0;
}
} }
.commits-row { .commit-row-title {
ul { line-height: 20px;
margin: 0; margin-bottom: 2px;
li.commit { .notes_count {
padding: 8px 0; float: right;
} margin-right: 10px;
} }
.commits-row-date { .str-truncated {
font-size: 15px; max-width: 70%;
line-height: 20px;
margin-bottom: 5px;
} }
}
li.commit { .commit-row-message {
list-style: none; color: $gl-dark-link-color;
.commit-row-title { &:hover {
font-size: $list-font-size; text-decoration: underline;
line-height: 20px;
margin-bottom: 2px;
.btn-clipboard {
margin-top: -1px;
} }
}
.notes_count { .text-expander {
float: right; background: #eee;
margin-right: 10px; color: #555;
padding: 0 5px;
cursor: pointer;
margin-left: 4px;
&:hover {
background-color: #ddd;
} }
}
}
.commit_short_id { .commit-actions {
min-width: 65px; @media (min-width: $screen-md-min) {
color: $gl-dark-link-color; float: right;
font-family: $monospace_font; }
} }
.str-truncated { .commit-short-id {
max-width: 70%; font-family: $monospace_font;
} font-weight: 600;
}
.commit-row-message { .commit {
color: $gl-dark-link-color; padding: 10px 0 10px 55px;
&:hover { &:not(:last-child) {
text-decoration: underline; border-bottom: 1px solid #eee;
} }
}
a {
color: $gl-dark-link-color;
}
.text-expander { .commit-link {
background: #eee; &:hover {
color: #555; color: $gl-link-color;
padding: 0 5px; text-decoration: none;
cursor: pointer;
margin-left: 4px;
&:hover {
background-color: #ddd;
}
} }
} }
.avatar {
margin-left: -55px;
}
.item-title { .item-title {
display: inline-block; display: inline-block;
max-width: 70%; max-width: 70%;
...@@ -84,7 +94,7 @@ li.commit { ...@@ -84,7 +94,7 @@ li.commit {
font-size: 14px; font-size: 14px;
border-left: 1px solid #eee; border-left: 1px solid #eee;
padding: 10px 15px; padding: 10px 15px;
margin: 5px 0 10px 5px; margin: 10px 0 10px 0;
background: #f9f9f9; background: #f9f9f9;
display: none; display: none;
...@@ -111,10 +121,6 @@ li.commit { ...@@ -111,10 +121,6 @@ li.commit {
.avatar { .avatar {
margin-right: 8px; margin-right: 8px;
} }
.committed_ago {
display: inline-block;
}
} }
&.inline-commit { &.inline-commit {
......
...@@ -38,10 +38,10 @@ module CiStatusHelper ...@@ -38,10 +38,10 @@ module CiStatusHelper
icon(icon_name + ' fw') icon(icon_name + ' fw')
end end
def render_commit_status(commit, tooltip_placement: 'auto left') def render_commit_status(commit, tooltip_placement: 'auto left', cssclass: '')
project = commit.project project = commit.project
path = builds_namespace_project_commit_path(project.namespace, project, commit) path = builds_namespace_project_commit_path(project.namespace, project, commit)
render_status_with_link('commit', commit.status, path, tooltip_placement) render_status_with_link('commit', commit.status, path, tooltip_placement, cssclass: cssclass)
end end
def render_pipeline_status(pipeline, tooltip_placement: 'auto left') def render_pipeline_status(pipeline, tooltip_placement: 'auto left')
...@@ -57,10 +57,10 @@ module CiStatusHelper ...@@ -57,10 +57,10 @@ module CiStatusHelper
private private
def render_status_with_link(type, status, path, tooltip_placement) def render_status_with_link(type, status, path, tooltip_placement, cssclass: '')
link_to ci_icon_for_status(status), link_to ci_icon_for_status(status),
path, path,
class: "ci-status-link ci-status-icon-#{status.dasherize}", class: "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}",
title: "#{type.titleize}: #{ci_label_for_status(status)}", title: "#{type.titleize}: #{ci_label_for_status(status)}",
data: { toggle: 'tooltip', placement: tooltip_placement } data: { toggle: 'tooltip', placement: tooltip_placement }
end end
......
...@@ -16,6 +16,19 @@ module CommitsHelper ...@@ -16,6 +16,19 @@ module CommitsHelper
commit_person_link(commit, options.merge(source: :committer)) commit_person_link(commit, options.merge(source: :committer))
end end
def commit_author_avatar(commit, options = {})
options = options.merge(source: :author)
user = commit.send(options[:source])
source_name = clean(commit.send "#{options[:source]}_name".to_sym)
source_email = clean(commit.send "#{options[:source]}_email".to_sym)
person_name = user.try(:name) || source_name
person_email = user.try(:email) || source_email
image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "")
end
def image_diff_class(diff) def image_diff_class(diff)
if diff.deleted_file if diff.deleted_file
"deleted" "deleted"
...@@ -102,24 +115,24 @@ module CommitsHelper ...@@ -102,24 +115,24 @@ module CommitsHelper
if current_controller?(:projects, :commits) if current_controller?(:projects, :commits)
if @repo.blob_at(commit.id, @path) if @repo.blob_at(commit.id, @path)
return link_to( return link_to(
"Browse File »", "Browse File",
namespace_project_blob_path(project.namespace, project, namespace_project_blob_path(project.namespace, project,
tree_join(commit.id, @path)), tree_join(commit.id, @path)),
class: "pull-right" class: "btn btn-default"
) )
elsif @path.present? elsif @path.present?
return link_to( return link_to(
"Browse Directory »", "Browse Directory",
namespace_project_tree_path(project.namespace, project, namespace_project_tree_path(project.namespace, project,
tree_join(commit.id, @path)), tree_join(commit.id, @path)),
class: "pull-right" class: "btn btn-default"
) )
end end
end end
link_to( link_to(
"Browse Files", "Browse Files",
namespace_project_tree_path(project.namespace, project, commit), namespace_project_tree_path(project.namespace, project, commit),
class: "pull-right" class: "btn btn-default"
) )
end end
...@@ -191,8 +204,7 @@ module CommitsHelper ...@@ -191,8 +204,7 @@ module CommitsHelper
text = text =
if options[:avatar] if options[:avatar]
avatar = image_tag(avatar_icon(person_email, options[:size]), class: "avatar #{"s#{options[:size]}" if options[:size]}", width: options[:size], alt: "") %Q{<span class="commit-#{options[:source]}-name">#{person_name}</span>}
%Q{#{avatar} <span class="commit-#{options[:source]}-name">#{person_name}</span>}
else else
person_name person_name
end end
......
...@@ -9,26 +9,25 @@ ...@@ -9,26 +9,25 @@
= cache(cache_key) do = cache(cache_key) do
%li.commit.js-toggle-container{ id: "commit-#{commit.short_id}" } %li.commit.js-toggle-container{ id: "commit-#{commit.short_id}" }
= commit_author_avatar(commit)
.commit-row-title .commit-row-title
%span.item-title %span.item-title
= link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message commit-link"
- if commit.description? - if commit.description?
%a.text-expander.js-toggle-button ... %a.text-expander.js-toggle-button ...
.pull-right .commit-actions
- if commit.status - if commit.status
= render_commit_status(commit) = render_commit_status(commit, cssclass: 'btn btn-transparent')
= clipboard_button(clipboard_text: commit.id) = clipboard_button(clipboard_text: commit.id)
= link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit_short_id" = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-short-id btn btn-transparent commit-link"
= link_to_browse_code(project, commit)
- if commit.description? - if commit.description?
.commit-row-description.js-toggle-content %pre.commit-row-description.js-toggle-content
%pre = preserve(markdown(escape_once(commit.description), pipeline: :single_line, author: commit.author))
= preserve(markdown(escape_once(commit.description), pipeline: :single_line, author: commit.author))
.commit-row-info .commit-row-info
by
= commit_author_link(commit, avatar: true, size: 24) = commit_author_link(commit, avatar: true, size: 24)
.committed_ago authored
#{time_ago_with_tooltip(commit.committed_date)} &nbsp; #{time_ago_with_tooltip(commit.committed_date)} &nbsp;
= link_to_browse_code(project, commit)
...@@ -4,18 +4,11 @@ ...@@ -4,18 +4,11 @@
- commits, hidden = limited_commits(@commits) - commits, hidden = limited_commits(@commits)
- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, commits| - commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, commits|
.row.commits-row %li.commit-header= "#{day.strftime('%d %b, %Y')} #{pluralize(commits.count, 'commit')}"
.col-md-2.hidden-xs.hidden-sm %li.commits-row
%h5.commits-row-date %ul.list-unstyled.commit-list
%i.fa.fa-calendar = render commits, project: project
%span= day.strftime('%d %b, %Y')
.light
= pluralize(commits.count, 'commit')
.col-md-10.col-sm-12
%ul.content-list
= render commits, project: project
%hr.lists-separator
- if hidden > 0 - if hidden > 0
.alert.alert-warning %li.alert.alert-warning
#{number_with_delimiter(hidden)} additional commits have been omitted to prevent performance issues. #{number_with_delimiter(hidden)} additional commits have been omitted to prevent performance issues.
...@@ -23,21 +23,18 @@ ...@@ -23,21 +23,18 @@
Create Merge Request Create Merge Request
.control .control
= form_tag(namespace_project_commits_path(@project.namespace, @project, @id), method: :get, class: 'pull-left commits-search-form') do = form_tag(namespace_project_commits_path(@project.namespace, @project, @id), method: :get, class: 'commits-search-form') do
= search_field_tag :search, params[:search], { placeholder: 'Filter by commit message', id: 'commits-search', class: 'form-control search-text-input', spellcheck: false } = search_field_tag :search, params[:search], { placeholder: 'Filter by commit message', id: 'commits-search', class: 'form-control search-text-input input-short', spellcheck: false }
- if current_user && current_user.private_token - if current_user && current_user.private_token
.control .control
= link_to namespace_project_commits_path(@project.namespace, @project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Commits Feed", class: 'btn' do = link_to namespace_project_commits_path(@project.namespace, @project, @ref, {format: :atom, private_token: current_user.private_token}), title: "Commits Feed", class: 'btn' do
= icon("rss") = icon("rss")
%ul.breadcrumb.repo-breadcrumb %ul.breadcrumb.repo-breadcrumb
= commits_breadcrumbs = commits_breadcrumbs
%div{id: dom_id(@project)} %div{id: dom_id(@project)}
#commits-list.content_list= render "commits", project: @project %ol#commits-list.list-unstyled.content_list
.clear = render "commits", project: @project
= spinner = spinner
:javascript :javascript
......
...@@ -2,4 +2,5 @@ ...@@ -2,4 +2,5 @@
= icon("sort-amount-desc") = icon("sort-amount-desc")
Most recent commits displayed first Most recent commits displayed first
= render "projects/commits/commits", project: @merge_request.project %ol#commits-list.list-unstyled
= render "projects/commits/commits", project: @merge_request.project
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment