- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 08:00 AM
I'm working on building my service portal in Helsinki, and am running into an issue when creating icon links that I'd like to open in a new tab. In older SN versions, there was an option to select how you wanted links to open. That is now gone, and it seems that whatever href code I try to put in the href/html field to open in a new tab doesn't work.
This is specific to widgets in the Portal. Not a UI action.
I believe part of the issue is that it is trying to append the html to the end of the instance url, rather than just opening the link in a new tab.
Has anyone found a way around this, or reported it already as a problem?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2016 09:59 AM
Hi Dan,
Great question. This does not appear to be fully implemented, though it does look like we have most of the code in to get this doen and I think you can get it working with a few changes.
The widget in question, Icon Link, has the following three lines in the HTML template (you can find this by going to the widget editor or the widget record):
3: <a ng-if="::(options.link_template == 'Top Icon' || !options.link_template)" ng-href="{{::data.href}}" class="top_icon {{::options.class_name}}" target="{{::data.target}}">
10: <a ng-if="::(options.link_template == 'Circle Icon')" ng-href="{{::data.href}}" class="circle_icon {{::options.class_name}} text-{{::options.color}}" target="{{::data.target}}">
20: <a ng-if="::(options.link_template == 'Color Box')" ng-href="{{::data.href}}" class="color_box {{::options.class_name}} icon-link-background-{{::options.color}} text-white" target="{{::data.target}}">
These are basic a tags that have some angular calls. What we're interested in is the value of the target attribute as that defines what window you're going to open the link in. The target for all of these is set to data.target which is defined in the Server Script for the widget as follows:
4: data.target = options.target || "";
So we're looking for an option named target and passing its value to the target attribute. If there is no value then we pass an empty string which will use the default behavior - opening in the same tab/window.
For more information on how options work see our documentation on widget options.
Options allow your users to configure individual widget instances. Defining a target option allows you to set the target for each icon link individually if implemented. Here is how I tested enabling this.
1) Open the widget in the widget editor. You can find this by going to /sp_config, clicking widget editor, and searching for "Icon Link".
2) Click the menu icon and click "Clone Icon Link" to create a copy of the widget called "Icon Link with Target". This is necessary because out of box widgets cannot be modified.
3) In the new widget click the menu icon and click "Edit option schema."
4) Click the + icon to add a widget option as follows:
Label: Target
Name: target
Type: Choice
Choices: _blank, _self (These are the two answers that make the most sense. The other two I was able to find were _parent and _top but those are for frames which we're not using here.)
Now when you use "Icon Link with Target" instead of Icon Link you'll see the option to set a target. Setting it to _blank will cause the links to open in a new tab.
Go ahead and test this and make any modifications as necessary. Please note that I've only done some quick testing on my own instance, so you'll want to make sure this is working 100% before moving forward into a production instance.
Thanks,
Gustavo Garcia
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2017 08:15 AM
I replaced the line of code, but unfortunately do not see anything URL_target related in the menu items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2017 08:38 AM
Oops! My instance is on Istanbul Patch 6 and my assumption is that's a more recent version than the instance you're looking at. Changing the code would not make this work without also adding the field to the sp_instance_menu related record associated with each menu item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2017 08:51 AM
OK, that makes sense. Can you share the dictionary form for that field so i can attempt to recreate it? We plan to upgrade this year but would prefer this functionality be in place prior to that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2017 10:22 AM
I was able to code to this in Helsinki, and it worked great. Thanks again for the info!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2017 05:15 AM
Hello,
I am trying to bring a pop-up window when we click on the icon link. Is there a way we can incorporate that ?
<a href="?id=pagename" target="popup" onclick="window.open('url','popup','width=600,height=600,scrollbars=no,resizable=no'); return false;"> Click this </a>
The above piece of code will do the job but that is not an icon link. Is there a way we can incorporate the above functionality?
Thanks,
Heera