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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×