Diffstat (limited to 'ui-diff.c')
| -rw-r--r-- | ui-diff.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -370,12 +370,11 @@ void cgit_print_diff_ctrls(void) { int i, curr; - html("<div class='cgit-panel'>"); - html("<b>diff options</b>"); - html("<form method='get'>"); + html("<form class='diff-ctrls' method='get'>"); /* * Emit the same hidden fields as cgit_add_hidden_formfields(), except - * id/id2, which are carried by the ref-picker selects below. + * id/id2, which are carried by the ref-picker selects below. One + * form wraps both panels so any submission carries all controls. */ if (!ctx.cfg.virtual_root) { struct strbuf url = STRBUF_INIT; @@ -391,6 +390,8 @@ void cgit_print_diff_ctrls(void) if (ctx.qry.showmsg) html_hidden("showmsg", "1"); + html("<div class='cgit-panel'>"); + html("<b>diff refs</b>"); html("<table>"); html("<tr><td colspan='2'/></tr>"); @@ -408,7 +409,22 @@ void cgit_print_diff_ctrls(void) html("<td class='ctrl'>"); cgit_print_ref_select("id", new_ref); html("</td></tr>"); + + html("<tr><td/><td class='ctrl'>"); + cgit_diff_link("flip", "swap from and to", "button", + ctx.qry.head, + is_null_oid(old_rev_oid) ? NULL : + oid_to_hex(old_rev_oid), + new_ref, ctx.qry.path); + html("</td></tr>"); } + html("</table>"); + html("</div>"); + + html("<div class='cgit-panel'>"); + html("<b>diff options</b>"); + html("<table>"); + html("<tr><td colspan='2'/></tr>"); html("<tr>"); html("<td class='label'>context:</td>"); @@ -443,8 +459,8 @@ void cgit_print_diff_ctrls(void) html("<tr><td/><td class='ctrl'>"); html("<noscript><input type='submit' value='reload'/></noscript>"); html("</td></tr></table>"); - html("</form>"); html("</div>"); + html("</form>"); } void cgit_print_diff(const char *new_rev, const char *old_rev, |