Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Can i force links into boxes to open in a new tab

  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 9 months ago #201693 by ritapas
Hello,
i like the new boxes in the homepage a lot.
I've also found a way to tweak the fa icons to have more by changing the db table.

Two of my boxes point to web resources and I would like those to open in a new browser tab.

I believe this could be done in the admin theme but I see it's not straighforward to change its code like it is in survey themes.

Has anybody already done that?

Thank you.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #201709 by tpartner
What LS version? In 3.22.19, creating a box with an external link does open in a new tab.


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Attachments:
The following user(s) said Thank You: DenisChenu, ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 9 months ago #201715 by ritapas
You are right.
My version is 4.2.1 but if i use an absolute link then I get the same icon and it works the way you say.
My links, tough, point to resources inside a single survey so they have got relative links.
So, unless there is a better way, I'll have to point to the internal resource via an absolute link.
Thank you.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 9 months ago #201719 by tpartner
If using a custom admin theme, add something like this to your custom.js file (adjusting "panel-7" as necessary for different boxes):

Code:
$(document).on('ready pjax:scriptcomplete',function(){
 
    if($('.ls-panelboxes').length > 0) {
 
    $('#panel-7').attr('data-bs-target', '_blank');
    $('#panel-7 .panel-body-link').append('&amp;nbsp;<i class="fa fa-external-link"></i>');
    }
});

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 8 months ago #202241 by ritapas
thank you a lot
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 8 months ago #202446 by ritapas
Hello,
I've created a custom.js file with your code and put it inside a js directory inside the custom admin theme.

Its config.xml states as follows:
Code:
<files>
        <css>
            <filename>lime-admin-colors.css</filename>
            <filename>statistics.css</filename>
        </css>
 
        <js>custom.js</js>
...

anyway the custom.js script file is not loaded.

Any hint?

Thank you again.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #202454 by tpartner

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 8 months ago - 3 years 8 months ago #202464 by ritapas

tpartner wrote: Your XML is invalid.

- manual.limesurvey.org/Custom_Admin_Theme...nto_a_custom_theme_2

you mean incomplete?
I just reported the relevant part.
Or is there something else?

Edit: indeed, the js is not loaded in the page
Last edit: 3 years 8 months ago by ritapas.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 8 months ago #202472 by tpartner
Did you look at the XML in the link?

You have not included the <filename> tag.


Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: ritapas
The topic has been locked.
  • ritapas
  • ritapas's Avatar Topic Author
  • Away
  • Elite Member
  • Elite Member
More
3 years 8 months ago #202474 by ritapas
Oh my, you are right. Sorry!
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose