[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#835033: debsources: [PATCH] Retain line context on 404s by appending the hash for specific links



Package: qa.debian.org
Severity: minor
User: qa.debian.org@packages.debian.org
Usertags: debsources

Forwarding to the BTS for record keeping.

----- Forwarded message from Chris Lamb <lamby@debian.org> -----

Date: Sun, 21 Aug 2016 11:41:27 +0100
From: Chris Lamb <lamby@debian.org>
To: debian-qa@lists.debian.org
Cc: info@sources.debian.net
Subject: debsources: [PATCH] Retain line context on 404s by appending the hash for specific links
Message-Id: <[🔎] 1471776087.3092845.701483073.410A5421@webmail.messagingengine.com>

Hi,

Attached is the following:

  commit a0a47c965d364fb41d1b0fde2480252a9c328479
  Author: Chris Lamb <lamby@debian.org>
  Date:   Sun Aug 21 11:39:25 2016 +0100
  
      Retain line context on 404s by appending the hash for specific links
      
      Signed-off-by: Chris Lamb <lamby@debian.org>
  
   debsources/app/sources/templates/sources/404_suggestions.html | 2 +-
   debsources/app/templates/footer.inc.html                      | 8 ++++++++
   2 files changed, 9 insertions(+), 1 deletion(-)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-

>From a0a47c965d364fb41d1b0fde2480252a9c328479 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Sun, 21 Aug 2016 11:39:25 +0100
Subject: [PATCH] Retain line context on 404s by appending the hash for
 specific links

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 debsources/app/sources/templates/sources/404_suggestions.html | 2 +-
 debsources/app/templates/footer.inc.html                      | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/debsources/app/sources/templates/sources/404_suggestions.html b/debsources/app/sources/templates/sources/404_suggestions.html
index bf4609e..f1127f7 100644
--- a/debsources/app/sources/templates/sources/404_suggestions.html
+++ b/debsources/app/sources/templates/sources/404_suggestions.html
@@ -11,7 +11,7 @@ The file you are looking for might exist in one of the following
 versions:
 <ul>
 {% for s in suggestions %}
-  <li><a href="{{ url_for('.source', path_to=s) }}">{{ s }}</a></li>
+  <li><a href="{{ url_for('.source', path_to=s) }}" class="js-append-window-location-hash">{{ s }}</a></li>
 {% endfor %}
 </ul>
 </p>
diff --git a/debsources/app/templates/footer.inc.html b/debsources/app/templates/footer.inc.html
index 29d1d14..8636672 100644
--- a/debsources/app/templates/footer.inc.html
+++ b/debsources/app/templates/footer.inc.html
@@ -32,3 +32,11 @@
   Last update: {{ last_update }}.
 </p>
 </div>
+
+<script type="text/javascript">
+var elems = document.querySelectorAll('.js-append-window-location-hash');
+
+for (var i = 0; i < elems.length; ++i) {
+  elems[i].setAttribute('href', elems[i].getAttribute('href') + window.location.hash);
+}
+</script>
-- 
2.9.3



----- End forwarded message -----

-- 
Stefano Zacchiroli . zack@upsilon.cc . upsilon.cc/zack . . o . . . o . o
Computer Science Professor . CTO Software Heritage . . . . . o . . . o o
Former Debian Project Leader . OSI Board Director  . . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »


Reply to: