Add Logo Link - New Layouts

Hey TB Community-

If you are using the new layouts and want to code a link that would apply to the logo, you can use the following code on the Layout Dashboard’s Javascript tab.
LogoLinkJS

document.querySelector('.tb-logo-items').setAttribute('href', 'login-landing');

NOTE: change the ‘login-landing’ with your page. You can hardcode the entire website address (https://) or use the example above. Leave off the prefex “/” if you want to use a relative link (like in the provided code).

Hope this helps,
Adam

3 Likes

@SafetyUniversity Hi Adam, Do you know if it would be possible for me to store the logo as a record inside a table (for example: tbl_Organisation) and to make it variable to the logged in user?

Yes this is possible. You will need to use the TB Rest API call of “Get a Single Record”. Add a custom response under the “Response” tab. This should be the the field where the logo “lives” (in your case it would be the tbl_Organisation) and you are looking for the URL.

If you are using the Attachments field the format should be: item.field_XXX.0.url. If you are using an old file field it should look like this: item.field_XXX.url

Label the response to something that you will remember.

Next, create a text field in the table you want to pull the Logo URL into (your case would be the Users table).

Then, in table rules use the TB Rest API pipe and following the example in the image below.

Finally, wherever you want to add the logo just insert the field using the Logo URL field in the User’s table. This will work for almost anywhere in an applications since the loggedInUser fields are available most anywhere.

The only caveat is that if the Organisation logo changes but the User doesn’t update their profile, the Logo URL won’t update. What you can do then is use a Scheduled Task daily to run the same Rest API call to update.

If you want to update the URL realtime, then a webhook will be needed to execute the update or add a table rule in the “home” table (e.g. Organization) to update the User field…similar to the process above.

Hope this helps,
Adam

@SafetyUniversity Hi Adam,

Thank you very much for your constructive response, very creative, I appreciate your time. My second thought however was oh no here is yet another new thing i have to learn inorder to perform a simple task for a project that aims to promote standardisation.

I want to share with you something I just noticed 20 mins ago when I opened your message above. Screenshot is ‘as is’ i make no futher comments at this stage.