sapling/mercurial/templates
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
..
atom hgweb: reindent atom/changelogentry.tmpl 2016-06-29 22:48:32 +08:00
coal coal: use inheritance to derive from paper 2016-08-17 13:43:13 -05:00
gitweb hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
json hgweb: expose list of per-repo labels to templates 2016-06-30 18:59:53 -07:00
monoblue hgweb: consolidate search form for monoblue 2017-06-09 13:41:10 -07:00
paper hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
raw hgweb: replace 'shortlog' with 'changelog' in raw changelog template 2013-08-16 21:41:19 +04:00
rss hgweb: add missing slash to file log url in rss style 2016-12-08 23:59:36 +08:00
spartan hgweb: support Content Security Policy 2017-01-10 23:37:08 -08:00
static hgweb: add HTML elements to control whitespace settings for annotate 2017-09-30 09:01:36 +01:00
map-cmdline.bisect map-cmdline.bisect: rewrite to just %include the default template 2015-05-10 13:48:10 -04:00
map-cmdline.changelog setup: install translation files as package data 2009-12-01 16:06:10 +01:00
map-cmdline.compact compact: add color labels to -Tcompact 2016-04-08 16:05:52 +00:00
map-cmdline.default label: rename log.trouble into log.instability 2017-08-03 15:31:54 +02:00
map-cmdline.phases template-phases: extend default style instead of duplicating it 2015-04-25 21:42:07 +09:00
map-cmdline.show show: pass the minimum length for nodes as a template keyword 2017-08-03 21:51:34 -07:00
map-cmdline.status log: fix status template to list copy source per dest (issue5155) 2016-03-24 22:55:56 +09:00
map-cmdline.xml templater: add new docheader/footer components for XML (issue4135) 2015-08-26 16:27:14 -05:00