mysociety / pombola

GNU Affero General Public License v3.0
65 stars 41 forks source link

(?) icon on scorecard does not go to right section of explanation page #317

Closed evdb closed 12 years ago

evdb commented 12 years ago

The fragment does not match an anchor in the text

screenshot

davewhiteland commented 12 years ago

Currently those pages are info pages built in markdown, which doesn't let us trivially put a named anchor into the document.

Js solution would be to add anchors using the text of (e.g.,) h2s on info page load, and then jump -- if there is a # in the URL. A bodge perhaps but invisible to js-enabled users.

davewhiteland commented 12 years ago

Better: can change the info model to automatically add anchor tags to outgoing content by slugging all headings found on the way out (up to h2 for now, which is what the scorecard links are targetting)... no javascript required, all happening server-side.

davewhiteland commented 12 years ago

OK, implemented using django's slugify to make the names (from the title text) -- for generality, applies to all titles. This may be overkill and we could just do h2. This means that either we need to change the links on the scorecard page (which are currently the items' slugs, in an iteration: therefore would be much nicer to leave as is) or we change the h2 titles on the info pages (i.e. the data). I will be doing the latter: specifically, in the info page "Scorecards FAQ" changing these titles:

"Contactability Scorecard FAQs" to "Contactability" "Hansard Appearances Scorecard FAQs" to "Hansard Appearances" "CDF Scorecard FAQs" to "CDF Performance"

davewhiteland commented 12 years ago

done and deployed it's fragile because it depends on the target titles in the data, but that's what you get for linking deep into a dynamic page in the first place, heh.