Commit 5a1e159b authored by Douwe Maan's avatar Douwe Maan

Make tree, blob and blame pages more consistent

parent f59a44db
...@@ -4,13 +4,14 @@ ...@@ -4,13 +4,14 @@
*/ */
.file-holder { .file-holder {
border: 1px solid $border-color; border: 1px solid $border-color;
border-radius: $border-radius-default;
&.file-holder-no-border { &.file-holder-no-border {
border: 0; border: 0;
} }
&.readme-holder { &.readme-holder {
margin: $gl-padding-top 0; margin: $gl-padding 0;
} }
table { table {
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
text-align: left; text-align: left;
padding: 10px $gl-padding; padding: 10px $gl-padding;
word-wrap: break-word; word-wrap: break-word;
border-radius: 3px 3px 0 0; border-radius: $border-radius-default $border-radius-default 0 0;
&.file-title-clear { &.file-title-clear {
padding-left: 0; padding-left: 0;
...@@ -94,9 +95,16 @@ ...@@ -94,9 +95,16 @@
tr { tr {
border-bottom: 1px solid $blame-border; border-bottom: 1px solid $blame-border;
&:last-child {
border-bottom: none;
}
} }
td { td {
border-top: none;
border-bottom: none;
&:first-child { &:first-child {
border-left: none; border-left: none;
} }
...@@ -107,7 +115,7 @@ ...@@ -107,7 +115,7 @@
} }
td.blame-commit { td.blame-commit {
padding: 0 10px; padding: 5px 10px;
min-width: 400px; min-width: 400px;
background: $gray-light; background: $gray-light;
} }
...@@ -246,7 +254,7 @@ span.idiff { ...@@ -246,7 +254,7 @@ span.idiff {
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
padding: 5px $gl-padding; padding: 5px $gl-padding;
margin: 0; margin: 0;
border-radius: 3px 3px 0 0; border-radius: $border-radius-default $border-radius-default 0 0;
.file-header-content { .file-header-content {
white-space: nowrap; white-space: nowrap;
......
...@@ -163,7 +163,7 @@ $fixed-layout-width: 1280px; ...@@ -163,7 +163,7 @@ $fixed-layout-width: 1280px;
$limited-layout-width: 990px; $limited-layout-width: 990px;
$gl-avatar-size: 40px; $gl-avatar-size: 40px;
$error-exclamation-point: $red-500; $error-exclamation-point: $red-500;
$border-radius-default: 2px; $border-radius-default: 3px;
$settings-icon-size: 18px; $settings-icon-size: 18px;
$provider-btn-not-active-color: $blue-500; $provider-btn-not-active-color: $blue-500;
$link-underline-blue: $blue-500; $link-underline-blue: $blue-500;
......
...@@ -163,7 +163,6 @@ ...@@ -163,7 +163,6 @@
.avatar-cell { .avatar-cell {
width: 46px; width: 46px;
padding-left: 10px;
img { img {
margin-right: 0; margin-right: 0;
...@@ -175,7 +174,6 @@ ...@@ -175,7 +174,6 @@
justify-content: space-between; justify-content: space-between;
align-items: flex-start; align-items: flex-start;
flex-grow: 1; flex-grow: 1;
padding-left: 10px;
.merge-request-branches & { .merge-request-branches & {
flex-direction: column; flex-direction: column;
......
// Common // Common
.diff-file { .diff-file {
border: 1px solid $border-color;
margin-bottom: $gl-padding; margin-bottom: $gl-padding;
border-radius: 3px;
.commit-short-id { .commit-short-id {
font-family: $regular_font; font-family: $regular_font;
......
...@@ -138,11 +138,12 @@ ...@@ -138,11 +138,12 @@
.blob-commit-info { .blob-commit-info {
list-style: none; list-style: none;
background: $gray-light;
padding: 16px 16px 16px 6px;
border: 1px solid $border-color;
border-bottom: none;
margin: 0; margin: 0;
padding: 0;
}
.blob-content-holder {
margin-top: $gl-padding;
} }
.blob-upload-dropzone-previews { .blob-upload-dropzone-previews {
......
...@@ -18,7 +18,7 @@ module BlobHelper ...@@ -18,7 +18,7 @@ module BlobHelper
blob = options.delete(:blob) blob = options.delete(:blob)
blob ||= project.repository.blob_at(ref, path) rescue nil blob ||= project.repository.blob_at(ref, path) rescue nil
return unless blob return unless blob && blob.readable_text?
common_classes = "btn js-edit-blob #{options[:extra_class]}" common_classes = "btn js-edit-blob #{options[:extra_class]}"
......
...@@ -100,17 +100,15 @@ module CommitsHelper ...@@ -100,17 +100,15 @@ module CommitsHelper
end end
def link_to_browse_code(project, commit) def link_to_browse_code(project, commit)
return unless current_controller?(:projects, :commits)
if @path.blank? if @path.blank?
return link_to( return link_to(
"Browse Files", "Browse Files",
namespace_project_tree_path(project.namespace, project, commit), namespace_project_tree_path(project.namespace, project, commit),
class: "btn btn-default" class: "btn btn-default"
) )
end elsif @repo.blob_at(commit.id, @path)
return unless current_controller?(:projects, :commits)
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,
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
= render "projects/commits/head" = render "projects/commits/head"
%div{ class: container_class } %div{ class: container_class }
%h3.page-title Blame view
#blob-content-holder.tree-holder #blob-content-holder.tree-holder
= render "projects/blob/breadcrumb", blob: @blob, blame: true
.file-holder .file-holder
= render "projects/blob/header", blob: @blob, blame: true = render "projects/blob/header", blob: @blob, blame: true
......
.nav-block = render "projects/blob/breadcrumb", blob: blob
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'blob', path: @path
%ul.breadcrumb.repo-breadcrumb .info-well.hidden-xs
%li .well-segment
= link_to namespace_project_tree_path(@project.namespace, @project, @ref) do %ul.blob-commit-info
= @project.path
- path_breadcrumbs do |title, path|
- title = truncate(title, length: 40)
%li
- if path == @path
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@ref, path)) do
%strong= title
- else
= link_to title, namespace_project_tree_path(@project.namespace, @project, tree_join(@ref, path))
%ul.blob-commit-info.hidden-xs
- blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path)
= render blob_commit, project: @project, ref: @ref = render blob_commit, project: @project, ref: @ref
......
- blame = local_assigns.fetch(:blame, false)
.nav-block
.tree-controls
= render 'projects/find_file_link'
.btn-group.prepend-left-10{ role: "group" }<
-# only show normal/blame view links for text files
- if blob.readable_text?
- if blame
= link_to 'Normal view', namespace_project_blob_path(@project.namespace, @project, @id),
class: 'btn'
- else
= link_to 'Blame', namespace_project_blame_path(@project.namespace, @project, @id),
class: 'btn js-blob-blame-link' unless blob.empty?
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id),
class: 'btn'
= link_to 'Permalink', namespace_project_blob_path(@project.namespace, @project,
tree_join(@commit.sha, @path)), class: 'btn js-data-file-blob-permalink-url'
.tree-ref-holder
= render 'shared/ref_switcher', destination: 'blob', path: @path
%ul.breadcrumb.repo-breadcrumb
%li
= link_to namespace_project_tree_path(@project.namespace, @project, @ref) do
= @project.path
- path_breadcrumbs do |title, path|
- title = truncate(title, length: 40)
%li
- if path == @path
= link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@ref, path)) do
%strong= title
- else
= link_to title, namespace_project_tree_path(@project.namespace, @project, tree_join(@ref, path))
...@@ -11,23 +11,7 @@ ...@@ -11,23 +11,7 @@
= view_on_environment_button(@commit.sha, @path, @environment) if @environment = view_on_environment_button(@commit.sha, @path, @environment) if @environment
.btn-group{ role: "group" }< .btn-group{ role: "group" }<
-# only show normal/blame view links for text files = edit_blob_link
- if blob.readable_text?
- if blame
= link_to 'Normal view', namespace_project_blob_path(@project.namespace, @project, @id),
class: 'btn btn-sm'
- else
= link_to 'Blame', namespace_project_blame_path(@project.namespace, @project, @id),
class: 'btn btn-sm js-blob-blame-link' unless blob.empty?
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id),
class: 'btn btn-sm'
= link_to 'Permalink', namespace_project_blob_path(@project.namespace, @project,
tree_join(@commit.sha, @path)), class: 'btn btn-sm js-data-file-blob-permalink-url'
.btn-group{ role: "group" }<
= edit_blob_link if blob.readable_text?
- if current_user - if current_user
= replace_blob_link = replace_blob_link
= delete_blob_link = delete_blob_link
......
.diff-file .diff-file.file-holder
.diff-content .diff-content
- if markup?(@blob.name) - if markup?(@blob.name)
.file-content.wiki .file-content.wiki
......
...@@ -6,16 +6,6 @@ ...@@ -6,16 +6,6 @@
%th Name %th Name
%th.hidden-xs %th.hidden-xs
.pull-left Last commit .pull-left Last commit
.last-commit.hidden-sm.pull-left
%i.fa.fa-angle-right
%small.light
= link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace"
= clipboard_button(text: @commit.id, title: "Copy commit SHA to clipboard")
= time_ago_with_tooltip(@commit.committed_date)
\-
= @commit.full_title
%small.commit-history-link-spacer &#124;
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'commit-history-link'
%th.text-right Last Update %th.text-right Last Update
- if @path.present? - if @path.present?
%tr.tree-item %tr.tree-item
......
.tree-controls .tree-controls
= render 'projects/find_file_link' = render 'projects/find_file_link'
= link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'btn btn-grouped'
= render 'projects/buttons/download', project: @project, ref: @ref = render 'projects/buttons/download', project: @project, ref: @ref
.tree-ref-holder .tree-ref-holder
......
...@@ -7,4 +7,13 @@ ...@@ -7,4 +7,13 @@
= render 'projects/last_push' = render 'projects/last_push'
%div{ class: container_class } %div{ class: container_class }
= render 'projects/files' #tree-holder.tree-holder.clearfix
.nav-block
= render 'projects/tree/tree_header', tree: @tree
.info-well.hidden-xs.append-bottom-default
.well-segment
%ul.blob-commit-info
= render 'projects/commits/commit', commit: @commit, project: @project, ref: @ref
= render 'projects/tree/tree_content', tree: @tree
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