Mercurial > kallithea
changeset 8580:4bf9d7f18253
diff: fix ignorews/context link to use the right target as anchor
The value in url_fid might not be a valid anchor.
For changesets, url_fid would be like 'C--9c390eb52cd6' even though the actual
target included the changeset hash and were like 'C-1536d03b4869-9c390eb52cd6'.
For pullrequests and compare, it wouldn't link to anything at all, even though
there was a target like 'C--56535da5df40'.
Instead, pass id_fid as anchor value as a separate argument. That one is a
valid anchor.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Thu, 18 Jun 2020 14:25:23 +0200 |
parents | 6f1e25144958 |
children | 5463f4b13fc3 |
files | kallithea/controllers/changeset.py kallithea/templates/changeset/diff_block.html |
diffstat | 2 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py Thu Jun 18 16:08:36 2020 +0200 +++ b/kallithea/controllers/changeset.py Thu Jun 18 14:25:23 2020 +0200 @@ -70,7 +70,7 @@ return ig_ws_global -def _ignorews_url(GET, fileid=None): +def _ignorews_url(GET, fileid=None, anchor=None): fileid = str(fileid) if fileid else None params = defaultdict(list) _update_with_GET(params, GET) @@ -96,7 +96,7 @@ if ln_ctx: params[ctx_key] += [ctx_val] - params['anchor'] = fileid + params['anchor'] = anchor icon = h.literal('<i class="icon-strike"></i>') return h.link_to(icon, h.url.current(**params), title=lbl, **{'data-toggle': 'tooltip'}) @@ -122,7 +122,7 @@ return 3 -def _context_url(GET, fileid=None): +def _context_url(GET, fileid=None, anchor=None): """ Generates url for context lines @@ -156,7 +156,7 @@ lbl = _('Increase diff context to %(num)s lines') % {'num': ln_ctx} - params['anchor'] = fileid + params['anchor'] = anchor icon = h.literal('<i class="icon-sort"></i>') return h.link_to(icon, h.url.current(**params), title=lbl, **{'data-toggle': 'tooltip'})
--- a/kallithea/templates/changeset/diff_block.html Thu Jun 18 16:08:36 2020 +0200 +++ b/kallithea/templates/changeset/diff_block.html Thu Jun 18 14:25:23 2020 +0200 @@ -65,8 +65,8 @@ <i class="icon-diff"></i></a> <a href="${h.url('files_diff_home',repo_name=cs_repo_name,f_path=cs_filename,diff2=cs_rev,diff1=a_rev,diff='download')}" data-toggle="tooltip" title="${_('Download diff for this file')}"> <i class="icon-floppy"></i></a> - ${c.ignorews_url(request.GET, url_fid)} - ${c.context_url(request.GET, url_fid)} + ${c.ignorews_url(request.GET, url_fid, id_fid)} + ${c.context_url(request.GET, url_fid, id_fid)} </div> <div class="pull-right"> ${_('Show inline comments')}