sapling/mercurial/templates/static
Gregory Szorc 28b7db089e hgweb: add HTML elements to control whitespace settings for annotate
Building on top of the new URL query string arguments to control
whitespace settings for annotate, this commit adds HTML checkboxes
reflecting the values of these arguments to the paper and gitweb
themes.

The actual diff settings are now exported to the templating layer.
The HTML templates add these as data-* attributes so they are
accessible to the DOM.

A new <form> with various <input> elements is added. The <form>
is initially hidden via CSS. A shared JavaScript function (which
runs after the <form> has been rendered but before the annotate
HTML (because annotate HTML could take a while to load and we want
the form to render quickly) takes care of setting the checked state
of each box from the data-* attributes. It also registers an event
handler to modify the URL and refresh the page whenever the checkbox
state is changed.

I'm using the URLSearchParams interface to perform URL manipulation.
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams tells
me this may not be supported on older web browsers. Yes, apparently
the web API didn't have a standard API to parse and format query
strings until recently. Hence the check for the presence of this
feature in the JavaScript. If the browser doesn't support the
feature, the <form> will remain hidden and behavior will like it
currently is. We could polyfill this feature or implement our own
query string parsing. But I'm lazy and this could be done as a
follow-up if people miss it.

We could certainly expand this feature to support more diff options
(such as lines of context). That's why the potentially reusable code
is stored in a reusable place. It is also certainly possible to
add diff controls to other pages that display diffs. But since
Mozillians are making noise about controlling which revisions
annotate shows, I figured I'd start there.

.. feature::

   Control whitespace settings for annotation on hgweb

   /annotate URLs on hgweb now accept query string arguments to
   influence how whitespace changes impact results.

   The arguments "ignorews," "ignorewsamount," "ignorewseol," and
   "ignoreblanklines" now have the same meaning as their [annotate]
   config section counterparts. Any provided setting overrides the
   server default.

   HTML checkboxes have been added to the paper and gitweb themes
   to expose current whitespace settings and to easily modify the
   current view.

Differential Revision: https://phab.mercurial-scm.org/D850
2017-09-30 09:01:36 +01:00
..
background.png setup: install translation files as package data 2009-12-01 16:06:10 +01:00
coal-file.png setup: install translation files as package data 2009-12-01 16:06:10 +01:00
coal-folder.png setup: install translation files as package data 2009-12-01 16:06:10 +01:00
excanvas.js hgweb: replace excanvas.js with a newer version 2014-04-23 20:23:30 +01:00
feed-icon-14x14.png hgweb: add (Atom) subscribe link to the main paper template pages 2012-12-04 00:41:29 +01:00
followlines.js hgweb: re-implement followlines UI selection using buttons 2017-07-03 13:49:03 +02:00
hgicon.png setup: install translation files as package data 2009-12-01 16:06:10 +01:00
hglogo.png setup: install translation files as package data 2009-12-01 16:06:10 +01:00
mercurial.js hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
style-extra-coal.css coal: reuse style-paper.css and use a separate css file for visual tweaks 2015-09-18 14:03:32 +08:00
style-gitweb.css hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
style-monoblue.css hgweb: avoid line wrap between revision and annotate-info (issue5398) 2016-10-08 19:32:54 +09:00
style-paper.css hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
style.css hgweb: avoid line wrap between revision and annotate-info (issue5398) 2016-10-08 19:32:54 +09:00