comparison tests/test-hgweb.t @ 34391:6797f1fbc642

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 30 Sep 2017 09:01:36 +0100
parents 875b054e5b95
children b445fc69b86c
comparison
equal deleted inserted replaced
34390:f6492f482c60 34391:6797f1fbc642
338 338
339 static file 339 static file
340 340
341 $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server 341 $ get-with-headers.py --twice localhost:$HGPORT 'static/style-gitweb.css' - date etag server
342 200 Script output follows 342 200 Script output follows
343 content-length: 9007 343 content-length: 9066
344 content-type: text/css 344 content-type: text/css
345 345
346 body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; } 346 body { font-family: sans-serif; font-size: 12px; border:solid #d9d8d1; border-width:1px; margin:10px; background: white; color: black; }
347 a { color:#0000cc; } 347 a { color:#0000cc; }
348 a:hover, a:visited, a:active { color:#880000; } 348 a:hover, a:visited, a:active { color:#880000; }
440 color: #000000; 440 color: #000000;
441 padding: 5px; 441 padding: 5px;
442 } 442 }
443 div.annotate-info a { color: #0000FF; text-decoration: underline; } 443 div.annotate-info a { color: #0000FF; text-decoration: underline; }
444 td.annotate:hover div.annotate-info { display: inline; } 444 td.annotate:hover div.annotate-info { display: inline; }
445
446 #diffopts-form {
447 padding-left: 8px;
448 display: none;
449 }
450
445 .linenr { color:#999999; text-decoration:none } 451 .linenr { color:#999999; text-decoration:none }
446 div.rss_logo { float: right; white-space: nowrap; } 452 div.rss_logo { float: right; white-space: nowrap; }
447 div.rss_logo a { 453 div.rss_logo a {
448 padding:3px 6px; line-height:10px; 454 padding:3px 6px; line-height:10px;
449 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e; 455 border:1px solid; border-color:#fcc7a5 #7d3302 #3e1a01 #ff954e;