WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#11088 closed defect (bug) (fixed)

Revision comparision should allow reverse diffs

Reported by: filosofo Owned by: ryan
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.9
Component: Revisions Keywords: revision wp-diff has-patch tested
Focuses: Cc:

Description

It doesn't make sense to have left and right radio buttons to compare revisions, if you can compare them only in one direction---from oldest to newest.

Instead we need either to:

  • allow reverse diffs
  • have one column of radio buttons, to take away the illusion of being able to have reverse diffs

Patch takes out the code that disallows reverse diffs.

Attachments (3)

allow_reverse_diffs.11088.diff (659 bytes) - added by filosofo 4 years ago.
better_diff_ui.11088.diff (2.3 KB) - added by filosofo 4 years ago.
better_diff_ui-separate-js.11088.diff (3.6 KB) - added by filosofo 4 years ago.

Download all attachments as: .zip

Change History (13)

comment:1 follow-up: mdawaffe4 years ago

What's the value in allowing reverse diffs?

With the current UI for the diffs, left is always older, right in always newer, red is always removed, and green is always added. Allowing reverse diffs takes away that consistency.

How do you see a one column of radio buttons UI working out?

We could do it the way mediawiki does it: two columns of radio buttons, but only show the ones that are "legal". Click around on the radio buttons http://en.wikipedia.org/w/index.php?title=Main_Page&action=history to see what I mean.

comment:2 in reply to: ↑ 1 ; follow-up: filosofo4 years ago

Replying to mdawaffe:

What's the value in allowing reverse diffs?

I can't think of any, but the current UI gives you the impression that you can do it.

With the current UI for the diffs, left is always older, right in always newer, red is always removed, and green is always added. Allowing reverse diffs takes away that consistency.

OK, agreed.

How do you see a one column of radio buttons UI working out?

You just have the one column of radios, and you select the two that you want to compare. It's straightforward. We could even leave in Matt's easter egg for the case in which someone just has one radio checked.

We could do it the way mediawiki does it: two columns of radio buttons, but only show the ones that are "legal". Click around on the radio buttons http://en.wikipedia.org/w/index.php?title=Main_Page&action=history to see what I mean.

That's fine, too, but just involves more work. And if it's like MediaWiki's Matt's easter egg won't be possible. :-)

comment:3 in reply to: ↑ 2 ; follow-up: mdawaffe4 years ago

How do you see a one column of radio buttons UI working out?

You just have the one column of radios, and you select the two that you want to compare. It's straightforward. We could even leave in Matt's easter egg for the case in which someone just has one radio checked.

So are they checkboxes not radios? In any given group of radios, you can only select one of them. So if they're radios, they all have to have different name attributes. If they're radios (with different name attributes) or checkboxes, we'll still need some JS to make sure you can only select 2.

The 2 column approach makes sense to me because I'm supposed to check two things. Maybe the column headers should be clearer?

Compare   Date Created    Author   ...
Old New
 o   o    5th Nov         admin
 o   o    3rd Nov         admin
...

comment:4 in reply to: ↑ 3 filosofo4 years ago

Replying to mdawaffe:

The 2 column approach makes sense to me because I'm supposed to check two things. Maybe the column headers should be clearer?

OK, I suppose it's better to go with what people are familiar with thanks to MediaWiki. I'll make a patch to that effect.

comment:5 follow-up: filosofo4 years ago

  • Keywords tested added

I've added a patch, better_diff_ui.11088.diff, which incorporates mdawaffe's suggestions and allows users to select only forwards comparisons, just like MediaWiki.

With one exception: you can still compare a revision to itself, so you can get your easter egg jollies.

Tested in IE 6-8, Safari, Chrome, Opera, and Firefox.

comment:6 ryan4 years ago

  • Milestone changed from 2.9 to 3.0

comment:7 mattrude4 years ago

  • Cc m@… added

comment:8 in reply to: ↑ 5 westi4 years ago

  • Cc westi added
  • Keywords needs-patch added; has-patch tested removed

Replying to filosofo:

I've added a patch, better_diff_ui.11088.diff, which incorporates mdawaffe's suggestions and allows users to select only forwards comparisons, just like MediaWiki.

With one exception: you can still compare a revision to itself, so you can get your easter egg jollies.

Tested in IE 6-8, Safari, Chrome, Opera, and Firefox.

This looks good.

Could you update the patch to avoid having inline js there.

I guess we need a new js file in wp-includes/js for this which we would then enqueue on the relevant admin page and a theme/plugin could enqueue on the front end if they were displaying this bit of ui for something like a wiki theme.

comment:9 filosofo4 years ago

  • Keywords has-patch tested added; needs-patch removed

I've added patch better_diff_ui-separate-js.11088.diff, which puts the js in a separate file and enqueues it on the revisions page.

Tested with the same batch o' browsers.

comment:10 westi4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [12500]) Improve the revision comparison user interface to hilight that we compare "old on left" to "new on right". Includes some js to hide the radio buttons to stop you selecting reverse comparisions.
Fixes #11088 props filosofo.

Note: See TracTickets for help on using tickets.