The module does not appear to work when viewing a picture on the front page. A user has to go to the page of the node and then it works. Is there a way to fix/change this?

I think I explained it right, but just incase...here's a short clip: http://screencast.com/t/OGE5ODhkOWUt

Thanks!
Dan Silver

Comments

amcc’s picture

That was a conscious decision. For a couple of reasons.
Firstly if the image is also a link to the node having dragging functionality as well as clicking (to go to the node) might be confusing
Secondly and more importantly, you want to share a link to the node not your frontpage (i'd have thought). The frontpage on drupal sites often changes regularly, whereas the node URL is the permenant link.

Or are you wanting to share the node link, but from the frontpage.

Let me know what you think though. It's not a hard thing to change, but it would probably need a checkbox to tick on the config page or something like that. I don't want to make it do something the majority don't want.

Dan Silver’s picture

ok...I'm glad that there has been some thought and that this isn't a bug. I agree that it may be confusing if the image is a link and people can drag it.

Somehow, I would love to see some more control over which pictures are dragable and which one's aren't. Your idea for a check box tick is good, but what about something like the blocks page where people type in Drupal paths and a block is displayed there? This way people could type in multiple paths and the dragable pictures wouldn't be limited to nodes or the frontpage. This would be a super flexible solution!

Side note:
I admit that I'm not a great Drupal programer, but I have used it for 2 years now. I also bought the 'Learning Drupal 6' module development book last month and I would love to help out with this module!

amcc’s picture

Ok - so i've got a version working here that has a checkbox to allow you to show drag to share anywhere on the website. With this option checked the Node Types setting gets overruled.

You can narrow down where Drag to Share appears already by using the CSS field. This works in a similar way to blocks, but using CSS instead. This gives you very fine control over which images get 'Drag to Share'd.

I'll commit my changes and you should see them appear tomorrow (if the date is different from 6 March you know its the new version).

As for module development go for it - its very handy when building a site. This is my first module on Drupal.org, but i've made dozens for various sites, mostly just little tweaks to functionality, small blocks etc. My advice is find a very simple module, then pick it apart to see how it works - add bits on etc, but that book is great too. I'd also advice http://www.drupalbook.com/. If you want to help out and have any snippets of code etc then that would be great - post them here or in a new issue if relevant.

amcc’s picture

Category: bug » feature

this has been committed

gjoellee’s picture

On my website, most visitors are not likely to enter the node but rather just browse the front page. Even though they would be sharing the link to the front page, I think the you should include the feature (enable drag to share on the front page). You may chose to not enable this by default, but the option to choose whether you want to enable drag to share on your front page should be there!

amcc’s picture

this has been a feature since march 12 now - go to the 'drag to share' page in site configuration and you'll find a collapsed field called 'Show Drag to Share in non node areas'

Turn this on and it works anywhere - read the instructions there and define tight CSS classes

gjoellee’s picture

oh..thank you. I did not see it.

yannickoo’s picture

Cool but I would think it's better to share the node-page and not the current page.

When I have a view or sth. to display the nodes and drag the image, I can share the current page e.g. /archive/2010/04 but not my node.

If you add this feature "Share the node instead of page" would be very cool.

And what's up with permissions? Anonymous users can't drag the images.

Yannick :-)

yannickoo’s picture

Aaaah now it works for anonymous users:

change drag_to_share.module line 65 to

drupal_add_js($path . "/js/drag_to_share.js", "module", "header");

header instead of footer should help ;)

amcc’s picture

The tricky thing with having drag to share on non node pages is that a bit of js is used to grab the current page URL and use this as the share link. This is exactly what you want on node pages. But on non-node pages (frontpage for example) you want the link URL instead.

It would be great if someone has time to peek into the code and look at this. The php can pass variables into the js to let it know what kind of page it's on. The js could then grab either the current URL or the link depending on page type.

Lee-vit-Over’s picture

May I ask a question? - I have jquery_ui installed and installed 'drag to share', prepared the set-up, yet 'drag to share' doesn't show up at all on any images (using 'img'). Any idea why ? I'm sure I'm doing something wrong, but no idea what. - Thanks.

amcc’s picture

have you chosen what nodes you want it to appear on

Lee-vit-Over’s picture

Hi amcc - yes, I have. First I chose some specific ones, and then I checked the selection for them all. Neither works, and I'm sure it's something I'm doing wrong. - If you'd prefer to keep this off 'issues'... Lee-vit-over@hotmail.com --THANK YOU!

Anonymous’s picture

I prefer more fine grained control over which images get this function and which urls get shared.

Can we have

1. frontpage controls are separate from "non-node"pages
2. detect/select views
3. detect/select imagecache presets
4. choose current page/node url

amcc’s picture

to be honest there isn't going to be any added functionality any time soon, but if you want to build it and share the code feel free