Jump to content
MartynKeigher

Attach a URL to a tile

Recommended Posts

Quick and dirty...

 

Add the following code to the top of your home.erb file (add it just before the line).

 

$(function bringToTop() {
 $('li').live('click', function(e){
   var widget = $(this).find('.widget');
   var url = widget.data('link');
   var win = window.open(url, '_blank');
   win.focus();
 });
});

 

Next, add a 'data-link' to your tile's home.erb config with the desired URL you want to go to when you click your tile. Here's an example:

 



 

With this feature added, you can have diff tile's have different URL's attached and you can use LabTech URL Syntax as explained here http://www.labtechgeek.com/forum/viewtopic.php?f=7&t=120 with some of your tiles. I'll let you ponder the possibilities with that for a moment.... ;)

 

and to add... Thanks again to kspooner for pointing me in the right direction with the 'open in new tab' piece of this!!

 

 var win = window.open(url, '_blank');
   win.focus();

 

Regards,

Share this post


Link to post
Share on other sites

I noticed this defaulted all tiles to be clickable... To get around this, I added an if check (below), then in the div, added data-url=1 if I wanted it to be clickable (As well as data-link="http://your-url-here")

 


Share this post


Link to post
Share on other sites
I noticed this defaulted all tiles to be clickable... To get around this, I added an if check (below), then in the div, added data-url=1 if I wanted it to be clickable (As well as data-link="http://your-url-here")

 


 

AWESOME ADDITION!!! I was looking to do that myself but didn't get the time...

 

Thanks so much for posting this! :)

Share this post


Link to post
Share on other sites

This doesnt work (at least with my new build with new code changes). This is the corrected code:

 

$(function bringToTop() {
 $('li').live('click', function(e){
   var widget = $(this).find('.widget');
   if(widget.data('link')){
     var url = widget.data('link');
     var win = window.open(url, '_blank');
     win.focus();
   }
 });
});

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...