diff options
author | Fatih Acet <acetfatih@gmail.com> | 2017-05-09 22:00:23 +0000 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2017-05-09 22:00:23 +0000 |
commit | ecc6cc8be75b5c66fdf7f5595b71aabf9366a5e1 (patch) | |
tree | 203ac4d41df5e925e672da5f5a4498b017c414c9 /app | |
parent | 1e4e0b27d45cb32cb5339d3719a5221b7e832bf1 (diff) | |
parent | df88bb29637e57a1a0825be6b28f87d84e7590a6 (diff) | |
download | gitlab-ce-ecc6cc8be75b5c66fdf7f5595b71aabf9366a5e1.tar.gz |
Merge branch 'dm-tree-blob-blame-consistency' into 'master'
Make tree, blob and blame pages more consistent
See merge request !11194
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/framework/files.scss | 16 | ||||
-rw-r--r-- | app/assets/stylesheets/framework/variables.scss | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/commits.scss | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/diff.scss | 2 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/tree.scss | 9 | ||||
-rw-r--r-- | app/helpers/blob_helper.rb | 2 | ||||
-rw-r--r-- | app/helpers/commits_helper.rb | 8 | ||||
-rw-r--r-- | app/views/projects/blame/show.html.haml | 4 | ||||
-rw-r--r-- | app/views/projects/blob/_blob.html.haml | 25 | ||||
-rw-r--r-- | app/views/projects/blob/_breadcrumb.html.haml | 36 | ||||
-rw-r--r-- | app/views/projects/blob/_header.html.haml | 18 | ||||
-rw-r--r-- | app/views/projects/blob/preview.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/find_file/show.html.haml | 1 | ||||
-rw-r--r-- | app/views/projects/tree/_tree_content.html.haml | 10 | ||||
-rw-r--r-- | app/views/projects/tree/_tree_header.html.haml | 3 | ||||
-rw-r--r-- | app/views/projects/tree/show.html.haml | 11 |
16 files changed, 82 insertions, 69 deletions
diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 1dd0e5ab581..f8674b763c8 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -4,13 +4,14 @@ */ .file-holder { border: 1px solid $border-color; + border-radius: $border-radius-default; &.file-holder-no-border { border: 0; } &.readme-holder { - margin: $gl-padding-top 0; + margin: $gl-padding 0; } table { @@ -25,7 +26,7 @@ text-align: left; padding: 10px $gl-padding; word-wrap: break-word; - border-radius: 3px 3px 0 0; + border-radius: $border-radius-default $border-radius-default 0 0; &.file-title-clear { padding-left: 0; @@ -94,9 +95,16 @@ tr { border-bottom: 1px solid $blame-border; + + &:last-child { + border-bottom: none; + } } td { + border-top: none; + border-bottom: none; + &:first-child { border-left: none; } @@ -107,7 +115,7 @@ } td.blame-commit { - padding: 0 10px; + padding: 5px 10px; min-width: 400px; background: $gray-light; } @@ -246,7 +254,7 @@ span.idiff { border-bottom: 1px solid $border-color; padding: 5px $gl-padding; margin: 0; - border-radius: 3px 3px 0 0; + border-radius: $border-radius-default $border-radius-default 0 0; .file-header-content { white-space: nowrap; diff --git a/app/assets/stylesheets/framework/variables.scss b/app/assets/stylesheets/framework/variables.scss index 4cfa5d718e9..17a4e8fd83e 100644 --- a/app/assets/stylesheets/framework/variables.scss +++ b/app/assets/stylesheets/framework/variables.scss @@ -163,7 +163,7 @@ $fixed-layout-width: 1280px; $limited-layout-width: 990px; $gl-avatar-size: 40px; $error-exclamation-point: $red-500; -$border-radius-default: 2px; +$border-radius-default: 3px; $settings-icon-size: 18px; $provider-btn-not-active-color: $blue-500; $link-underline-blue: $blue-500; diff --git a/app/assets/stylesheets/pages/commits.scss b/app/assets/stylesheets/pages/commits.scss index 9e3142c8aa3..c8996753809 100644 --- a/app/assets/stylesheets/pages/commits.scss +++ b/app/assets/stylesheets/pages/commits.scss @@ -163,7 +163,6 @@ .avatar-cell { width: 46px; - padding-left: 10px; img { margin-right: 0; @@ -175,7 +174,6 @@ justify-content: space-between; align-items: flex-start; flex-grow: 1; - padding-left: 10px; .merge-request-branches & { flex-direction: column; diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index e2769636c29..0d5c4aed971 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -1,8 +1,6 @@ // Common .diff-file { - border: 1px solid $border-color; margin-bottom: $gl-padding; - border-radius: 3px; .commit-short-id { font-family: $regular_font; diff --git a/app/assets/stylesheets/pages/tree.scss b/app/assets/stylesheets/pages/tree.scss index 03c75ce61f5..ab63225147f 100644 --- a/app/assets/stylesheets/pages/tree.scss +++ b/app/assets/stylesheets/pages/tree.scss @@ -138,11 +138,12 @@ .blob-commit-info { list-style: none; - background: $gray-light; - padding: 16px 16px 16px 6px; - border: 1px solid $border-color; - border-bottom: none; margin: 0; + padding: 0; +} + +.blob-content-holder { + margin-top: $gl-padding; } .blob-upload-dropzone-previews { diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index af430270ae4..eb37f2e0267 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -18,7 +18,7 @@ module BlobHelper blob = options.delete(:blob) 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]}" diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index cef624430da..97b497a0fed 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -100,17 +100,15 @@ module CommitsHelper end def link_to_browse_code(project, commit) + return unless current_controller?(:projects, :commits) + if @path.blank? return link_to( "Browse Files", namespace_project_tree_path(project.namespace, project, commit), class: "btn btn-default" ) - end - - return unless current_controller?(:projects, :commits) - - if @repo.blob_at(commit.id, @path) + elsif @repo.blob_at(commit.id, @path) return link_to( "Browse File", namespace_project_blob_path(project.namespace, project, diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index 35885b2c7b4..ae4658d8ca1 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -3,9 +3,9 @@ = render "projects/commits/head" %div{ class: container_class } - %h3.page-title Blame view - #blob-content-holder.tree-holder + = render "projects/blob/breadcrumb", blob: @blob, blame: true + .file-holder = render "projects/blob/header", blob: @blob, blame: true diff --git a/app/views/projects/blob/_blob.html.haml b/app/views/projects/blob/_blob.html.haml index f04df441ccb..f4307421ed0 100644 --- a/app/views/projects/blob/_blob.html.haml +++ b/app/views/projects/blob/_blob.html.haml @@ -1,23 +1,10 @@ -.nav-block - .tree-ref-holder - = render 'shared/ref_switcher', destination: 'blob', path: @path += render "projects/blob/breadcrumb", blob: blob - %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)) - -%ul.blob-commit-info.hidden-xs - - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) - = render blob_commit, project: @project, ref: @ref +.info-well.hidden-xs + .well-segment + %ul.blob-commit-info + - blob_commit = @repository.last_commit_for_path(@commit.id, blob.path) + = render blob_commit, project: @project, ref: @ref #blob-content-holder.blob-content-holder %article.file-holder diff --git a/app/views/projects/blob/_breadcrumb.html.haml b/app/views/projects/blob/_breadcrumb.html.haml new file mode 100644 index 00000000000..3f58e8d232f --- /dev/null +++ b/app/views/projects/blob/_breadcrumb.html.haml @@ -0,0 +1,36 @@ +- 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)) diff --git a/app/views/projects/blob/_header.html.haml b/app/views/projects/blob/_header.html.haml index cd098acda81..0be15cc179f 100644 --- a/app/views/projects/blob/_header.html.haml +++ b/app/views/projects/blob/_header.html.haml @@ -11,23 +11,7 @@ = view_on_environment_button(@commit.sha, @path, @environment) if @environment .btn-group{ 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 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? + = edit_blob_link - if current_user = replace_blob_link = delete_blob_link diff --git a/app/views/projects/blob/preview.html.haml b/app/views/projects/blob/preview.html.haml index e87b73c9a34..da2cef17e8a 100644 --- a/app/views/projects/blob/preview.html.haml +++ b/app/views/projects/blob/preview.html.haml @@ -1,4 +1,4 @@ -.diff-file +.diff-file.file-holder .diff-content - if markup?(@blob.name) .file-content.wiki diff --git a/app/views/projects/find_file/show.html.haml b/app/views/projects/find_file/show.html.haml index 4cdb44325b3..be0462f91cd 100644 --- a/app/views/projects/find_file/show.html.haml +++ b/app/views/projects/find_file/show.html.haml @@ -1,4 +1,5 @@ - page_title "Find File", @ref += render "projects/commits/head" .file-finder-holder.tree-holder.clearfix .nav-block diff --git a/app/views/projects/tree/_tree_content.html.haml b/app/views/projects/tree/_tree_content.html.haml index 2497a2d91b1..2e34803b143 100644 --- a/app/views/projects/tree/_tree_content.html.haml +++ b/app/views/projects/tree/_tree_content.html.haml @@ -6,16 +6,6 @@ %th Name %th.hidden-xs .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 | - = link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id), class: 'commit-history-link' %th.text-right Last Update - if @path.present? %tr.tree-item diff --git a/app/views/projects/tree/_tree_header.html.haml b/app/views/projects/tree/_tree_header.html.haml index 396d1ecd77b..e4d9e24f56e 100644 --- a/app/views/projects/tree/_tree_header.html.haml +++ b/app/views/projects/tree/_tree_header.html.haml @@ -1,5 +1,8 @@ .tree-controls = 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 .tree-ref-holder diff --git a/app/views/projects/tree/show.html.haml b/app/views/projects/tree/show.html.haml index 910d765aed0..42700c237fc 100644 --- a/app/views/projects/tree/show.html.haml +++ b/app/views/projects/tree/show.html.haml @@ -7,4 +7,13 @@ = render 'projects/last_push' %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 |