From ff82acf34319fbcd3598dba7c025715874ba903c Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 11 May 2017 10:47:44 -0500 Subject: Consistently use monospace font for commit SHAs and branch and tag names --- .../components/stage_plan_component.js | 2 +- .../components/stage_staging_component.js | 4 +- .../components/stage_test_component.js | 4 +- .../pipelines/components/pipeline_url.js | 2 +- .../components/mr_widget_header.js | 54 ++++++++++---------- .../components/mr_widget_pipeline.js | 5 +- .../javascripts/vue_shared/components/commit.js | 4 +- app/assets/stylesheets/framework/gfm.scss | 4 +- app/assets/stylesheets/framework/typography.scss | 23 +++++++-- app/assets/stylesheets/framework/wells.scss | 6 ++- app/assets/stylesheets/pages/commits.scss | 10 ++-- app/assets/stylesheets/pages/cycle_analytics.scss | 4 +- app/assets/stylesheets/pages/diff.scss | 5 -- app/assets/stylesheets/pages/environments.scss | 4 +- app/assets/stylesheets/pages/merge_requests.scss | 56 ++++++++++----------- app/assets/stylesheets/pages/notes.scss | 5 -- app/assets/stylesheets/pages/pipelines.scss | 8 ++- app/assets/stylesheets/pages/projects.scss | 14 ++---- app/helpers/commits_helper.rb | 21 +++----- app/helpers/diff_helper.rb | 4 +- app/helpers/events_helper.rb | 11 ++-- app/helpers/gitlab_routing_helper.rb | 4 ++ app/helpers/todos_helper.rb | 11 ++-- app/models/issue.rb | 2 +- .../chat_message/pipeline_message.rb | 6 +-- .../project_services/chat_message/push_message.rb | 4 +- app/serializers/pipeline_entity.rb | 5 +- app/serializers/request_aware_entity.rb | 1 + app/views/discussions/_discussion.html.haml | 2 +- app/views/events/_commit.html.haml | 2 +- app/views/projects/_last_commit.html.haml | 2 +- app/views/projects/_last_push.html.haml | 2 +- app/views/projects/blame/show.html.haml | 2 +- app/views/projects/branches/_branch.html.haml | 3 +- app/views/projects/branches/_commit.html.haml | 2 +- app/views/projects/branches/new.html.haml | 2 +- app/views/projects/builds/_header.html.haml | 18 +++---- app/views/projects/ci/builds/_build.html.haml | 6 +-- app/views/projects/commit/_commit_box.html.haml | 9 ++-- app/views/projects/commit/_pipeline.html.haml | 52 ------------------- app/views/projects/commit/branches.html.haml | 28 +++++------ app/views/projects/commits/_commit.html.haml | 2 +- .../projects/commits/_inline_commit.html.haml | 2 +- app/views/projects/compare/_form.html.haml | 4 +- app/views/projects/compare/index.html.haml | 6 +-- app/views/projects/compare/show.html.haml | 4 +- app/views/projects/deployments/_commit.html.haml | 4 +- .../_generic_commit_status.html.haml | 4 +- .../projects/issues/_related_branches.html.haml | 3 +- .../merge_requests/_merge_request.html.haml | 2 +- .../projects/merge_requests/_new_compare.html.haml | 8 +-- .../projects/merge_requests/_new_submit.html.haml | 4 +- .../merge_requests/show/_versions.html.haml | 58 ++++++++++++---------- .../projects/pipeline_schedules/_form.html.haml | 2 +- .../_pipeline_schedule.html.haml | 2 +- app/views/projects/pipelines/_info.html.haml | 6 +-- app/views/projects/pipelines/new.html.haml | 4 +- .../protected_branches/_dropdown.html.haml | 4 +- .../protected_branches/_matching_branch.html.haml | 5 +- .../protected_branches/_protected_branch.html.haml | 5 +- .../projects/protected_branches/show.html.haml | 2 +- .../projects/protected_tags/_dropdown.html.haml | 4 +- .../protected_tags/_matching_tag.html.haml | 5 +- .../protected_tags/_protected_tag.html.haml | 5 +- app/views/projects/protected_tags/show.html.haml | 2 +- app/views/projects/runners/_runner.html.haml | 21 ++++---- app/views/projects/tags/_tag.html.haml | 7 ++- app/views/projects/tags/show.html.haml | 4 +- app/views/shared/_ref_dropdown.html.haml | 2 +- app/views/shared/_ref_switcher.html.haml | 4 +- .../shared/issuable/form/_branch_chooser.html.haml | 4 +- .../unreleased/dm-consistent-commit-sha-style.yml | 4 ++ features/steps/project/builds/artifacts.rb | 2 +- features/steps/project/forked_merge_requests.rb | 33 +----------- .../vue_shared/components/commit_spec.js | 8 +-- .../components/pipelines_table_row_spec.js | 2 +- .../chat_message/pipeline_message_spec.rb | 12 ++--- .../chat_message/push_message_spec.rb | 16 +++--- 78 files changed, 314 insertions(+), 365 deletions(-) delete mode 100644 app/views/projects/commit/_pipeline.html.haml create mode 100644 changelogs/unreleased/dm-consistent-commit-sha-style.yml diff --git a/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js b/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js index 222084deee9..dec1704395e 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js +++ b/app/assets/javascripts/cycle_analytics/components/stage_plan_component.js @@ -33,7 +33,7 @@ global.cycleAnalytics.StagePlanComponent = Vue.extend({ {{ __('FirstPushedBy|First') }} ${iconCommit} - {{ commit.shortSha }} + {{ commit.shortSha }} {{ __('FirstPushedBy|pushed by') }} {{ commit.author.name }} diff --git a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js index b1e9362434f..1f7c673b1d4 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js +++ b/app/assets/javascripts/cycle_analytics/components/stage_staging_component.js @@ -26,9 +26,9 @@ global.cycleAnalytics.StageStagingComponent = Vue.extend({
#{{ build.id }} - {{ build.branch.name }} + {{ build.branch.name }} ${iconBranch} - {{ build.shortSha }} + {{ build.shortSha }}
{{ build.date }} diff --git a/app/assets/javascripts/cycle_analytics/components/stage_test_component.js b/app/assets/javascripts/cycle_analytics/components/stage_test_component.js index e306026429e..78cc97eea0b 100644 --- a/app/assets/javascripts/cycle_analytics/components/stage_test_component.js +++ b/app/assets/javascripts/cycle_analytics/components/stage_test_component.js @@ -29,9 +29,9 @@ global.cycleAnalytics.StageTestComponent = Vue.extend({ · #{{ build.id }} - {{ build.branch.name }} + {{ build.branch.name }} ${iconBranch} - {{ build.shortSha }} + {{ build.shortSha }} diff --git a/app/assets/javascripts/pipelines/components/pipeline_url.js b/app/assets/javascripts/pipelines/components/pipeline_url.js index 4e183d5c8ec..ea8aaca6c9c 100644 --- a/app/assets/javascripts/pipelines/components/pipeline_url.js +++ b/app/assets/javascripts/pipelines/components/pipeline_url.js @@ -29,7 +29,7 @@ export default { + class="js-pipeline-url-api api"> API
- Request to merge - - - into - - - {{mr.targetBranch}} - - + + Request to merge + + + into + + + {{mr.targetBranch}} + + + diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js index d8c27013cd3..517838f92ac 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js @@ -54,6 +54,9 @@ export default { :href="mr.pipeline.path" class="pipeline-id">#{{mr.pipeline.id}} {{mr.pipeline.details.status.label}} + + with {{stageText}}
@@ -70,7 +73,7 @@ export default { for + class="commit-sha js-commit-link"> {{mr.pipeline.commit.short_id}}. {{commitRef.name}}
- {{shortSha}} diff --git a/app/assets/stylesheets/framework/gfm.scss b/app/assets/stylesheets/framework/gfm.scss index c0de09f3968..dbdd5a4464b 100644 --- a/app/assets/stylesheets/framework/gfm.scss +++ b/app/assets/stylesheets/framework/gfm.scss @@ -2,7 +2,7 @@ * Styles that apply to all GFM related forms. */ +.gfm-commit, .gfm-commit_range { - font-family: $monospace_font; - font-size: 90%; + @extend .commit-sha; } diff --git a/app/assets/stylesheets/framework/typography.scss b/app/assets/stylesheets/framework/typography.scss index 96d8a812723..a7c6cbaae21 100644 --- a/app/assets/stylesheets/framework/typography.scss +++ b/app/assets/stylesheets/framework/typography.scss @@ -289,11 +289,6 @@ pre { } } -.monospace { - font-family: $monospace_font; - font-size: 90%; -} - code { &.key-fingerprint { background: $body-bg; @@ -305,6 +300,24 @@ a > code { color: $link-color; } +.monospace { + font-family: $monospace_font; +} + +.commit-sha, +.ref-name { + @extend .monospace; + font-size: 95%; +} + +.git-revision-dropdown-toggle { + @extend .monospace; +} + +.git-revision-dropdown .dropdown-content ul li a { + @extend .ref-name; +} + /** * Apply Markdown typography * diff --git a/app/assets/stylesheets/framework/wells.scss b/app/assets/stylesheets/framework/wells.scss index 32eb750180f..1c1392f8f67 100644 --- a/app/assets/stylesheets/framework/wells.scss +++ b/app/assets/stylesheets/framework/wells.scss @@ -12,10 +12,14 @@ } &.branch-info { - .monospace, + .commit-sha, .commit-info { margin-left: 4px; } + + .ref-name { + font-size: 12px; + } } } diff --git a/app/assets/stylesheets/pages/commits.scss b/app/assets/stylesheets/pages/commits.scss index c8996753809..bb72f453d1b 100644 --- a/app/assets/stylesheets/pages/commits.scss +++ b/app/assets/stylesheets/pages/commits.scss @@ -206,11 +206,11 @@ margin-left: $gl-padding; } } -} -.commit-short-id { - font-family: $monospace_font; - font-weight: 600; + .commit-sha { + font-size: 14px; + font-weight: 600; + } } .commit, @@ -271,7 +271,7 @@ } } - .commit-id { + .commit-sha { color: $gl-link-color; } diff --git a/app/assets/stylesheets/pages/cycle_analytics.scss b/app/assets/stylesheets/pages/cycle_analytics.scss index d29944207c5..7bec4bd5f56 100644 --- a/app/assets/stylesheets/pages/cycle_analytics.scss +++ b/app/assets/stylesheets/pages/cycle_analytics.scss @@ -387,7 +387,7 @@ padding: 0 3px 0 0; } - .branch-name { + .ref-name { color: $black; display: inline-block; max-width: 180px; @@ -398,7 +398,7 @@ vertical-align: top; } - .short-sha { + .commit-sha { color: $gl-link-color; line-height: 1.3; vertical-align: top; diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 0d5c4aed971..cfb1df4df84 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -2,11 +2,6 @@ .diff-file { margin-bottom: $gl-padding; - .commit-short-id { - font-family: $regular_font; - font-weight: 400; - } - .file-title, .file-title-flex-parent { cursor: pointer; diff --git a/app/assets/stylesheets/pages/environments.scss b/app/assets/stylesheets/pages/environments.scss index af991a128f3..a42ae7e55a5 100644 --- a/app/assets/stylesheets/pages/environments.scss +++ b/app/assets/stylesheets/pages/environments.scss @@ -90,7 +90,7 @@ } .build-link, - .branch-name { + .ref-name { color: $gl-text-color; } @@ -135,7 +135,7 @@ } .branch-commit { - .commit-id { + .commit-sha { margin-right: 0; } } diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index d9ba1d4de4d..8f5db1b3b9c 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -156,6 +156,34 @@ text-transform: capitalize; } + .label-branch { + @extend .ref-name; + + color: $gl-text-color; + font-weight: bold; + overflow: hidden; + margin: 0 3px; + word-break: break-all; + + &.label-truncated { + position: relative; + display: inline-block; + width: 250px; + margin-bottom: -3px; + white-space: nowrap; + text-overflow: clip; + line-height: 14px; + + &::after { + position: absolute; + content: '...'; + right: 0; + font-family: $regular_font; + background-color: $gray-light; + } + } + } + .js-deployment-link { display: inline-block; } @@ -355,34 +383,6 @@ } } -.label-branch { - color: $gl-text-color; - font-family: $monospace_font; - font-weight: bold; - overflow: hidden; - font-size: 90%; - margin: 0 3px; - word-break: break-all; - - &.label-truncated { - position: relative; - display: inline-block; - width: 250px; - margin-bottom: -3px; - white-space: nowrap; - text-overflow: clip; - line-height: 14px; - - &::after { - position: absolute; - content: '...'; - right: 0; - font-family: $regular_font; - background-color: $gray-light; - } - } -} - .commits-empty { text-align: center; diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 6d7b7031c30..0600bb1cb1a 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -238,11 +238,6 @@ ul.notes { ul { margin: 3px 0 3px 16px !important; - - .gfm-commit { - font-family: $monospace_font; - font-size: 12px; - } } p:first-child { diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss index 685b9775fe1..e4f5ab26b4d 100644 --- a/app/assets/stylesheets/pages/pipelines.scss +++ b/app/assets/stylesheets/pages/pipelines.scss @@ -158,9 +158,13 @@ float: none; } + .api { + @extend .monospace; + } + .branch-commit { - .branch-name { + .ref-name { font-weight: bold; max-width: 120px; overflow: hidden; @@ -182,7 +186,7 @@ color: $gl-text-color; } - .commit-id { + .commit-sha { color: $gl-link-color; } diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss index c119f0c9b22..ed4a5474034 100644 --- a/app/assets/stylesheets/pages/projects.scss +++ b/app/assets/stylesheets/pages/projects.scss @@ -657,9 +657,8 @@ pre.light-well { color: $gl-text-color; } - .commit_short_id { + .commit-sha { margin-right: 5px; - color: $gl-link-color; font-weight: 600; } @@ -825,7 +824,8 @@ pre.light-well { } .compare-form-group { - .dropdown-menu { + .dropdown-menu, + .inline-input-group { width: 100%; @media (min-width: $screen-sm-min) { @@ -844,14 +844,6 @@ pre.light-well { width: auto; } } - - .inline-input-group { - width: 100%; - - @media (min-width: $screen-sm-min) { - width: 250px; - } - } } .clearable-input { diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb index 97b497a0fed..6d6f1361bf9 100644 --- a/app/helpers/commits_helper.rb +++ b/app/helpers/commits_helper.rb @@ -74,12 +74,8 @@ module CommitsHelper # Returns the sorted alphabetically links to branches, separated by a comma def commit_branches_links(project, branches) branches.sort.map do |branch| - link_to( - namespace_project_tree_path(project.namespace, project, branch) - ) do - content_tag :span, class: 'label label-gray' do - icon('code-fork') + ' ' + branch - end + link_to(project_ref_path(project, branch), class: "label label-gray ref-name") do + icon('code-fork') + " #{branch}" end end.join(" ").html_safe end @@ -88,13 +84,8 @@ module CommitsHelper def commit_tags_links(project, tags) sorted = VersionSorter.rsort(tags) sorted.map do |tag| - link_to( - namespace_project_commits_path(project.namespace, project, - project.repository.find_tag(tag).name) - ) do - content_tag :span, class: 'label label-gray' do - icon('tag') + ' ' + tag - end + link_to(project_ref_path(project, tag), class: "label label-gray ref-name") do + icon('tag') + " #{tag}" end end.join(" ").html_safe end @@ -198,8 +189,8 @@ module CommitsHelper tree_join(commit_sha, diff_new_path)), class: 'btn view-file js-view-file' ) do - raw('View file @') + content_tag(:span, commit_sha[0..6], - class: 'commit-short-id') + raw('View file @ ') + content_tag(:span, Commit.truncate_sha(commit_sha), + class: 'commit-sha') end end diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 63bc3b11b56..4a06ee653ee 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -63,7 +63,7 @@ module DiffHelper def parallel_diff_discussions(left, right, diff_file) return unless @grouped_diff_discussions - + discussions_left = discussions_right = nil if left && (left.unchanged? || left.removed?) @@ -98,7 +98,7 @@ module DiffHelper [ content_tag(:span, link_to(truncate(blob.name, length: 40), tree)), '@', - content_tag(:span, commit_id, class: 'monospace') + content_tag(:span, commit_id, class: 'commit-sha') ].join(' ').html_safe end diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb index c14438da281..751d61955b7 100644 --- a/app/helpers/events_helper.rb +++ b/app/helpers/events_helper.rb @@ -164,9 +164,14 @@ module EventsHelper def event_note_title_html(event) if event.note_target - link_to(event_note_target_path(event), title: event.target_title, class: 'has-tooltip') do - "#{event.note_target_type} #{event.note_target_reference}" - end + text = raw("#{event.note_target_type} ") + + if event.commit_note? + content_tag(:span, event.note_target_reference, class: 'commit-sha') + else + event.note_target_reference + end + + link_to(text, event_note_target_path(event), title: event.target_title, class: 'has-tooltip') else content_tag(:strong, '(deleted)') end diff --git a/app/helpers/gitlab_routing_helper.rb b/app/helpers/gitlab_routing_helper.rb index bcf71bc347b..fc308b3960e 100644 --- a/app/helpers/gitlab_routing_helper.rb +++ b/app/helpers/gitlab_routing_helper.rb @@ -54,6 +54,10 @@ module GitlabRoutingHelper namespace_project_builds_path(project.namespace, project, *args) end + def project_ref_path(project, ref_name, *args) + namespace_project_commits_path(project.namespace, project, ref_name, *args) + end + def project_container_registry_path(project, *args) namespace_project_container_registry_index_path(project.namespace, project, *args) end diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 0ff2d5ce4cd..19286fadb19 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -24,10 +24,13 @@ module TodosHelper end def todo_target_link(todo) - target = todo.target_type.titleize.downcase - link_to "#{target} #{todo.target_reference}", todo_target_path(todo), - class: 'has-tooltip', - title: todo.target.title + text = raw("#{todo.target_type.titleize.downcase} ") + + if todo.for_commit? + content_tag(:span, todo.target_reference, class: 'commit-sha') + else + todo.target_reference + end + link_to text, todo_target_path(todo), class: 'has-tooltip', title: todo.target.title end def todo_target_path(todo) diff --git a/app/models/issue.rb b/app/models/issue.rb index 27e3ed9bc7f..ecfc33ec1a1 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -174,7 +174,7 @@ class Issue < ActiveRecord::Base # Returns boolean if a related branch exists for the current issue # ignores merge requests branchs - def has_related_branch? + def has_related_branch? project.repository.branch_names.any? do |branch| /\A#{iid}-(?!\d+-stable)/i =~ branch end diff --git a/app/models/project_services/chat_message/pipeline_message.rb b/app/models/project_services/chat_message/pipeline_message.rb index 47b68f00cff..3edc395033c 100644 --- a/app/models/project_services/chat_message/pipeline_message.rb +++ b/app/models/project_services/chat_message/pipeline_message.rb @@ -35,7 +35,7 @@ module ChatMessage def activity { - title: "Pipeline #{pipeline_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status}", + title: "Pipeline #{pipeline_link} of #{ref_type} #{branch_link} by #{user_name} #{humanized_status}", subtitle: "in #{project_link}", text: "in #{pretty_duration(duration)}", image: user_avatar || '' @@ -45,7 +45,7 @@ module ChatMessage private def message - "#{project_link}: Pipeline #{pipeline_link} of #{branch_link} #{ref_type} by #{user_name} #{humanized_status} in #{pretty_duration(duration)}" + "#{project_link}: Pipeline #{pipeline_link} of #{ref_type} #{branch_link} by #{user_name} #{humanized_status} in #{pretty_duration(duration)}" end def humanized_status @@ -70,7 +70,7 @@ module ChatMessage end def branch_link - "[#{ref}](#{branch_url})" + "`[#{ref}](#{branch_url})`" end def project_link diff --git a/app/models/project_services/chat_message/push_message.rb b/app/models/project_services/chat_message/push_message.rb index c52dd6ef8ef..04a59d559ca 100644 --- a/app/models/project_services/chat_message/push_message.rb +++ b/app/models/project_services/chat_message/push_message.rb @@ -61,7 +61,7 @@ module ChatMessage end def removed_branch_message - "#{user_name} removed #{ref_type} #{ref} from #{project_link}" + "#{user_name} removed #{ref_type} `#{ref}` from #{project_link}" end def push_message @@ -102,7 +102,7 @@ module ChatMessage end def branch_link - "[#{ref}](#{branch_url})" + "`[#{ref}](#{branch_url})`" end def project_link diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb index 51ad0a3f8ba..ea57cc97a7e 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/pipeline_entity.rb @@ -38,10 +38,7 @@ class PipelineEntity < Grape::Entity expose :path do |pipeline| if pipeline.ref - namespace_project_tree_path( - pipeline.project.namespace, - pipeline.project, - id: pipeline.ref) + project_ref_path(pipeline.project, pipeline.ref) end end diff --git a/app/serializers/request_aware_entity.rb b/app/serializers/request_aware_entity.rb index 3039014aaaa..d53fcfb8c1b 100644 --- a/app/serializers/request_aware_entity.rb +++ b/app/serializers/request_aware_entity.rb @@ -3,6 +3,7 @@ module RequestAwareEntity included do include Gitlab::Routing + include GitlabRoutingHelper include Gitlab::Allowable end diff --git a/app/views/discussions/_discussion.html.haml b/app/views/discussions/_discussion.html.haml index 38e85168f40..74992e439f3 100644 --- a/app/views/discussions/_discussion.html.haml +++ b/app/views/discussions/_discussion.html.haml @@ -26,7 +26,7 @@ - commit = discussion.noteable - if commit commit - = link_to commit.short_id, url, class: 'monospace' + = link_to commit.short_id, url, class: 'commit-sha' - else a deleted commit - elsif discussion.diff_discussion? diff --git a/app/views/events/_commit.html.haml b/app/views/events/_commit.html.haml index 1bc9f604438..3c64f1be5ff 100644 --- a/app/views/events/_commit.html.haml +++ b/app/views/events/_commit.html.haml @@ -1,5 +1,5 @@ %li.commit .commit-row-title - = link_to truncate_sha(commit[:id]), namespace_project_commit_path(project.namespace, project, commit[:id]), class: "commit_short_id", alt: '', title: truncate_sha(commit[:id]) + = link_to truncate_sha(commit[:id]), namespace_project_commit_path(project.namespace, project, commit[:id]), class: "commit-sha", alt: '', title: truncate_sha(commit[:id]) · = markdown event_commit_title(commit[:message]), project: project, pipeline: :single_line, author: event.author diff --git a/app/views/projects/_last_commit.html.haml b/app/views/projects/_last_commit.html.haml index df3b1c75508..d104cc7c1a3 100644 --- a/app/views/projects/_last_commit.html.haml +++ b/app/views/projects/_last_commit.html.haml @@ -5,7 +5,7 @@ = ci_icon_for_status(status) = ci_text_for_status(status) -= 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-sha" = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit), class: "commit-row-message" · #{time_ago_with_tooltip(commit.committed_date)} by diff --git a/app/views/projects/_last_push.html.haml b/app/views/projects/_last_push.html.haml index 768bc1fb323..f8a6e98d280 100644 --- a/app/views/projects/_last_push.html.haml +++ b/app/views/projects/_last_push.html.haml @@ -5,7 +5,7 @@ .event-last-push .event-last-push-text %span You pushed to - = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name) do + = link_to namespace_project_commits_path(event.project.namespace, event.project, event.ref_name, class: 'commit-sha') do %strong= event.ref_name - if @project && event.project != @project %span at diff --git a/app/views/projects/blame/show.html.haml b/app/views/projects/blame/show.html.haml index ae4658d8ca1..a2ec3d44185 100644 --- a/app/views/projects/blame/show.html.haml +++ b/app/views/projects/blame/show.html.haml @@ -22,7 +22,7 @@ %strong = link_to_gfm truncate(commit.title, length: 35), namespace_project_commit_path(@project.namespace, @project, commit.id), class: "cdark" .pull-right - = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "monospace" + = link_to commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit), class: "commit-sha"   .light = commit_author_link(commit, avatar: false) diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 8b35a037c55..304c512e1b5 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -6,7 +6,8 @@ - merge_project = can?(current_user, :create_merge_request, @project) ? @project : (current_user && current_user.fork_of(@project)) %li{ class: "js-branch-#{branch.name}" } %div - = link_to namespace_project_tree_path(@project.namespace, @project, branch.name), class: 'item-title str-truncated' do + = link_to namespace_project_tree_path(@project.namespace, @project, branch.name), class: 'item-title str-truncated ref-name' do + = icon('code-fork') = branch.name   - if branch.name == @repository.root_ref diff --git a/app/views/projects/branches/_commit.html.haml b/app/views/projects/branches/_commit.html.haml index de607772df6..ad8f9da0621 100644 --- a/app/views/projects/branches/_commit.html.haml +++ b/app/views/projects/branches/_commit.html.haml @@ -1,7 +1,7 @@ .branch-commit .icon-container.commit-icon = custom_icon("icon_commit") - = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-id monospace" + = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-sha" · %span.str-truncated = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" diff --git a/app/views/projects/branches/new.html.haml b/app/views/projects/branches/new.html.haml index 55575c5e412..5a0eba3551f 100644 --- a/app/views/projects/branches/new.html.haml +++ b/app/views/projects/branches/new.html.haml @@ -20,7 +20,7 @@ .col-sm-10.create-from .dropdown = hidden_field_tag :ref, default_ref - = button_tag type: 'button', title: default_ref, class: 'dropdown-menu-toggle wide form-control js-branch-select', required: true, data: { toggle: 'dropdown', selected: default_ref, field_name: 'ref' } do + = button_tag type: 'button', title: default_ref, class: 'dropdown-menu-toggle wide form-control js-branch-select git-revision-dropdown-toggle', required: true, data: { toggle: 'dropdown', selected: default_ref, field_name: 'ref' } do .text-left.dropdown-toggle-text= default_ref = icon('chevron-down') = render 'shared/ref_dropdown', dropdown_class: 'wide' diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml index a0f8f105d9a..d4cdb709b97 100644 --- a/app/views/projects/builds/_header.html.haml +++ b/app/views/projects/builds/_header.html.haml @@ -6,18 +6,16 @@ = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title %strong Job - = link_to namespace_project_build_path(@project.namespace, @project, @build), class: 'js-build-id' do - \##{@build.id} + = link_to "##{@build.id}", namespace_project_build_path(@project.namespace, @project, @build), class: 'js-build-id' in pipeline - = link_to pipeline_path(pipeline) do - %strong ##{pipeline.id} - for commit - = link_to namespace_project_commit_path(@project.namespace, @project, pipeline.sha) do - %strong= pipeline.short_sha + %strong + = link_to "##{pipeline.id}", pipeline_path(pipeline) + for + %strong + = link_to pipeline.short_sha, namespace_project_commit_path(@project.namespace, @project, pipeline.sha), class: 'commit-sha' from - = link_to namespace_project_commits_path(@project.namespace, @project, @build.ref) do - %code - = @build.ref + %strong + = link_to @build.ref, project_ref_path(@project, @build.ref), class: 'ref-name' = render "projects/builds/user" if @build.user diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml index c0019996176..e796920ac82 100644 --- a/app/views/projects/ci/builds/_build.html.haml +++ b/app/views/projects/ci/builds/_build.html.haml @@ -23,14 +23,14 @@ - if job.ref .icon-container = job.tag? ? icon('tag') : icon('code-fork') - = link_to job.ref, namespace_project_commits_path(job.project.namespace, job.project, job.ref), class: "monospace branch-name" + = link_to job.ref, project_ref_path(job.project, job.ref), class: "ref-name" - else .light none .icon-container.commit-icon = custom_icon("icon_commit") - if commit_sha - = link_to job.short_sha, namespace_project_commit_path(job.project.namespace, job.project, job.sha), class: "commit-id monospace" + = link_to job.short_sha, namespace_project_commit_path(job.project.namespace, job.project, job.sha), class: "commit-sha" - if job.stuck? = icon('warning', class: 'text-warning has-tooltip', title: 'Job is stuck. Check runners.') @@ -58,7 +58,7 @@ - if pipeline.user = user_avatar(user: pipeline.user, size: 20) - else - %span.monospace API + %span.api API - if admin %td diff --git a/app/views/projects/commit/_commit_box.html.haml b/app/views/projects/commit/_commit_box.html.haml index 64adb70cb81..0aef5822f81 100644 --- a/app/views/projects/commit/_commit_box.html.haml +++ b/app/views/projects/commit/_commit_box.html.haml @@ -1,6 +1,8 @@ .page-content-header .header-main-content - %strong Commit #{@commit.short_id} + %strong + Commit + %span.commit-sha= @commit.short_id = clipboard_button(text: @commit.id, title: "Copy commit SHA to clipboard") %span.hidden-xs authored #{time_ago_with_tooltip(@commit.authored_date)} @@ -57,7 +59,7 @@ = custom_icon("icon_commit") %span.cgray= pluralize(@commit.parents.count, "parent") - @commit.parents.each do |parent| - = link_to parent.short_id, namespace_project_commit_path(@project.namespace, @project, parent), class: "monospace" + = link_to parent.short_id, namespace_project_commit_path(@project.namespace, @project, parent), class: "commit-sha" %span.commit-info.branches %i.fa.fa-spinner.fa-spin @@ -68,9 +70,10 @@ = link_to namespace_project_pipeline_path(@project.namespace, @project, last_pipeline.id) do = ci_icon_for_status(last_pipeline.status) Pipeline - = link_to "##{last_pipeline.id}", namespace_project_pipeline_path(@project.namespace, @project, last_pipeline.id), class: "monospace" + = link_to "##{last_pipeline.id}", namespace_project_pipeline_path(@project.namespace, @project, last_pipeline.id) = ci_label_for_status(last_pipeline.status) - if last_pipeline.stages.any? + with #{"stage".pluralize(last_pipeline.stages.count)} .mr-widget-pipeline-graph = render 'shared/mini_pipeline_graph', pipeline: last_pipeline, klass: 'js-commit-pipeline-graph' in diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml deleted file mode 100644 index 3ee85723ebe..00000000000 --- a/app/views/projects/commit/_pipeline.html.haml +++ /dev/null @@ -1,52 +0,0 @@ -.pipeline-graph-container - .row-content-block.build-content.middle-block.pipeline-actions - .pull-right - - if can?(current_user, :update_pipeline, pipeline.project) - - if pipeline.builds.latest.failed.any?(&:retryable?) - = link_to "Retry", retry_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), class: 'js-retry-button btn btn-grouped btn-primary', method: :post - - - if pipeline.builds.running_or_pending.any? - = link_to "Cancel running", cancel_namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), data: { confirm: 'Are you sure?' }, class: 'btn btn-grouped btn-danger', method: :post - - .oneline.clearfix - - if defined?(pipeline_details) && pipeline_details - Pipeline - = link_to "##{pipeline.id}", namespace_project_pipeline_path(pipeline.project.namespace, pipeline.project, pipeline.id), class: "monospace" - with - = pluralize pipeline.statuses.count(:id), "job" - - if pipeline.ref - for - = link_to pipeline.ref, namespace_project_commits_path(pipeline.project.namespace, pipeline.project, pipeline.ref), class: "monospace" - - if defined?(link_to_commit) && link_to_commit - for commit - = link_to pipeline.short_sha, namespace_project_commit_path(pipeline.project.namespace, pipeline.project, pipeline.sha), class: "monospace" - - if pipeline.duration - in - = time_interval_in_words pipeline.duration - - .row-content-block.build-content.middle-block.js-pipeline-graph.hidden - = render "projects/pipelines/graph", pipeline: pipeline - -- if pipeline.yaml_errors.present? - .bs-callout.bs-callout-danger - %h4 Found errors in your .gitlab-ci.yml: - %ul - - pipeline.yaml_errors.split(",").each do |error| - %li= error - You can also test your .gitlab-ci.yml in the #{link_to "Lint", ci_lint_path} - -- if pipeline.project.builds_enabled? && !pipeline.ci_yaml_file - .bs-callout.bs-callout-warning - \.gitlab-ci.yml not found in this commit - -.table-holder.pipeline-holder - %table.table.ci-table.pipeline - %thead - %tr - %th Status - %th Job ID - %th Name - %th - %th Coverage - %th - = render partial: "projects/stage/stage", collection: pipeline.stages, as: :stage diff --git a/app/views/projects/commit/branches.html.haml b/app/views/projects/commit/branches.html.haml index 2b0c9a4b4de..911c9ddce06 100644 --- a/app/views/projects/commit/branches.html.haml +++ b/app/views/projects/commit/branches.html.haml @@ -1,15 +1,15 @@ -- if @branches.any? - %span - - branch = commit_default_branch(@project, @branches) - = link_to(namespace_project_tree_path(@project.namespace, @project, branch)) do - %span.label.label-gray - = branch - - if @branches.any? || @tags.any? - = link_to("#", class: "js-details-expand") do - %span.label.label-gray - \... +- if @branches.any? || @tags.any? + - branch = commit_default_branch(@project, @branches) + = link_to(project_ref_path(@project, branch), class: "label label-gray ref-name") do + = icon('code-fork') + = branch + + -# `commit_default_branch` deletes the default branch from `@branches`, + -# so only render this if we have more branches left + - if @branches.any? || @tags.any? + %span + = link_to "…", "#", class: "js-details-expand label label-gray" + %span.js-details-content.hide - - if @branches.any? - = commit_branches_links(@project, @branches) - - if @tags.any? - = commit_tags_links(@project, @tags) + = commit_branches_links(@project, @branches) if @branches.any? + = commit_tags_links(@project, @tags) if @tags.any? diff --git a/app/views/projects/commits/_commit.html.haml b/app/views/projects/commits/_commit.html.haml index 24153b8b59a..3350a0ec152 100644 --- a/app/views/projects/commits/_commit.html.haml +++ b/app/views/projects/commits/_commit.html.haml @@ -37,6 +37,6 @@ .commit-actions.flex-row.hidden-xs - if commit.status(ref) = render_commit_status(commit, ref: ref) - = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-short-id btn btn-transparent" + = link_to commit.short_id, namespace_project_commit_path(project.namespace, project, commit), class: "commit-sha btn btn-transparent" = clipboard_button(text: commit.id, title: "Copy commit SHA to clipboard") = link_to_browse_code(project, commit) diff --git a/app/views/projects/commits/_inline_commit.html.haml b/app/views/projects/commits/_inline_commit.html.haml index c03bc3f9df9..5fb89935467 100644 --- a/app/views/projects/commits/_inline_commit.html.haml +++ b/app/views/projects/commits/_inline_commit.html.haml @@ -1,6 +1,6 @@ %li.commit.inline-commit .commit-row-title - = 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-sha"   %span.str-truncated = link_to_gfm commit.title, namespace_project_commit_path(project.namespace, project, commit.id), class: "commit-row-message" diff --git a/app/views/projects/compare/_form.html.haml b/app/views/projects/compare/_form.html.haml index 1f4c9fac54c..adb724c1b8d 100644 --- a/app/views/projects/compare/_form.html.haml +++ b/app/views/projects/compare/_form.html.haml @@ -7,7 +7,7 @@ .input-group.inline-input-group %span.input-group-addon from = hidden_field_tag :from, params[:from] - = button_tag type: 'button', title: params[:from], class: "form-control compare-dropdown-toggle js-compare-dropdown has-tooltip", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-from-dropdown", selected: params[:from], field_name: :from } do + = button_tag type: 'button', title: params[:from], class: "form-control compare-dropdown-toggle js-compare-dropdown has-tooltip git-revision-dropdown-toggle", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-from-dropdown", selected: params[:from], field_name: :from } do .dropdown-toggle-text.str-truncated= params[:from] || 'Select branch/tag' = render 'shared/ref_dropdown' .compare-ellipsis.inline ... @@ -15,7 +15,7 @@ .input-group.inline-input-group %span.input-group-addon to = hidden_field_tag :to, params[:to] - = button_tag type: 'button', title: params[:to], class: "form-control compare-dropdown-toggle js-compare-dropdown has-tooltip", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-to-dropdown", selected: params[:to], field_name: :to } do + = button_tag type: 'button', title: params[:to], class: "form-control compare-dropdown-toggle js-compare-dropdown has-tooltip git-revision-dropdown-toggle", required: true, data: { refs_url: refs_namespace_project_path(@project.namespace, @project), toggle: "dropdown", target: ".js-compare-to-dropdown", selected: params[:to], field_name: :to } do .dropdown-toggle-text.str-truncated= params[:to] || 'Select branch/tag' = render 'shared/ref_dropdown'   diff --git a/app/views/projects/compare/index.html.haml b/app/views/projects/compare/index.html.haml index 45be6581cfc..2cf14859f30 100644 --- a/app/views/projects/compare/index.html.haml +++ b/app/views/projects/compare/index.html.haml @@ -6,10 +6,10 @@ .sub-header-block Compare Git revisions. %br - Fill input field with commit id like - %code.label-branch 4eedf23 + Fill input field with commit SHA like + %code.ref-name 4eedf23 or branch/tag name like - %code.label-branch master + %code.ref-name master and press compare button for the commits list and a code diff. %br Changes are shown from the version in the first field to the version in the second field. diff --git a/app/views/projects/compare/show.html.haml b/app/views/projects/compare/show.html.haml index 0dfc9fe20ed..a1bca2cf83a 100644 --- a/app/views/projects/compare/show.html.haml +++ b/app/views/projects/compare/show.html.haml @@ -16,9 +16,9 @@ There isn't anything to compare. %p.slead - if params[:to] == params[:from] - %span.label-branch= params[:from] + %span.ref-name= params[:from] and - %span.label-branch= params[:to] + %span.ref-name= params[:to] are the same. - else You'll need to use different branch names to get a valid comparison. diff --git a/app/views/projects/deployments/_commit.html.haml b/app/views/projects/deployments/_commit.html.haml index 170d786ecbf..31fd982c522 100644 --- a/app/views/projects/deployments/_commit.html.haml +++ b/app/views/projects/deployments/_commit.html.haml @@ -2,10 +2,10 @@ - if deployment.ref .icon-container = deployment.tag? ? icon('tag') : icon('code-fork') - = link_to deployment.ref, namespace_project_commits_path(@project.namespace, @project, deployment.ref), class: "monospace branch-name" + = link_to deployment.ref, project_ref_path(@project, deployment.ref), class: "ref-name" .icon-container.commit-icon = custom_icon("icon_commit") - = link_to deployment.short_sha, namespace_project_commit_path(@project.namespace, @project, deployment.sha), class: "commit-id monospace" + = link_to deployment.short_sha, namespace_project_commit_path(@project.namespace, @project, deployment.sha), class: "commit-sha" %p.commit-title %span diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml index f458646522c..b23bbadbdb4 100644 --- a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml +++ b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml @@ -27,7 +27,7 @@ = custom_icon("icon_commit") - if commit_sha - = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "commit-id monospace" + = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "commit-sha" - if retried = icon('warning', class: 'text-warning has-tooltip', title: 'Status was retried.') @@ -48,7 +48,7 @@ - if generic_commit_status.pipeline.user = user_avatar(user: generic_commit_status.pipeline.user, size: 20) - else - %span.monospace API + %span.api API - if admin %td diff --git a/app/views/projects/issues/_related_branches.html.haml b/app/views/projects/issues/_related_branches.html.haml index 1892ebb512f..8c9f6f3b4df 100644 --- a/app/views/projects/issues/_related_branches.html.haml +++ b/app/views/projects/issues/_related_branches.html.haml @@ -11,5 +11,4 @@ = render_pipeline_status(pipeline) %span.related-branch-info %strong - = link_to namespace_project_compare_path(@project.namespace, @project, from: @project.default_branch, to: branch), class: "label-branch" do - = branch + = link_to branch, namespace_project_compare_path(@project.namespace, @project, from: @project.default_branch, to: branch), class: "ref-name" diff --git a/app/views/projects/merge_requests/_merge_request.html.haml b/app/views/projects/merge_requests/_merge_request.html.haml index 11b7aaec704..94b9577e9eb 100644 --- a/app/views/projects/merge_requests/_merge_request.html.haml +++ b/app/views/projects/merge_requests/_merge_request.html.haml @@ -37,7 +37,7 @@ by #{link_to_member(@project, merge_request.author, avatar: false)} - if merge_request.target_project.default_branch != merge_request.target_branch   - = link_to namespace_project_commits_path(merge_request.project.namespace, merge_request.project, merge_request.target_branch) do + = link_to project_ref_path(merge_request.project, merge_request.target_branch), class: 'ref-name' do = icon('code-fork') = merge_request.target_branch diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml index 9cf24e10842..0f37abb579c 100644 --- a/app/views/projects/merge_requests/_new_compare.html.haml +++ b/app/views/projects/merge_requests/_new_compare.html.haml @@ -21,8 +21,8 @@ selected: f.object.source_project_id .merge-request-select.dropdown = f.hidden_field :source_branch - = dropdown_toggle f.object.source_branch || "Select source branch", { toggle: "dropdown", field_name: "#{f.object_name}[source_branch]" }, { toggle_class: "js-compare-dropdown js-source-branch" } - .dropdown-menu.dropdown-menu-selectable.dropdown-source-branch + = dropdown_toggle f.object.source_branch || "Select source branch", { toggle: "dropdown", field_name: "#{f.object_name}[source_branch]" }, { toggle_class: "js-compare-dropdown js-source-branch git-revision-dropdown-toggle" } + .dropdown-menu.dropdown-menu-selectable.dropdown-source-branch.git-revision-dropdown = dropdown_title("Select source branch") = dropdown_filter("Search branches") = dropdown_content do @@ -51,8 +51,8 @@ selected: f.object.target_project_id .merge-request-select.dropdown = f.hidden_field :target_branch - = dropdown_toggle f.object.target_branch, { toggle: "dropdown", field_name: "#{f.object_name}[target_branch]" }, { toggle_class: "js-compare-dropdown js-target-branch" } - .dropdown-menu.dropdown-menu-selectable.dropdown-target-branch.js-target-branch-dropdown + = dropdown_toggle f.object.target_branch, { toggle: "dropdown", field_name: "#{f.object_name}[target_branch]" }, { toggle_class: "js-compare-dropdown js-target-branch git-revision-dropdown-toggle" } + .dropdown-menu.dropdown-menu-selectable.dropdown-target-branch.js-target-branch-dropdown.git-revision-dropdown = dropdown_title("Select target branch") = dropdown_filter("Search branches") = dropdown_content do diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml index da79ca2ee75..e3ecbee5490 100644 --- a/app/views/projects/merge_requests/_new_submit.html.haml +++ b/app/views/projects/merge_requests/_new_submit.html.haml @@ -3,9 +3,9 @@ %p.slead - source_title, target_title = format_mr_branch_names(@merge_request) From - %strong.label-branch= source_title + %strong.ref-name= source_title %span into - %strong.label-branch= target_title + %strong.ref-name= target_title %span.pull-right = link_to 'Change branches', mr_change_branches_path(@merge_request) diff --git a/app/views/projects/merge_requests/show/_versions.html.haml b/app/views/projects/merge_requests/show/_versions.html.haml index 11b0c55be0b..37117bc64a3 100644 --- a/app/views/projects/merge_requests/show/_versions.html.haml +++ b/app/views/projects/merge_requests/show/_versions.html.haml @@ -20,25 +20,27 @@ - @merge_request_diffs.each do |merge_request_diff| %li = link_to merge_request_version_path(@project, @merge_request, merge_request_diff, @start_sha), class: ('is-active' if merge_request_diff == @merge_request_diff) do - %strong - - if merge_request_diff.latest? - latest version - - else - version #{version_index(merge_request_diff)} - .monospace= short_sha(merge_request_diff.head_commit_sha) - %small - #{number_with_delimiter(merge_request_diff.commits_count)} #{'commit'.pluralize(merge_request_diff.commits_count)}, - = time_ago_with_tooltip(merge_request_diff.created_at) + %div + %strong + - if merge_request_diff.latest? + latest version + - else + version #{version_index(merge_request_diff)} + %div + %small.commit-sha= short_sha(merge_request_diff.head_commit_sha) + %div + %small + #{number_with_delimiter(merge_request_diff.commits_count)} #{'commit'.pluralize(merge_request_diff.commits_count)}, + = time_ago_with_tooltip(merge_request_diff.created_at) - if @merge_request_diff.base_commit_sha and %span.dropdown.inline.mr-version-compare-dropdown %a.btn.btn-default.dropdown-toggle{ data: {toggle: :dropdown} } - %span - - if @start_version - version #{version_index(@start_version)} - - else - #{@merge_request.target_branch} + - if @start_version + version #{version_index(@start_version)} + - else + %span.ref-name= @merge_request.target_branch = icon('caret-down') .dropdown-menu.dropdown-select.dropdown-menu-selectable .dropdown-title @@ -50,19 +52,25 @@ - @comparable_diffs.each do |merge_request_diff| %li = link_to merge_request_version_path(@project, @merge_request, @merge_request_diff, merge_request_diff.head_commit_sha), class: ('is-active' if merge_request_diff == @start_version) do - %strong - - if merge_request_diff.latest? - latest version - - else - version #{version_index(merge_request_diff)} - .monospace= short_sha(merge_request_diff.head_commit_sha) - %small - = time_ago_with_tooltip(merge_request_diff.created_at) + %div + %strong + - if merge_request_diff.latest? + latest version + - else + version #{version_index(merge_request_diff)} + %div + %small.commit-sha= short_sha(merge_request_diff.head_commit_sha) + %div + %small + = time_ago_with_tooltip(merge_request_diff.created_at) %li = link_to merge_request_version_path(@project, @merge_request, @merge_request_diff), class: ('is-active' unless @start_version) do - %strong - #{@merge_request.target_branch} (base) - .monospace= short_sha(@merge_request_diff.base_commit_sha) + %div + %strong + %span.ref-name= @merge_request.target_branch + (base) + %div + %strong.commit-sha= short_sha(@merge_request_diff.base_commit_sha) - if different_base?(@start_version, @merge_request_diff) .content-block diff --git a/app/views/projects/pipeline_schedules/_form.html.haml b/app/views/projects/pipeline_schedules/_form.html.haml index 4a21cce024e..2d272a93b98 100644 --- a/app/views/projects/pipeline_schedules/_form.html.haml +++ b/app/views/projects/pipeline_schedules/_form.html.haml @@ -19,7 +19,7 @@ .form-group .col-md-6 = f.label :ref, 'Target Branch', class: 'label-light' - = dropdown_tag("Select target branch", options: { toggle_class: 'btn js-target-branch-dropdown', title: "Select target branch", filter: true, placeholder: "Filter", data: { data: @project.repository.branch_names } } ) + = dropdown_tag("Select target branch", options: { toggle_class: 'btn js-target-branch-dropdown git-revision-dropdown-toggle', dropdown_class: 'git-revision-dropdown', title: "Select target branch", filter: true, placeholder: "Filter", data: { data: @project.repository.branch_names } } ) = f.text_field :ref, value: @schedule.ref, id: 'schedule_ref', class: 'hidden', name: 'schedule[ref]', required: true .form-group .col-md-6 diff --git a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml index 075ecee4343..2cd82e1b661 100644 --- a/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml +++ b/app/views/projects/pipeline_schedules/_pipeline_schedule.html.haml @@ -4,7 +4,7 @@ = pipeline_schedule.description %td.branch-name-cell = icon('code-fork') - = link_to pipeline_schedule.ref, namespace_project_commits_path(@project.namespace, @project, pipeline_schedule.ref), class: "branch-name" + = link_to pipeline_schedule.ref, project_ref_path(@project, pipeline_schedule.ref), class: "ref-name" %td - if pipeline_schedule.last_pipeline .status-icon-container{ class: "ci-status-icon-#{pipeline_schedule.last_pipeline.status}" } diff --git a/app/views/projects/pipelines/_info.html.haml b/app/views/projects/pipelines/_info.html.haml index ab6baaf35b6..8607da8fcdd 100644 --- a/app/views/projects/pipelines/_info.html.haml +++ b/app/views/projects/pipelines/_info.html.haml @@ -30,7 +30,7 @@ = pluralize @pipeline.statuses.count(:id), "job" - if @pipeline.ref from - = link_to @pipeline.ref, namespace_project_commits_path(@project.namespace, @project, @pipeline.ref), class: "monospace" + = link_to @pipeline.ref, project_ref_path(@project, @pipeline.ref), class: "ref-name" - if @pipeline.duration in = time_interval_in_words(@pipeline.duration) @@ -40,10 +40,10 @@ .well-segment.branch-info .icon-container.commit-icon = custom_icon("icon_commit") - = link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @pipeline.sha), class: "monospace js-details-short" + = link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @pipeline.sha), class: "commit-sha js-details-short" = link_to("#", class: "js-details-expand hidden-xs hidden-sm") do %span.text-expander \... %span.js-details-content.hide - = link_to @pipeline.sha, namespace_project_commit_path(@project.namespace, @project, @pipeline.sha), class: "monospace commit-hash-full" + = link_to @pipeline.sha, namespace_project_commit_path(@project.namespace, @project, @pipeline.sha), class: "commit-sha commit-hash-full" = clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard") diff --git a/app/views/projects/pipelines/new.html.haml b/app/views/projects/pipelines/new.html.haml index 14a270a3039..71a8e490c3e 100644 --- a/app/views/projects/pipelines/new.html.haml +++ b/app/views/projects/pipelines/new.html.haml @@ -11,8 +11,8 @@ .col-sm-10 = hidden_field_tag 'pipeline[ref]', params[:ref] || @project.default_branch = dropdown_tag(params[:ref] || @project.default_branch, - options: { toggle_class: 'js-branch-select wide', - filter: true, dropdown_class: "dropdown-menu-selectable", placeholder: "Search branches", + options: { toggle_class: 'js-branch-select wide git-revision-dropdown-toggle', + filter: true, dropdown_class: "dropdown-menu-selectable git-revision-dropdown", placeholder: "Search branches", data: { selected: params[:ref] || @project.default_branch, field_name: 'pipeline[ref]' } }) .help-block Existing branch name, tag .form-actions diff --git a/app/views/projects/protected_branches/_dropdown.html.haml b/app/views/projects/protected_branches/_dropdown.html.haml index 5af0cc7a2f3..6e9c473494e 100644 --- a/app/views/projects/protected_branches/_dropdown.html.haml +++ b/app/views/projects/protected_branches/_dropdown.html.haml @@ -1,8 +1,8 @@ = f.hidden_field(:name) = dropdown_tag('Select branch or create wildcard', - options: { toggle_class: 'js-protected-branch-select js-filter-submit wide', - filter: true, dropdown_class: "dropdown-menu-selectable", placeholder: "Search protected branches", + options: { toggle_class: 'js-protected-branch-select js-filter-submit wide git-revision-dropdown-toggle', + filter: true, dropdown_class: "dropdown-menu-selectable git-revision-dropdown", placeholder: "Search protected branches", footer_content: true, data: { show_no: true, show_any: true, show_upcoming: true, selected: params[:protected_branch_name], diff --git a/app/views/projects/protected_branches/_matching_branch.html.haml b/app/views/projects/protected_branches/_matching_branch.html.haml index 8a5332ca5bb..27896272733 100644 --- a/app/views/projects/protected_branches/_matching_branch.html.haml +++ b/app/views/projects/protected_branches/_matching_branch.html.haml @@ -1,9 +1,10 @@ %tr %td - = link_to matching_branch.name, namespace_project_tree_path(@project.namespace, @project, matching_branch.name) + = link_to matching_branch.name, project_ref_path(@project, matching_branch.name), class: 'ref-name' + - if @project.root_ref?(matching_branch.name) %span.label.label-info.prepend-left-5 default %td - commit = @project.commit(matching_branch.name) - = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id') + = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha') = time_ago_with_tooltip(commit.committed_date) diff --git a/app/views/projects/protected_branches/_protected_branch.html.haml b/app/views/projects/protected_branches/_protected_branch.html.haml index b2a6b8469a3..0f80de94392 100644 --- a/app/views/projects/protected_branches/_protected_branch.html.haml +++ b/app/views/projects/protected_branches/_protected_branch.html.haml @@ -1,6 +1,7 @@ %tr.js-protected-branch-edit-form{ data: { url: namespace_project_protected_branch_path(@project.namespace, @project, protected_branch) } } %td - = protected_branch.name + %span.ref-name= protected_branch.name + - if @project.root_ref?(protected_branch.name) %span.label.label-info.prepend-left-5 default %td @@ -9,7 +10,7 @@ = link_to pluralize(matching_branches.count, "matching branch"), namespace_project_protected_branch_path(@project.namespace, @project, protected_branch) - else - if commit = protected_branch.commit - = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id') + = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha') = time_ago_with_tooltip(commit.committed_date) - else (branch was removed from repository) diff --git a/app/views/projects/protected_branches/show.html.haml b/app/views/projects/protected_branches/show.html.haml index f8cfe5e4b11..a806a0756ec 100644 --- a/app/views/projects/protected_branches/show.html.haml +++ b/app/views/projects/protected_branches/show.html.haml @@ -2,7 +2,7 @@ .row.prepend-top-default.append-bottom-default .col-lg-3 - %h4.prepend-top-0 + %h4.prepend-top-0.ref-name = @protected_ref.name .col-lg-9 diff --git a/app/views/projects/protected_tags/_dropdown.html.haml b/app/views/projects/protected_tags/_dropdown.html.haml index c50515cfe06..c8531f96f97 100644 --- a/app/views/projects/protected_tags/_dropdown.html.haml +++ b/app/views/projects/protected_tags/_dropdown.html.haml @@ -1,8 +1,8 @@ = f.hidden_field(:name) = dropdown_tag('Select tag or create wildcard', - options: { toggle_class: 'js-protected-tag-select js-filter-submit wide', - filter: true, dropdown_class: "dropdown-menu-selectable capitalize-header", placeholder: "Search protected tag", + options: { toggle_class: 'js-protected-tag-select js-filter-submit wide git-revision-dropdown-toggle', + filter: true, dropdown_class: "dropdown-menu-selectable capitalize-header git-revision-dropdown", placeholder: "Search protected tag", footer_content: true, data: { show_no: true, show_any: true, show_upcoming: true, selected: params[:protected_tag_name], diff --git a/app/views/projects/protected_tags/_matching_tag.html.haml b/app/views/projects/protected_tags/_matching_tag.html.haml index 97e5cd6f9d2..f17353df122 100644 --- a/app/views/projects/protected_tags/_matching_tag.html.haml +++ b/app/views/projects/protected_tags/_matching_tag.html.haml @@ -1,9 +1,10 @@ %tr %td - = link_to matching_tag.name, namespace_project_tree_path(@project.namespace, @project, matching_tag.name) + = link_to matching_tag.name, project_ref_path(@project, matching_tag.name), class: 'ref-name' + - if @project.root_ref?(matching_tag.name) %span.label.label-info.prepend-left-5 default %td - commit = @project.commit(matching_tag.name) - = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id') + = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha') = time_ago_with_tooltip(commit.committed_date) diff --git a/app/views/projects/protected_tags/_protected_tag.html.haml b/app/views/projects/protected_tags/_protected_tag.html.haml index 26bd3a1f5ed..54249ec0db1 100644 --- a/app/views/projects/protected_tags/_protected_tag.html.haml +++ b/app/views/projects/protected_tags/_protected_tag.html.haml @@ -1,6 +1,7 @@ %tr.js-protected-tag-edit-form{ data: { url: namespace_project_protected_tag_path(@project.namespace, @project, protected_tag) } } %td - = protected_tag.name + %span.ref-name= protected_tag.name + - if @project.root_ref?(protected_tag.name) %span.label.label-info.prepend-left-5 default %td @@ -9,7 +10,7 @@ = link_to pluralize(matching_tags.count, "matching tag"), namespace_project_protected_tag_path(@project.namespace, @project, protected_tag) - else - if commit = protected_tag.commit - = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit_short_id') + = link_to(commit.short_id, namespace_project_commit_path(@project.namespace, @project, commit.id), class: 'commit-sha') = time_ago_with_tooltip(commit.committed_date) - else (tag was removed from repository) diff --git a/app/views/projects/protected_tags/show.html.haml b/app/views/projects/protected_tags/show.html.haml index 63743f28b3c..94c3612a449 100644 --- a/app/views/projects/protected_tags/show.html.haml +++ b/app/views/projects/protected_tags/show.html.haml @@ -2,7 +2,7 @@ .row.prepend-top-default.append-bottom-default .col-lg-3 - %h4.prepend-top-0 + %h4.prepend-top-0.ref-name = @protected_ref.name .col-lg-9 diff --git a/app/views/projects/runners/_runner.html.haml b/app/views/projects/runners/_runner.html.haml index deeadb609f6..674f87e8220 100644 --- a/app/views/projects/runners/_runner.html.haml +++ b/app/views/projects/runners/_runner.html.haml @@ -1,15 +1,18 @@ %li.runner{ id: dom_id(runner) } %h4 = runner_status_icon(runner) - %span.monospace - - if @project_runners.include?(runner) - = link_to runner.short_sha, runner_path(runner) - - if runner.locked? - = icon('lock', class: 'has-tooltip', title: 'Locked to current projects') - %small - = link_to edit_namespace_project_runner_path(@project.namespace, @project, runner) do - %i.fa.fa-edit.btn - - else + + - if @project_runners.include?(runner) + = link_to runner.short_sha, runner_path(runner), class: 'commit-sha' + + - if runner.locked? + = icon('lock', class: 'has-tooltip', title: 'Locked to current projects') + + %small + = link_to edit_namespace_project_runner_path(@project.namespace, @project, runner) do + %i.fa.fa-edit.btn + - else + %span.commit-sha = runner.short_sha .pull-right diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index 4c4f3655b97..44cb734d7b9 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -2,10 +2,9 @@ - release = @releases.find { |release| release.tag == tag.name } %li.flex-row .row-main-content.str-truncated - = link_to namespace_project_tag_path(@project.namespace, @project, tag.name) do - %span.item-title - = icon('tag') - = tag.name + = link_to namespace_project_tag_path(@project.namespace, @project, tag.name), class: 'item-title ref-name' do + = icon('tag') + = tag.name - if protected_tag?(@project, tag) %span.label.label-success diff --git a/app/views/projects/tags/show.html.haml b/app/views/projects/tags/show.html.haml index e996ae3e4fc..2b81ce4b9fa 100644 --- a/app/views/projects/tags/show.html.haml +++ b/app/views/projects/tags/show.html.haml @@ -6,7 +6,9 @@ .top-area.multi-line .nav-text .title - %span.item-title= @tag.name + %span.item-title.ref-name + = icon('tag') + = @tag.name - if protected_tag?(@project, @tag) %span.label.label-success protected diff --git a/app/views/shared/_ref_dropdown.html.haml b/app/views/shared/_ref_dropdown.html.haml index 96f68c80c48..8b2a3bee407 100644 --- a/app/views/shared/_ref_dropdown.html.haml +++ b/app/views/shared/_ref_dropdown.html.haml @@ -1,6 +1,6 @@ - dropdown_class = local_assigns.fetch(:dropdown_class, '') -.dropdown-menu.dropdown-menu-selectable{ class: dropdown_class } +.dropdown-menu.dropdown-menu-selectable.git-revision-dropdown{ class: dropdown_class } = dropdown_title "Select Git revision" = dropdown_filter "Filter by Git revision" = dropdown_content diff --git a/app/views/shared/_ref_switcher.html.haml b/app/views/shared/_ref_switcher.html.haml index 9a8252ab087..2029eb5824a 100644 --- a/app/views/shared/_ref_switcher.html.haml +++ b/app/views/shared/_ref_switcher.html.haml @@ -6,8 +6,8 @@ - @options && @options.each do |key, value| = hidden_field_tag key, value, id: nil .dropdown - = dropdown_toggle dropdown_toggle_text, { toggle: "dropdown", selected: dropdown_toggle_text, ref: @ref, refs_url: refs_namespace_project_path(@project.namespace, @project), field_name: 'ref', submit_form_on_click: true }, { toggle_class: "js-project-refs-dropdown" } - .dropdown-menu.dropdown-menu-selectable{ class: ("dropdown-menu-align-right" if local_assigns[:align_right]) } + = dropdown_toggle dropdown_toggle_text, { toggle: "dropdown", selected: dropdown_toggle_text, ref: @ref, refs_url: refs_namespace_project_path(@project.namespace, @project), field_name: 'ref', submit_form_on_click: true }, { toggle_class: "js-project-refs-dropdown git-revision-dropdown-toggle" } + .dropdown-menu.dropdown-menu-selectable.git-revision-dropdown{ class: ("dropdown-menu-align-right" if local_assigns[:align_right]) } = dropdown_title "Switch branch/tag" = dropdown_filter "Search branches and tags" = dropdown_content diff --git a/app/views/shared/issuable/form/_branch_chooser.html.haml b/app/views/shared/issuable/form/_branch_chooser.html.haml index f57b4d899ce..203d2adc8db 100644 --- a/app/views/shared/issuable/form/_branch_chooser.html.haml +++ b/app/views/shared/issuable/form/_branch_chooser.html.haml @@ -10,14 +10,14 @@ = form.label :source_branch, class: 'control-label' .col-sm-10 .issuable-form-select-holder - = form.select(:source_branch, [issuable.source_branch], {}, { class: 'source_branch select2', disabled: true }) + = form.select(:source_branch, [issuable.source_branch], {}, { class: 'source_branch select2 ref-name', disabled: true }) .form-group = form.label :target_branch, class: 'control-label' .col-sm-10.target-branch-select-dropdown-container .issuable-form-select-holder = form.select(:target_branch, issuable.target_branches, { include_blank: true }, - { class: 'target_branch js-target-branch-select', + { class: 'target_branch js-target-branch-select ref-name', disabled: issuable.new_record?, data: { placeholder: "Select branch" }}) - if issuable.new_record? diff --git a/changelogs/unreleased/dm-consistent-commit-sha-style.yml b/changelogs/unreleased/dm-consistent-commit-sha-style.yml new file mode 100644 index 00000000000..b6dace34d9b --- /dev/null +++ b/changelogs/unreleased/dm-consistent-commit-sha-style.yml @@ -0,0 +1,4 @@ +--- +title: Consistently use monospace font for commit SHAs and branch and tag names +merge_request: +author: diff --git a/features/steps/project/builds/artifacts.rb b/features/steps/project/builds/artifacts.rb index eec375b0532..89132ff068f 100644 --- a/features/steps/project/builds/artifacts.rb +++ b/features/steps/project/builds/artifacts.rb @@ -25,7 +25,7 @@ class Spinach::Features::ProjectBuildsArtifacts < Spinach::FeatureSteps step 'I should see the build header' do page.within('.build-header') do - expect(page).to have_content "Job ##{@build.id} in pipeline ##{@pipeline.id} for commit #{@pipeline.short_sha}" + expect(page).to have_content "Job ##{@build.id} in pipeline ##{@pipeline.id} for #{@pipeline.short_sha}" end end diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb index 310db6e6dad..29055373a57 100644 --- a/features/steps/project/forked_merge_requests.rb +++ b/features/steps/project/forked_merge_requests.rb @@ -5,6 +5,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps include SharedPaths include Select2Helper include WaitForVueResource + include WaitForAjax step 'I am a member of project "Shop"' do @project = ::Project.find_by(name: "Shop") @@ -47,6 +48,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps first('.dropdown-target-project a', text: @project.path_with_namespace) first('.js-source-branch').click + wait_for_ajax first('.dropdown-source-branch .dropdown-content a', text: 'fix').click click_button "Compare branches and continue" @@ -62,31 +64,6 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps click_button "Submit merge request" end - step 'I follow the target commit link' do - commit = @project.repository.commit - click_link commit.short_id(8) - end - - step 'I should see the commit under the forked from project' do - commit = @project.repository.commit - expect(page).to have_content(commit.message) - end - - step 'I click "Create Merge Request on fork" link' do - click_link "Create Merge Request on fork" - end - - step 'I see prefilled new Merge Request page for the forked project' do - expect(current_path).to eq new_namespace_project_merge_request_path(@forked_project.namespace, @forked_project) - expect(find("#merge_request_source_project_id").value).to eq @forked_project.id.to_s - expect(find("#merge_request_target_project_id").value).to eq @project.id.to_s - expect(find("#merge_request_source_branch").value).to have_content "new_design" - expect(find("#merge_request_target_branch").value).to have_content "master" - expect(find("#merge_request_title").value).to eq "New Design" - verify_commit_link(".mr_target_commit", @project) - verify_commit_link(".mr_source_commit", @forked_project) - end - step 'I update the merge request title' do fill_in "merge_request_title", with: "An Edited Forked Merge Request" end @@ -155,10 +132,4 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps expect(page).to have_content @project.users.first.name end end - - # Verify a link is generated against the correct project - def verify_commit_link(container_div, container_project) - # This should force a wait for the javascript to execute - expect(find(:div, container_div).find(".commit_short_id")['href']).to have_content "#{container_project.path_with_namespace}/commit" - end end diff --git a/spec/javascripts/vue_shared/components/commit_spec.js b/spec/javascripts/vue_shared/components/commit_spec.js index df547299d75..242010ba688 100644 --- a/spec/javascripts/vue_shared/components/commit_spec.js +++ b/spec/javascripts/vue_shared/components/commit_spec.js @@ -61,16 +61,16 @@ describe('Commit component', () => { }); it('should render a link to the ref url', () => { - expect(component.$el.querySelector('.branch-name').getAttribute('href')).toEqual(props.commitRef.ref_url); + expect(component.$el.querySelector('.ref-name').getAttribute('href')).toEqual(props.commitRef.ref_url); }); it('should render the ref name', () => { - expect(component.$el.querySelector('.branch-name').textContent).toContain(props.commitRef.name); + expect(component.$el.querySelector('.ref-name').textContent).toContain(props.commitRef.name); }); it('should render the commit short sha with a link to the commit url', () => { - expect(component.$el.querySelector('.commit-id').getAttribute('href')).toEqual(props.commitUrl); - expect(component.$el.querySelector('.commit-id').textContent).toContain(props.shortSha); + expect(component.$el.querySelector('.commit-sha').getAttribute('href')).toEqual(props.commitUrl); + expect(component.$el.querySelector('.commit-sha').textContent).toContain(props.shortSha); }); it('should render the given commitIconSvg', () => { diff --git a/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js b/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js index 0a2c66e72d7..14280751053 100644 --- a/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js +++ b/spec/javascripts/vue_shared/components/pipelines_table_row_spec.js @@ -89,7 +89,7 @@ describe('Pipelines Table Row', () => { it('should render link to commit', () => { component = buildComponent(pipeline); - const commitLink = component.$el.querySelector('.branch-commit .commit-id'); + const commitLink = component.$el.querySelector('.branch-commit .commit-sha'); expect(commitLink.getAttribute('href')).toEqual(pipeline.commit.commit_path); }); diff --git a/spec/models/project_services/chat_message/pipeline_message_spec.rb b/spec/models/project_services/chat_message/pipeline_message_spec.rb index e005be42b0d..7d2599dc703 100644 --- a/spec/models/project_services/chat_message/pipeline_message_spec.rb +++ b/spec/models/project_services/chat_message/pipeline_message_spec.rb @@ -62,7 +62,7 @@ describe ChatMessage::PipelineMessage do def build_message(status_text = status, name = user[:name]) ":" \ " Pipeline " \ - " of branch" \ + " of branch ``" \ " by #{name} #{status_text} in 02:00:10" end end @@ -81,7 +81,7 @@ describe ChatMessage::PipelineMessage do expect(subject.pretext).to be_empty expect(subject.attachments).to eq(message) expect(subject.activity).to eq({ - title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of [develop](http://example.gitlab.com/commits/develop) branch by hacker passed', + title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by hacker passed', subtitle: 'in [project_name](http://example.gitlab.com)', text: 'in 02:00:10', image: '' @@ -98,7 +98,7 @@ describe ChatMessage::PipelineMessage do expect(subject.pretext).to be_empty expect(subject.attachments).to eq(message) expect(subject.activity).to eq({ - title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of [develop](http://example.gitlab.com/commits/develop) branch by hacker failed', + title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by hacker failed', subtitle: 'in [project_name](http://example.gitlab.com)', text: 'in 02:00:10', image: '' @@ -113,7 +113,7 @@ describe ChatMessage::PipelineMessage do expect(subject.pretext).to be_empty expect(subject.attachments).to eq(message) expect(subject.activity).to eq({ - title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of [develop](http://example.gitlab.com/commits/develop) branch by API failed', + title: 'Pipeline [#123](http://example.gitlab.com/pipelines/123) of branch `[develop](http://example.gitlab.com/commits/develop)` by API failed', subtitle: 'in [project_name](http://example.gitlab.com)', text: 'in 02:00:10', image: '' @@ -125,8 +125,8 @@ describe ChatMessage::PipelineMessage do def build_markdown_message(status_text = status, name = user[:name]) "[project_name](http://example.gitlab.com):" \ " Pipeline [#123](http://example.gitlab.com/pipelines/123)" \ - " of [develop](http://example.gitlab.com/commits/develop)" \ - " branch by #{name} #{status_text} in 02:00:10" + " of branch `[develop](http://example.gitlab.com/commits/develop)`" \ + " by #{name} #{status_text} in 02:00:10" end end end diff --git a/spec/models/project_services/chat_message/push_message_spec.rb b/spec/models/project_services/chat_message/push_message_spec.rb index c794f659c41..e38117b75f6 100644 --- a/spec/models/project_services/chat_message/push_message_spec.rb +++ b/spec/models/project_services/chat_message/push_message_spec.rb @@ -28,7 +28,7 @@ describe ChatMessage::PushMessage, models: true do context 'without markdown' do it 'returns a message regarding pushes' do expect(subject.pretext).to eq( - 'test.user pushed to branch of '\ + 'test.user pushed to branch `` of '\ ' ()') expect(subject.attachments).to eq([{ text: ": message1 - author1\n\n"\ @@ -45,7 +45,7 @@ describe ChatMessage::PushMessage, models: true do it 'returns a message regarding pushes' do expect(subject.pretext).to eq( - 'test.user pushed to branch [master](http://url.com/commits/master) of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))') + 'test.user pushed to branch `[master](http://url.com/commits/master)` of [project_name](http://url.com) ([Compare changes](http://url.com/compare/before...after))') expect(subject.attachments).to eq( "[abcdefgh](http://url1.com): message1 - author1\n\n[12345678](http://url2.com): message2 - author2") expect(subject.activity).to eq({ @@ -74,7 +74,7 @@ describe ChatMessage::PushMessage, models: true do context 'without markdown' do it 'returns a message regarding pushes' do expect(subject.pretext).to eq('test.user pushed new tag ' \ - ' to ' \ + '`` to ' \ '') expect(subject.attachments).to be_empty end @@ -87,7 +87,7 @@ describe ChatMessage::PushMessage, models: true do it 'returns a message regarding pushes' do expect(subject.pretext).to eq( - 'test.user pushed new tag [new_tag](http://url.com/commits/new_tag) to [project_name](http://url.com)') + 'test.user pushed new tag `[new_tag](http://url.com/commits/new_tag)` to [project_name](http://url.com)') expect(subject.attachments).to be_empty expect(subject.activity).to eq({ title: 'test.user created tag', @@ -107,7 +107,7 @@ describe ChatMessage::PushMessage, models: true do context 'without markdown' do it 'returns a message regarding a new branch' do expect(subject.pretext).to eq( - 'test.user pushed new branch to '\ + 'test.user pushed new branch `` to '\ '') expect(subject.attachments).to be_empty end @@ -120,7 +120,7 @@ describe ChatMessage::PushMessage, models: true do it 'returns a message regarding a new branch' do expect(subject.pretext).to eq( - 'test.user pushed new branch [master](http://url.com/commits/master) to [project_name](http://url.com)') + 'test.user pushed new branch `[master](http://url.com/commits/master)` to [project_name](http://url.com)') expect(subject.attachments).to be_empty expect(subject.activity).to eq({ title: 'test.user created branch', @@ -140,7 +140,7 @@ describe ChatMessage::PushMessage, models: true do context 'without markdown' do it 'returns a message regarding a removed branch' do expect(subject.pretext).to eq( - 'test.user removed branch master from ') + 'test.user removed branch `master` from ') expect(subject.attachments).to be_empty end end @@ -152,7 +152,7 @@ describe ChatMessage::PushMessage, models: true do it 'returns a message regarding a removed branch' do expect(subject.pretext).to eq( - 'test.user removed branch master from [project_name](http://url.com)') + 'test.user removed branch `master` from [project_name](http://url.com)') expect(subject.attachments).to be_empty expect(subject.activity).to eq({ title: 'test.user removed branch', -- cgit v1.2.1