I think it would be nice if the Previous and Next links in the Image Navigator would disappear if there's only one image in the gallery.
I think it would be nice if the Previous and Next links in the Image Navigator would disappear if there's only one image in the gallery.
Comments
Comment #1
kmontyGood catch.
Comment #2
designwork commentedHi kmoty,
the navigator is themed in the theme_gallery_image_navigator. Just see if the navigator total is smaller or equal 1 and in this case we return an empty $col2.
See the attached code it should work.
code is running here: http://photographer.freelens.ws
Dirk
Comment #3
dbeall commentedTested this, works fine
Comment #4
dbeall commentedmaybe dress it up a bit with this,,
Comment #5
dbeall commentedmight as well post what I'm running if any one likes it.. I have been fixing the previous/next links every time I download it..
EDIT: this holds the div open too so the 'back to gallery' doesn't go to 2 lines
Comment #6
justintime commenteddbeall, what happens if you have an empty gallery? Does it say "This gallery has only one image."?
Comment #7
dbeall commentedyes, This gallery only has one photo, http://www.davebeall.com/node-gallery/one-image/050181jpg
and
my modified previous next links, http://www.davebeall.com/node-gallery/arctic-cat-lake/cat001
Comment #8
justintime commentedYes, but when you have zero, does it tell you that you have one?
Comment #9
designwork commentedon a empty gallery there is no image, so you can not access it. But dbeall why we should say "only one image...", if I can see this in the image count on the left side anyway? For me that sounds obsolet. I would leave it empty.
Cheers
Dirk
Comment #10
justintime commentedAh, gotcha. If you guys work out the specifics, Ill commit the code.
Comment #11
designwork commentedThanks justintime :)
Comment #12
dbeall commentedit's ok with me, leave it blank. It's nice that the prev/next is gone with one image.
The only other thing the text does is hold the div open so the 'back to gallery' stays on one line...
Comment #13
designwork commentedHi dbeall,
we can make the array for (one image) like this: $col2 = array('data' =>t(' '), 'class' => 'image-navigator-mid'); this will probalby hold the div open.
Comment #14
dbeall commentedyes, that does the trick...
@@180
$col2 = array('data' =>t(' '), 'class' => 'image-navigator-mid');
Comment #15
justintime commentedCan someone post the final code? I'll look it over and check it in - but I haven't been following the whole thread, so I don't know what goes and what doesn't. Best if someone involved closely with the issue posts the code.
Comment #16
dbeall commentedI'll leave this up to kmonty or DesignWork, developers know best. The rest of us can edit as needed or wanted.
Comment #17
designwork commentedHi justintime, dbeall
the final code
so we can close this thread :)
Dirk
Comment #18
dbeall commented@maintainers
This is not in the 6.x-2.x-dev Jan 11th download.
I added #17 to the Jan 11th dev and all is well that I can see
Comment #19
dbeall commentedI think this code.. since it is a hidden function
Comment #20
justintime commentedCommitted.
DesignWork, this is very constructive criticism, so please don't take it the wrong way. We appreciate your code, and if you respond to me and say "I don't care about no stinkin' coding standards!", I'll still accept your code and clean it up before I commit it ;-)
The indentation was really messed up in that snippet, and the brackets for the 'else' were kinda funky. Here's the node on the "official" way to format code - http://drupal.org/node/1354. If you use Eclipse as your IDE, I can help you set it up so it does this for you automagically.
Comment #21
designwork commentedHi justintime,
no problem. I use Eclipse yes and just give me a hint how to change indentation settings. The funky else brackets is bad style from me, but I swear I will nerver do this again. (or at least control it before posting).
:)
Dirk
Comment #22
justintime commentedIf you're using Eclipse, check out this node: http://drupal.org/node/75242
Also checkout the PDT templates: http://groups.drupal.org/node/2663#comment-56688
The easiest way to give us code to commit, is to right click the file you've changed, go to Team->Create Patch. Point it at a file, then upload that file to the issue queue.
How are things coming on your CVS application?
Comment #23
designwork commentedHi justintime,
I´m waiting for kmonty to approve:)
Comment #24
justintime commentedAh - he said he was swamped. When I got approved for CVS, I only needed kmonty's approval, and at the time he was co-maintainer (wilson98 was maintainer). I think you'll be okay with just my approval. Give it a shot, and see what happens.
Comment #25
dbeall commentedI was going to make a patch from the supplied code and do some little house cleaning, but I don't want to step on anyone's toes... after all I don't know how to write the stuff.. But I know some of the format and patch generation stuff.. after working with Mickytown2 on project/boost and chasing patches for weeks on end, racing to get stable out before a presentation.
Next time, I will just do it instead of sitting here ringing the bell like a dummy. besides, you guys are busy doing the important stuff.
Comment #26
dbeall commentedactually there is still one item out of format
There is suppose to be a space after the comma for every part of the whatever.. $navigator['prev_nid'],array
Comment #27
justintime commentedHeh, nice catch. Committed.