From 519642af7720349f5aec19dc9b620bbb287cc526 Mon Sep 17 00:00:00 2001 From: barthc Date: Tue, 14 Jun 2016 18:57:50 +0100 Subject: fix clickable code search results --- app/views/search/results/_blob.html.haml | 5 +++-- app/views/shared/_file_highlight.html.haml | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/views/search/results/_blob.html.haml b/app/views/search/results/_blob.html.haml index 0fe8a3b490a..b28482f5db1 100644 --- a/app/views/search/results/_blob.html.haml +++ b/app/views/search/results/_blob.html.haml @@ -2,9 +2,10 @@ .blob-result .file-holder .file-title - = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(blob.ref, blob.filename), :anchor => "L" + blob.startline.to_s) do + - blob_path = namespace_project_blob_path(@project.namespace, @project, tree_join(blob.ref, blob.filename)) + = link_to blob_path do %i.fa.fa-file %strong = blob.filename .file-content.code.term - = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline + = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_path: blob_path diff --git a/app/views/shared/_file_highlight.html.haml b/app/views/shared/_file_highlight.html.haml index 37dcf39c062..d9e9078cc1e 100644 --- a/app/views/shared/_file_highlight.html.haml +++ b/app/views/shared/_file_highlight.html.haml @@ -2,11 +2,12 @@ .line-numbers - if blob.data.present? - link_icon = icon('link') + - path = blob_path if defined?(blob_path) - blob.data.each_line.each_with_index do |_, index| - offset = defined?(first_line_number) ? first_line_number : 1 - i = index + offset -# We're not using `link_to` because it is too slow once we get to thousands of lines. - %a.diff-line-num{href: "#L#{i}", id: "L#{i}", 'data-line-number' => i} + %a.diff-line-num{href: "#{path}#L#{i}", id: "L#{i}", 'data-line-number' => i} = link_icon = i .blob-content{data: {blob_id: blob.id}} -- cgit v1.2.1 From 9b777f4187436aed84c52625ca3dbc224f8e3b7a Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 17 Jun 2016 19:05:26 -0500 Subject: Pass dropdown instance to toggleLabel callback --- app/assets/javascripts/gl_dropdown.js.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/gl_dropdown.js.coffee b/app/assets/javascripts/gl_dropdown.js.coffee index b49bd4565a7..3d8c971b447 100644 --- a/app/assets/javascripts/gl_dropdown.js.coffee +++ b/app/assets/javascripts/gl_dropdown.js.coffee @@ -454,7 +454,7 @@ class GitLabDropdown # Toggle the dropdown label if @options.toggleLabel - @updateLabel() + @updateLabel(selectedObject, el, @) else selectedObject else if el.hasClass(INDETERMINATE_CLASS) @@ -481,7 +481,7 @@ class GitLabDropdown # Toggle the dropdown label if @options.toggleLabel - @updateLabel(selectedObject, el) + @updateLabel(selectedObject, el, @) if value? if !field.length and fieldName @addInput(fieldName, value) @@ -580,8 +580,8 @@ class GitLabDropdown # Scroll the dropdown content up $dropdownContent.scrollTop(listItemTop - dropdownContentTop) - updateLabel: (selected = null, el = null) => - $(@el).find(".dropdown-toggle-text").text @options.toggleLabel(selected, el) + updateLabel: (selected = null, el = null, instance = null) => + $(@el).find(".dropdown-toggle-text").text @options.toggleLabel(selected, el, instance) $.fn.glDropdown = (opts) -> return @.each -> -- cgit v1.2.1 From fcfe87510bc6add78a6be291400df7504c84de54 Mon Sep 17 00:00:00 2001 From: Alfredo Sumaran Date: Fri, 17 Jun 2016 19:06:04 -0500 Subject: Update dropdown text accordingly to selected item --- app/assets/javascripts/issue_status_select.js.coffee | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app') diff --git a/app/assets/javascripts/issue_status_select.js.coffee b/app/assets/javascripts/issue_status_select.js.coffee index c5740f27ddd..ed50e2e698f 100644 --- a/app/assets/javascripts/issue_status_select.js.coffee +++ b/app/assets/javascripts/issue_status_select.js.coffee @@ -6,6 +6,13 @@ class @IssueStatusSelect $(el).glDropdown( selectable: true fieldName: fieldName + toggleLabel: (selected, el, instance) => + label = 'Author' + $item = instance.dropdown.find('.is-active') + label = $item.text() if $item.length + label + clicked: (item, $el, e)-> + e.preventDefault() id: (obj, el) -> $(el).data("id") ) -- cgit v1.2.1 From 03a4d6e9a2eef52181a70a68847aa27a2f82dcb2 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 17 Jun 2016 12:58:09 +0100 Subject: Made the search bar on emoji menu sticky --- app/assets/javascripts/awards_handler.coffee | 6 ++++-- app/assets/stylesheets/pages/awards.scss | 21 ++++++++++----------- app/views/emojis/index.html.haml | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/awards_handler.coffee b/app/assets/javascripts/awards_handler.coffee index 030f1564862..37d0adaa625 100644 --- a/app/assets/javascripts/awards_handler.coffee +++ b/app/assets/javascripts/awards_handler.coffee @@ -341,7 +341,9 @@ class @AwardsHandler for emoji in frequentlyUsedEmojis $(".emoji-menu-content [data-emoji='#{emoji}']").closest('li').clone().appendTo(ul) - $('input.emoji-search').after(ul).after($('
').text('Frequently used')) + $('.emoji-menu-content') + .prepend(ul) + .prepend($('
').text('Frequently used')) @frequentEmojiBlockRendered = true @@ -356,7 +358,7 @@ class @AwardsHandler if term # Generate a search result block - h5 = $('
').text('Search results').addClass('emoji-search') + h5 = $('
').text('Search results') found_emojis = @searchEmojis(term).show() ul = $('