diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-12-20 16:37:47 +0300 |
commit | aee0a117a889461ce8ced6fcf73207fe017f1d99 (patch) | |
tree | 891d9ef189227a8445d83f35c1b0fc99573f4380 /app/views/search | |
parent | 8d46af3258650d305f53b819eabf7ab18d22f59e (diff) |
Add latest changes from gitlab-org/gitlab@14-6-stable-eev14.6.0-rc42
Diffstat (limited to 'app/views/search')
-rw-r--r-- | app/views/search/results/_blob.html.haml | 3 | ||||
-rw-r--r-- | app/views/search/results/_blob_data.html.haml | 2 | ||||
-rw-r--r-- | app/views/search/results/_blob_highlight.html.haml | 22 | ||||
-rw-r--r-- | app/views/search/results/_issuable.html.haml | 2 |
4 files changed, 26 insertions, 3 deletions
diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml index aeb37022f99..3681f823ef5 100644 --- a/app/views/search/results/_blob.html.haml +++ b/app/views/search/results/_blob.html.haml @@ -1,5 +1,6 @@ - project = blob.project - return unless project - blob_link = project_blob_path(project, tree_join(repository_ref(project), blob.path)) +- blame_link = project_blame_path(project, tree_join(repository_ref(project), blob.path)) -= render partial: 'search/results/blob_data', locals: { blob: blob, project: project, path: blob.path, blob_link: blob_link } += render partial: 'search/results/blob_data', locals: { blob: blob, project: project, path: blob.path, blob_link: blob_link, blame_link: blame_link } diff --git a/app/views/search/results/_blob_data.html.haml b/app/views/search/results/_blob_data.html.haml index 88a2ab4bb42..c42367f45c5 100644 --- a/app/views/search/results/_blob_data.html.haml +++ b/app/views/search/results/_blob_data.html.haml @@ -9,7 +9,7 @@ - if blob.data - if blob.data.size > 0 .file-content.code.term{ data: { qa_selector: 'file_text_content' } } - = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link, highlight_line: blob.highlight_line + = render 'search/results/blob_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link, blame_link: blame_link, highlight_line: blob.highlight_line - else .file-content.code .nothing-here-block diff --git a/app/views/search/results/_blob_highlight.html.haml b/app/views/search/results/_blob_highlight.html.haml new file mode 100644 index 00000000000..de1fa9a7fd5 --- /dev/null +++ b/app/views/search/results/_blob_highlight.html.haml @@ -0,0 +1,22 @@ +- offset = defined?(first_line_number) ? first_line_number : 1 +- highlight = defined?(highlight_line) && highlight_line ? highlight_line - offset : nil + +#search-blob-content.file-content.code.js-syntax-highlight{ class: 'gl-py-3!' } + - if blob.present? + .blob-content{ data: { blob_id: blob.id, path: blob.path, highlight_line: highlight, qa_selector: 'file_content' } } + - blob.present.highlight.lines.each_with_index do |line, index| + - i = index + offset + .line_holder.code-search-line + .line-numbers + .gl-display-flex + %span.diff-line-num.gl-pl-3 + %a.has-tooltip{ href: "#{blame_link}#L#{i}", id: "blame-L#{i}", 'data-line-number' => i, title: _('View blame') } + = sprite_icon('git') + %span.diff-line-num.flex-grow-1.gl-pr-3 + %a{ href: "#{blob_link}#L#{i}", id: "blob-L#{i}", 'data-line-number' => i, class: 'gl-display-flex! gl-align-items-center gl-justify-content-end' } + = sprite_icon('link', css_class: 'gl-ml-3! gl-mr-1!') + = i + %pre.code.highlight + %code + = line.html_safe + diff --git a/app/views/search/results/_issuable.html.haml b/app/views/search/results/_issuable.html.haml index 41058034d6f..36458a909fc 100644 --- a/app/views/search/results/_issuable.html.haml +++ b/app/views/search/results/_issuable.html.haml @@ -1,7 +1,7 @@ %div{ class: 'search-result-row gl-display-flex gl-sm-flex-direction-row gl-flex-direction-column gl-align-items-center gl-pb-3! gl-mt-5 gl-mb-0!' } .col-sm-9 %span.gl-display-flex.gl-align-items-center - %span.badge.badge-pill.gl-badge.sm{ class: "badge-#{issuable_state_to_badge_class(issuable)}" }= issuable_state_text(issuable) + = gl_badge_tag issuable_state_text(issuable), variant: issuable_state_to_badge_class(issuable), size: :sm = sprite_icon('eye-slash', css_class: 'gl-text-gray-500 gl-ml-2') if issuable.respond_to?(:confidential?) && issuable.confidential? = link_to issuable_path(issuable), data: { track_action: 'click_text', track_label: "#{issuable.class.name.downcase}_title", track_property: 'search_result' }, class: 'gl-w-full' do %span.term.str-truncated.gl-font-weight-bold.gl-ml-2= issuable.title |