Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
519642af
Commit
519642af
authored
Jun 14, 2016
by
barthc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix clickable code search results
parent
fe32942f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
app/views/search/results/_blob.html.haml
app/views/search/results/_blob.html.haml
+3
-2
app/views/shared/_file_highlight.html.haml
app/views/shared/_file_highlight.html.haml
+2
-1
No files found.
app/views/search/results/_blob.html.haml
View file @
519642af
...
...
@@ -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
app/views/shared/_file_highlight.html.haml
View file @
519642af
...
...
@@ -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
}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment