annotate mercurial/templates/paper/filerevision.tmpl @ 31758:04ec317b8128

hgweb: expose a followlines UI in filerevision view In filerevision view (/file/<rev>/<fname>) we add some event listeners on mouse clicks of <span> elements in the <pre class="sourcelines"> block. Those listeners will capture a range of lines selected between two mouse clicks and a box inviting to follow the history of selected lines will then show up. Selected lines (i.e. the block of lines) get a CSS class which make them highlighted. Selection can be cancelled (and restarted) by either clicking on the cancel ("x") button in the invite box or clicking on any other source line. Also clicking twice on the same line will abort the selection and reset event listeners to restart the process. As a first step, this action is only advertised by the "cursor: cell" CSS rule on source lines elements as any other mechanisms would make the code significantly more complicated. This might be improved later. All JavaScript code lives in a new "linerangelog.js" file, sourced in filerevision template (only in "paper" style for now).
author Denis Laxalde <denis.laxalde@logilab.fr>
date Wed, 29 Mar 2017 22:26:16 +0200
parents d53212d70893
children d15c9feb4399
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
1 {header}
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
2 <title>{repo|escape}: {node|short} {file|escape}</title>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
3 </head>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
4 <body>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
5
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
6 <div class="container">
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
7 <div class="menu">
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
8 <div class="logo">
13964
616ad3f6fd33 hgweb: support alternate logo url
Steven Stallion <sstallion@gmail.com>
parents: 13948
diff changeset
9 <a href="{logourl}">
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
10 <img src="{staticurl|urlescape}{logoimg}" alt="mercurial" /></a>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
11 </div>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
12 <ul>
25606
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
13 <li><a href="{url|urlescape}shortlog/{symrev}{sessionvars%urlparameter}">log</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
14 <li><a href="{url|urlescape}graph/{symrev}{sessionvars%urlparameter}">graph</a></li>
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
15 <li><a href="{url|urlescape}tags{sessionvars%urlparameter}">tags</a></li>
21120
9ea9e94c7492 hgweb: fix lack of "bookmarks" link in "/file" page of "paper" style
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 19795
diff changeset
16 <li><a href="{url|urlescape}bookmarks{sessionvars%urlparameter}">bookmarks</a></li>
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
17 <li><a href="{url|urlescape}branches{sessionvars%urlparameter}">branches</a></li>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
18 </ul>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
19 <ul>
25606
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
20 <li><a href="{url|urlescape}rev/{symrev}{sessionvars%urlparameter}">changeset</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
21 <li><a href="{url|urlescape}file/{symrev}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
22 </ul>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
23 <ul>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
24 <li class="active">file</li>
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
25 <li><a href="{url|urlescape}file/tip/{file|urlescape}{sessionvars%urlparameter}">latest</a></li>
25606
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
26 <li><a href="{url|urlescape}diff/{symrev}/{file|urlescape}{sessionvars%urlparameter}">diff</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
27 <li><a href="{url|urlescape}comparison/{symrev}/{file|urlescape}{sessionvars%urlparameter}">comparison</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
28 <li><a href="{url|urlescape}annotate/{symrev}/{file|urlescape}{sessionvars%urlparameter}">annotate</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
29 <li><a href="{url|urlescape}log/{symrev}/{file|urlescape}{sessionvars%urlparameter}">file log</a></li>
3bb6f5f478a7 hgweb: don't dereference symbolic revision in paper & coal style (issue2296)
Anton Shestakov <av6@dwimlabs.net>
parents: 25133
diff changeset
30 <li><a href="{url|urlescape}raw-file/{symrev}/{file|urlescape}">raw</a></li>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
31 </ul>
12680
d664547ef540 hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents: 9999
diff changeset
32 <ul>
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
33 <li><a href="{url|urlescape}help{sessionvars%urlparameter}">help</a></li>
12680
d664547ef540 hgweb: add help link to templates missed in ead4e21f49f1
Augie Fackler <durin42@gmail.com>
parents: 9999
diff changeset
34 </ul>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
35 </div>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
36
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
37 <div class="main">
18258
bebb05a7e249 hgweb: add a "URL breadcrumb" to the index and repository pages
Angel Ezquerra <angel.ezquerra at gmail.com>
parents: 17202
diff changeset
38 <h2 class="breadcrumb"><a href="/">Mercurial</a> {pathdef%breadcrumb}</h2>
25617
63be46407a50 hgweb: link to revision by node hash in paper & coal
Anton Shestakov <av6@dwimlabs.net>
parents: 25606
diff changeset
39 <h3>
63be46407a50 hgweb: link to revision by node hash in paper & coal
Anton Shestakov <av6@dwimlabs.net>
parents: 25606
diff changeset
40 view {file|escape} @ {rev}:<a href="{url|urlescape}rev/{node|short}{sessionvars%urlparameter}">{node|short}</a>
63be46407a50 hgweb: link to revision by node hash in paper & coal
Anton Shestakov <av6@dwimlabs.net>
parents: 25606
diff changeset
41 {branch%changelogbranchname}{tags%changelogtag}{bookmarks%changelogtag}
63be46407a50 hgweb: link to revision by node hash in paper & coal
Anton Shestakov <av6@dwimlabs.net>
parents: 25606
diff changeset
42 </h3>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
43
18526
9409aeaafdc1 hgweb: urlescape all urls, HTML escape repo/tag/branch/... names
Thomas Arendsen Hein <thomas@intevation.de>
parents: 18258
diff changeset
44 <form class="search" action="{url|urlescape}log">
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
45 {sessionvars%hiddenformentry}
7725
6a888d491eaf coal/paper: switch to XHTML 1.1
Benoit Allard <benoit@aeteurope.nl>
parents: 7411
diff changeset
46 <p><input name="rev" id="search1" type="text" size="30" /></p>
19795
ac08ff370977 paper: define searchhint message in map file and use it in other templates
Alexander Plavin <alexander@plav.in>
parents: 19532
diff changeset
47 <div id="hint">{searchhint}</div>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
48 </form>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
49
18628
52305554fd6e hgweb: apply the websub filter to revision descriptions
Angel Ezquerra <angel.ezquerra@gmail.com>
parents: 18526
diff changeset
50 <div class="description">{desc|strip|escape|websub|nonempty}</div>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
51
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
52 <table id="changesetEntry">
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
53 <tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
54 <th class="author">author</th>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
55 <td class="author">{author|obfuscate}</td>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
56 </tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
57 <tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
58 <th class="date">date</th>
15375
fe9d36a6853e hgweb: fix dynamic date calculation not working under Safari
Brodie Rao <brodie@bitheap.org>
parents: 14913
diff changeset
59 <td class="date age">{date|rfc822date}</td>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
60 </tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
61 <tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
62 <th class="author">parents</th>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
63 <td class="author">{parent%filerevparent}</td>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
64 </tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
65 <tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
66 <th class="author">children</th>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
67 <td class="author">{child%filerevchild}</td>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
68 </tr>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
69 </table>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
70
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
71 <div class="overflow">
19430
5ec5097b4c0f hgweb: add line wrapping switch to file source view
Alexander Plavin <me@aplavin.ru>
parents: 19387
diff changeset
72 <div class="sourcefirst linewraptoggle">line wrap: <a class="linewraplink" href="javascript:toggleLinewrap()">on</a></div>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
73 <div class="sourcefirst"> line source</div>
31758
04ec317b8128 hgweb: expose a followlines UI in filerevision view
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 26245
diff changeset
74 <pre class="sourcelines stripes4 wrap bottomline" data-logurl="{url|urlescape}log/{symrev}/{file|urlescape}">{text%fileline}</pre>
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
75 </div>
31758
04ec317b8128 hgweb: expose a followlines UI in filerevision view
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 26245
diff changeset
76
04ec317b8128 hgweb: expose a followlines UI in filerevision view
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 26245
diff changeset
77 <script type="text/javascript" src="{staticurl|urlescape}linerangelog.js"></script>
04ec317b8128 hgweb: expose a followlines UI in filerevision view
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 26245
diff changeset
78
7411
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
79 </div>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
80 </div>
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
81
b71ee3e00e81 coal/paper: move actual templates from coal to paper
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff changeset
82 {footer}