pcirella / dynatree

Automatically exported from code.google.com/p/dynatree
0 stars 0 forks source link

Add an 'addHref' Node option #241

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Add an 'addHref' option to Node that inserts an href into the node html when 
loading the tree from JSON. Here is a code snippet example that would achieve 
this:

223     } else {
224 +     var href = data.addHref;
225 +     if (href && href[0] !== '/') {
226 +       href = '/' + href;
227 +     }
228 +     href = data.addHref ? window.location.protocol + '//' +
229 +       window.location.host + href : '#';
230 M     nodeTitle = "<a href='" + href + "' class='" +
231 M       opts.classNames.title + "'" + tooltip + ">" + data.title + "</a>";
232     }

What goal would this enhancement help you achieve?

This would allow the user to follow node links if he right clicks node > 'open 
in new tab', for example.
This also makes it so the node link is shown on the browser's status bar on 
hover, which is nice for usability purposes.

Original issue reported on code.google.com by vitorbal@gmail.com on 24 Oct 2011 at 2:54

GoogleCodeExporter commented 9 years ago
Nice idea.
Why do you think it is important to prepend protocol and host (and port)? I 
would think that relative hrefs would work as well.

Original comment by moo...@wwwendt.de on 25 Oct 2011 at 5:22

GoogleCodeExporter commented 9 years ago
You're right, using just the relative hrefs work as well. I'm not quite sure 
why I did it prepending the stuff...
Anyway, glad you liked the idea :)

Original comment by vitorbal@gmail.com on 31 Oct 2011 at 10:48

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r556.

Original comment by moo...@wwwendt.de on 28 Dec 2011 at 11:19