| |
@@ -140,6 +140,26 @@
|
| |
continue
|
| |
if line.startswith('<div'):
|
| |
line = line.split('<pre style="line-height: 125%">')[1]
|
| |
+ if prequest:
|
| |
+ rangeline = line.partition('font-weight: bold">@@ ')[2] \
|
| |
+ if line.partition('font-weight: bold">@@ ')[1] == \
|
| |
+ 'font-weight: bold">@@ ' else None
|
| |
+ if rangeline:
|
| |
+ rangeline = rangeline.split(' @@</span>')[0]
|
| |
+ linenumber = rangeline.split('+')[1].split(',')[0]
|
| |
+ line = line + ' <a href="%s#_%s" target="_blank" ' % (
|
| |
+ flask.url_for(
|
| |
+ 'view_file',
|
| |
+ repo=prequest.project_from.name,
|
| |
+ username=prequest.project_from.user.username
|
| |
+ if prequest.project_from.is_fork else None,
|
| |
+ namespace=prequest.project_from.namespace,
|
| |
+ identifier=prequest.branch_from,
|
| |
+ filename=filename), linenumber)
|
| |
+ line = line + 'class="open_changed_file_icon_wrap">' + \
|
| |
+ '<span class="oi open_changed_file_icon" ' + \
|
| |
+ 'data-glyph="eye" alt="Open changed file" ' + \
|
| |
+ 'title="Open changed file"></span></a>'
|
| |
output.append('<td class="cell2"><pre>%s</pre></td>' % line)
|
| |
output.append('</tr>')
|
| |
|
| |
When viewing a large diff in a PR, it can be helpful to see the
context of the changes. Display a small icon beside the diff's
changed lines, which when clicked will open the changed file (at
the relevant line number) in a new tab.
Implements ideas from https://pagure.io/pagure/issue/1753