Image diffing
Review Request #3458 — Created Oct. 25, 2012 and discarded
- Models and views for image diffs - Temporary URL for viewing image diffs Implemented Two-up, Swipe, Onion and Difference views (see file attachments). Supports diffing images of different sizes. Future: Resize images that are too large?
Manually tested on Firefox & Chrome with images of the same size and images of different sizes.
Description | From | Last Updated |
---|---|---|
Two blank lines. |
chipx86 | |
This isn't valid. |
chipx86 | |
Always limit lines to < 80 chars. |
chipx86 | |
Space before = Do you need "new" and "2" ? |
chipx86 | |
Insert alphabetically. |
chipx86 | |
Same. |
chipx86 | |
I'm not sure why you changed this (and I believe it will break other UIs). Why did you namespace these … |
david | |
Must be 2 spaces |
AA aam1r | |
I am not sure if you need a new URL and function for image diffing. It seems like the "diff" … |
AA aam1r | |
Must be 2 spaces |
AA aam1r | |
Small nitpick but I would use 6-digit codes instead of 3 (for the sake of clarity). Writing #FF7777 is much … |
AA aam1r | |
It might be better to use variables for these magic numbers to describe what these values are. The number "12" … |
AA aam1r | |
This breaks pep8 max line length of 79 chars; you can break it down to: orig_file_attachment = get_object_or_404(FileAttachment, pk=orig_file_attachment_id) new_file_attachment … |
SL slchen | |
Should this subclass ImageReviewableModel (imageReviewableModel.js) instead? |
SL slchen | |
Should this subclass ImageReviewableView? |
SL slchen | |
Shouldn't we return the base classe's extra context no matter what? Something like: extra_context = super(ImageReviewUI, self).get_extra_context(request) if self.orig_image: extra_context['orig_image'] … |
SM smacleod | |
For all of these rules in here - I think we have a pattern in here we we alphabetically order … |
mike_conley | |
Nit: indented too far. |
mike_conley | |
You put documentation on the two functions above - you should do it for the rest of these as well. |
mike_conley | |
The formatting here looks a bit off - I think this needs to be indented more. |
mike_conley | |
Same as above. |
mike_conley | |
Nice use of promises. :) |
mike_conley | |
Nit - indentation |
mike_conley | |
Nit - indentation - plus, I think it needs a newline afterwards. |
mike_conley | |
Needs var |
mike_conley | |
Setting .src on an Image is asynchronous. I don't think you can trust that .width and .height is available on … |
mike_conley | |
Same as above wrt the race. |
mike_conley | |
Too much indentation |
mike_conley | |
Just wanted to say...this is a really cool function. |
mike_conley | |
Nit - spaces on either side of the +'s in here. |
mike_conley | |
This should be two lines. self.template_name should be on the same line as render_to_response. |
chipx86 | |
No need for parens. |
chipx86 | |
Can you do "XXX Temp URL ..."? This will show up styled in many editors, making it easier to see, … |
chipx86 | |
Indentation is still off here. |
mike_conley | |
These should probably be top-level. I thought we included a jquery-ui stylesheet. Do we not? |
chipx86 | |
Should inherit from FileAttachmentReviewable. |
chipx86 | |
If we're not doing anythign special here, you can remove this. |
chipx86 | |
This can grow out of control. I'd suggest doing something like; this._$image_diffs.children().hide(); this._$view_modes_list.children().removeClass('active'); |
chipx86 | |
One var statement only, with each variable on its own line. For example: var image_1 = blah, image_2 = blah, … |
chipx86 | |
vars must be declared at the top of a function. (They can be assigned later). In reality, JavaScript moves vars … |
chipx86 | |
Should be: image_frame_2.css({ 'margin-left': blah, 'margin-right': blah }); Same with the ones below. |
chipx86 | |
Align parameters. |
chipx86 | |
Should do: this._$wipe_view .width(...) .height(...); Only reference the element once. You won't need to append "px" when doing this. It'll … |
chipx86 | |
Should be two lines, with the first parameter on the first line. |
chipx86 | |
Use dictionary form: self.blah .css({ opacity: percent, filter: ... }); |
chipx86 | |
Do: this._$onion_view .width(...) .height(...); No "px" |
chipx86 | |
Two lines total. |
chipx86 | |
Why is the text-align an inline style? |
mike_conley |
- Change Summary:
-
2-up view for image diffing. - Modified how extra content is added to the RequestContext - Added CSS and JS for displaying the images
- Branch:
-
image_diffmaster
- Change Summary:
-
WIP for 2-up image diffing cont'd. (Forgot to add the JS and HTML files.)
- Diff:
-
Revision 3 (+175 -1)
- Change Summary:
-
Added menu for switching diff views. Added WIP code for overlayed views.
- Branch:
-
image_diffmaster
- Diff:
-
Revision 4 (+362 -12)
-
-
-
-
I am not sure if you need a new URL and function for image diffing. It seems like the "diff" function in reviews/views.py finds the review request, gets all the diffsets and then uses the most recent one. I am not sure if it can be done but you might be able to do that in the Review UI itself. That would let you cut back the new URL pattern you introduced as well as this function.
-
-
Small nitpick but I would use 6-digit codes instead of 3 (for the sake of clarity). Writing #FF7777 is much more understandable than #FF7. It will also become consistent with all your other color codes (which are all 6-digit)
-
It might be better to use variables for these magic numbers to describe what these values are. The number "12" and "30" are repeated often and using a variable will make it much easier for you to modify these values.
- Change Summary:
-
- Completed Swipe and Onion views (similar to Github). - Fixed existing image diffing views to support images of different sizes. - Cleaned up how widths and heights were being set after images were loaded.
- Diff:
-
Revision 5 (+677 -12)
- Change Summary:
-
- Completed difference blend view (similar to github), with image change percentage
- Testing Done:
-
+ Manually tested on Firefox.
- Branch:
-
masterimage-diff
- Diff:
-
Revision 6 (+775 -12)
- Description:
-
- WIP for image diffing:
- - Models and views for image diffs
~ - Temporary URL for viewing image diffs (nonfunctional)
~ - Temporary URL for viewing image diffs
+ + Implemented Two-up, Swipe, Onion and Difference views (see file attachments).
+ Supports diffing images of different sizes. + + Future: Resize images that are too large?
- Testing Done:
-
~ Manually tested on Firefox.
~ Manually tested on Firefox & Chrome with images of the same size and images of different sizes.
- Branch:
-
image-diffimage_diff
- Change Summary:
-
- Fixes for code reviews - Changed two-up image padding to also used Deferred, and fixed how image dimens were being grabbed
- Branch:
-
image_diffmaster
-
This looks awesome. Any chance you can post screenshots of the different views when the image remains the same size?
-
Shouldn't we return the base classe's extra context no matter what? Something like: extra_context = super(ImageReviewUI, self).get_extra_context(request) if self.orig_image: extra_context['orig_image'] = self.orig_image return extra_context
-
Michelle: This looks *awesome*. I'm really excited to use it. :) -Mike
-
For all of these rules in here - I think we have a pattern in here we we alphabetically order the properties in each rule.
-
-
-
-
-
-
-
-
-
Setting .src on an Image is asynchronous. I don't think you can trust that .width and .height is available on your images until the images have at least started loading. I know that, in this case, you'd be fetching images from the cache, but that's still asynchronous, and you're still going to have a tiny race. You might want to use promises again here.
-
-
-
-
-
-
-
-
Can you do "XXX Temp URL ..."? This will show up styled in many editors, making it easier to see, since this change will probably start off in a pushed branch for now.
-
-
-
-
This can grow out of control. I'd suggest doing something like; this._$image_diffs.children().hide(); this._$view_modes_list.children().removeClass('active');
-
One var statement only, with each variable on its own line. For example: var image_1 = blah, image_2 = blah, image_width_1 = blah;
-
vars must be declared at the top of a function. (They can be assigned later). In reality, JavaScript moves vars under the hood to the top anyway, so this is to reflect it and prevent certain types of problems. Can you go through the rest of the code and make sure the vars behave the correct ways? One var per scope level, defined at the top of the scope.
-
Should be: image_frame_2.css({ 'margin-left': blah, 'margin-right': blah }); Same with the ones below.
-
-
Should do: this._$wipe_view .width(...) .height(...); Only reference the element once. You won't need to append "px" when doing this. It'll handle that itself.
-
-
-
-