Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show sort buttons if there is more than 1 image in the album. #577

Merged
merged 4 commits into from
Mar 11, 2016
Merged

Only show sort buttons if there is more than 1 image in the album. #577

merged 4 commits into from
Mar 11, 2016

Conversation

virajparimi
Copy link
Contributor

Fixes: #573

Licence: AGPL

Description

Fixes the problem and shows sort button if more than 1 image in album.

Features

Works for images as well as folders.

Tested on

  • Ubuntu 14.04/Chrome

Reviewers

@oparoz

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @oparoz to be a potential reviewer

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

Fixes the problem and shows sort button if more than 1 image in album.

It would be good if you could describe in more details the logic you've used. That way the principles can be validated before the code.

Looking at the code, I see a couple of issues:

  1. The first conditions shows the buttons if there are 0 albums or images
  2. The 2nd conditions allows for 2 elements to be shown on screen

So it seems you need to write more tests in your test plan to try and cover more cases

@virajparimi
Copy link
Contributor Author

@oparoz First condition is pretty trivial to fix. But the second condition is for when 1 folder and 1 image is present. At that time should we show sort buttons or not?

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

when 1 folder and 1 image is present. At that time should we show sort buttons or not?

Yes. Even though it appears that no sorting would be necessary, because all elements can bee seen at once, I have no way of defining from which point it is.
Should people not have the capability to sort less than 5 elements? 3? 10? I don't think we can arbitrarily pick one.

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

Ah and I read the 2nd condition wrong. So, the logic is correct there, but try to combine 1 & 2 if you can.

If we have more than one element -> show buttons

@virajparimi
Copy link
Contributor Author

@oparoz Have a look at this one.

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

That doesn't work if I have 10 images and 0 albums, no? (Add this case to the test plan if it doesn't)

@virajparimi
Copy link
Contributor Author

@oparoz My bad, I missed those conditions. Anyways the new one adds those conditions as well.

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

OK, now try to combine these conditions into 1, if possible.

@virajparimi
Copy link
Contributor Author

@oparoz Have done. Please check. Thanks!

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

I think I have a better idea. Add the number of images and albums and if the sum is greater than one, then show the buttons. What do you think?

@virajparimi
Copy link
Contributor Author

@oparoz 👍 Certainly a good idea, as it decreases the number of redundant comparisions and combines them. Have updated the file.

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

OK about the idea, but have you tested your code? By looking at it, I'd say the way you wrote it doesn't work.

@virajparimi
Copy link
Contributor Author

@oparoz Sorry for the inconvenience.

@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

We all make mistakes :), but that's why I think the test plan is important. It makes it easy to quickly review all cases.

Let me know when you've tested the solution and I'll review it.

@virajparimi
Copy link
Contributor Author

@oparoz I have tested it and as far as I can see there are no errors. I worked with 1 image, then 2 images, similarly for albums and then both of the together.

invalid url fixed

additional fix to infobox

invalid URL fixed

Delete public.js

Update galleryalbum.js

Update galleryinfobox.js

invalid url

Delete public.js

Update gallery.js

Update public.php

Update gallery.js

Update galleryview.js

Update galleryview.js

Update galleryview.js

Update galleryview.js

Update galleryview.js

invalid url fixes

Revert "invalid url fixed"

This reverts commit 34738a0.

Sort buttons fixed

Revert "invalid url fixed"

This reverts commit 34738a0.

Made some minor  changes

Sort buttons issue

Sort buttons issue 2

Sort buttons issue 3

Sort buttons issue 3
This reverts commit 5d8ef96.
@oparoz
Copy link
Contributor

oparoz commented Mar 10, 2016

OK, I'll let you summon some testers ;)

@virajparimi
Copy link
Contributor Author

Ok, @imjalpreet @tahaalibra Need your reviews about this. What do you think?

@tahaalibra
Copy link
Contributor

i think @mbtamuli was working on this. please review...
i will test this and comeback to you

@mbtamuli
Copy link

Everything is working properly. 👍

  • 1 Image.
  • 1 Folder.
  • 1 Image + 1 Folder
  • Multiple Images
  • Multiple Folders
  • Multiple Images + Multiple Folders

@oparoz
Copy link
Contributor

oparoz commented Mar 11, 2016

Thanks @mbtamuli

oparoz added a commit that referenced this pull request Mar 11, 2016
Only show sort buttons if there is more than 1 image in the album.
@oparoz oparoz merged commit 7055f6d into owncloud:master Mar 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants