]> sipb.mit.edu Git - ikiwiki.git/blob - doc/todo/provide_inline_diffs_in_recentchanges.mdwn
shortcut: Support Wikipedia's form of url-encoding for unicode characters
[ikiwiki.git] / doc / todo / provide_inline_diffs_in_recentchanges.mdwn
1 It would rock if I could view diffs from the web without going via feeds. I envision toggle-style buttons on the recentchanges page, or just links to the CGI, which then displays the diff... --[[madduck]]
2
3 > The diffs are actually there, enabled by the [[plugins/recentchangesdiff]]
4 > plugin, but they are hidden in the XHTML version by the stylesheet.
5 > You might try a user stylesheet with `div.diff { display: block }`.
6 > --[[JasonBlevins]]
7
8 > > couldn't the diff be displayed as a popup? right now it's too bad because the diff is actually in the page, generated and downloaded, but the user can't see it. I have tried to address the issue by adding stuff to the change.tmpl template, but I may be missing something - and it doesn't quite look right:
9 > > 
10 > >     --- /usr/share/ikiwiki/templates/change.tmpl    2011-09-05 15:14:19.000000000 -0400
11 > >     +++ templates/change.tmpl       2011-10-11 13:04:37.704346964 -0400
12 > >     @@ -39,6 +39,7 @@
13 > >      </TMPL_LOOP>
14 > >      </div>
15 > >      <TMPL_IF DIFF>
16 > >     +<a href="#" onClick="document.getElementByClass('diff').style = 'block'">[[show diff|wikiicons/diff.png]]</a>
17 > >      <div class="diff">
18 > >      <pre>
19 > >      <TMPL_VAR DIFF>
20 > > 
21 > > There are a few things wrong with this:
22 > > 
23 > >  1. I don't like the hardcoded javascript in there, we should use [[plugins/toggle]] or something, but i am not sure how to make the this plugin depend on toggle, or if it is desirable. 
24 > >  2. it doesn't work at all: first it doesn't actually "toggle" and second the javascript somehow gets filtered out of the resulting HTML so we don't even see it
25 > >  3. if the diffurl parameter is set in the template, we'd actually see two sets of glasses, which is silly. i tried moving the diff button upwards into the PAGES loop, but there the diffurls are file-specific, which also seem quite silly
26 > > 
27 > > I am looking for guidance on how to improve and fix this now. --[[anarcat]] 2011-10-11
28
29 > > Here is a better implementation:
30 > > [[!format txt """
31 diff -u change.tmpl.orig change.tmpl
32 --- change.tmpl.orig    2012-03-02 23:00:36.706271573 -0500
33 +++ change.tmpl 2012-03-02 23:15:56.083573086 -0500
34 @@ -28,6 +28,9 @@
35  <span class="changedate"><TMPL_VAR COMMITDATE></span>
36  <span class="desc"><br /></span>
37  <TMPL_IF REVERTURL><span class="revert">
38 +<TMPL_IF DIFF>
39 +<a href="#diff-<TMPL_VAR REV>" class="toggle" title="revert" rel="nofollow">[[diff|wikiicons/diff.png]]</a>
40 +</TMPL_IF>
41  <a href="<TMPL_VAR REVERTURL>" title="revert" rel="nofollow">[[revert|wikiicons/revert.png]]</a>
42  </span></TMPL_IF>
43  </div>
44 @@ -39,7 +42,7 @@
45  </TMPL_LOOP>
46  </div>
47  <TMPL_IF DIFF>
48 -<div class="diff">
49 +<div class="toggleable" id="diff-<TMPL_VAR REV>">
50  <pre>
51  <TMPL_VAR DIFF>
52  </pre>
53 """]]
54 > > 
55 > > Unfortunately it has some issues:
56 > > 
57 > > 1. it assumes the toggle.js code is loaded somehow
58 > > 2. if the toggle code isn't loaded the diffs are displayed (which is arguably better than showing nothing since we ship the diff to the UA anyways...)
59 > > 3. it will show only if there's a revert URL, which is backwards, but otherwise the display is weird, with each button on its own line
60 > > 4. if the diffurl parameter is set in the template, we'd actually see two sets of glasses, which is silly. 
61 > >
62 > > -- [[anarcat]] 2012-03-11
63 [[!tag wishlist patch]]