diff options
author | Hiroyuki Sato <sathiroyuki@gmail.com> | 2016-03-09 07:50:34 +0300 |
---|---|---|
committer | Hiroyuki Sato <sathiroyuki@gmail.com> | 2016-03-17 02:58:52 +0300 |
commit | f0b052e16868107e1693e9b3454039420bee1dde (patch) | |
tree | 2fb9af9740f5afa6b7a649b33ba05990f74372a0 /app | |
parent | 374037b8a326b82a7787b2e29da820aa9c4390b3 (diff) |
Fix wiki search results point to raw source
Diffstat (limited to 'app')
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | app/views/search/results/_wiki_blob.html.haml | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 6441cd87e87..e555e97689d 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -758,12 +758,15 @@ class Repository def parse_search_result(result) ref = nil filename = nil + basename = nil startline = 0 result.each_line.each_with_index do |line, index| if line =~ /^.*:.*:\d+:/ ref, filename, startline = line.split(':') startline = startline.to_i - index + extname = File.extname(filename) + basename = filename.sub(/#{extname}$/, '') break end end @@ -776,6 +779,7 @@ class Repository OpenStruct.new( filename: filename, + basename: basename, ref: ref, startline: startline, data: data diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml index f5859481d46..235106c4f74 100644 --- a/app/views/search/results/_wiki_blob.html.haml +++ b/app/views/search/results/_wiki_blob.html.haml @@ -2,9 +2,9 @@ .blob-result .file-holder .file-title - = link_to namespace_project_wiki_path(@project.namespace, @project, wiki_blob.filename) do + = link_to namespace_project_wiki_path(@project.namespace, @project, wiki_blob.basename) do %i.fa.fa-file %strong - = wiki_blob.filename + = wiki_blob.basename .file-content.code.term = render 'shared/file_highlight', blob: wiki_blob, first_line_number: wiki_blob.startline |