Prevent duplicate Jquery Tabs - jquery-ui

I have links that when clicked loads the url as a tab in jquery. But when a tab already exist in the tab panel and the link is clicked a second time, i want the already added tab to be selected instead of adding a new tab of the same url.
thanks

Have you tried this way:-
OnClick of the tab, check if the tab id is already exists
If id is exists then add attribute as selected.

Related

Link to jQuery UI tab from external page and set tab to active

I have a site using jQuery UI tabs and link to a specific tab from external pages using something like
<a href="/tabspage#tab-3">
and this correctly opens the proper panel, but it does not give the actual tab the proper classes like ui-tabs-active or ui-state-active.
I have tried some custom scripting to find the index of the active panel and then go find the corresponding tab and add the classes to it, but then clicking on another tab does not remove those classes from the initial active class.
Is it possible to link to a specific jQuery UI tab and also make the tab of the opened panel highlighted?

Shorten Joomla SEF URL Parent / Child / Sub Menu Items, Use only one alias without multiple parent alias

Is there anyway to only show the menu item alias in the URL without its parent alias? I know I can create a hidden menu with all items in the root level but this will make the breadcrumb unusable.
For example: www.mysite.com/grand-parent/parent/child
I like it to be just www.mysite.com/child
I have url rewrite/sef turned on using Joomla 2.5.
Thanks,
Will
There is a workaround.
Create a seperate menu and create menu item in that menu with required alias.
Then on the menu you want the link in the first place, create a menu item of type menu Alias and select the seperate menu item as target. This way parent alias will no appear infront for any alias type menu items.
No need for any workarounds. It works straight on.
(Written for J 2.5 but J 3 should be the same)
Choose the menu item which you wish to remove from the SEF URL (the parent menu which provides the url). Open it from the menu manager
In the section on the left, titled "Details" there is a row with "Alias". Next to it there's a button "Inherited". Click it so it becomes "Not Inherited".
Save & Close
Voila! It disappears .
It work's with "Direct Alias" extension.
http://extensions.joomla.org/extension/direct-alias
After instaling it "Inherited" button apears next to "Alias".
I have just had a similar problem and this plugin worked perfectly to achieve what I needed. This saves me hours of work creating 301 redirects. I had to buy the pro version to get the control over individual menu items. This gives you the functionality Ben Shomer describes above eg Next to it there's a button "Inherited". Click it so it becomes "Not Inherited". The free version controls ALL menu item aliases. Great plugin, highly recommended.
To perform what you want to do :
1- Install "Direct Alias" extension : http://extensions.joomla.org/extension/direct-alias
2- Go to "Menus" -> "All Menus Items" and select your menu item.
After "Alias" field you will have two buttons "Relative" and "Inherited".
Click on "Relative". It will transform to "Direct". Save and test.
You have now a direct link for your child item in your menu.
Note : If you don't install Direct "Direct Alias" extension the two button will not display.
I'm not sure it's possible with core Joomla.
You can achieve this - and complete control over your SEF urls - with the sh404 extension.
I solve it by following these steps.
Create a hidden menu which is your child menu. (For creating the hidden menu go to the Link Type tab and select No for Display in Menu option).
Then create your parent menu with a type of anything under the System Links (except Menu Item Alias)
Create a menu (as a child of the parent menu you have created before) with the type of Menu Item Alias and select the hidden child menu you've created before as the Menu Item.
That's all. Now you can show your menu structure like-
|-Parent
|--Child
And when you click on the Child link the URL will look like mysite.com/child

show <rich:tab> contents while navigating only if action Performed is YES

I am using RF3.3 and JSF(2.0) wiht JSPs in the project.
My page contains 4 tabs inside a tab panel.
When page is first loaded, the TAB1 is automatically selected which is ok.
Now before user navigate from one tab to another tab I need to show him a pop up panel asking his confirmation to move from one tab to another. So when User present on TAB 1 clicks on TAB2 I want a pop up panel asking user whether he is sure to navigate to TAB2.
The problem is: Once I click tab 2 the action listener present with <rich:tab> is fired and tab2 is rendered and only then pop up panel comes.
Is there any way to open pop up panel once user click on TAB 2 and only if he clicks YES in pop up panel the contents of TAB 2 is shown.
I cannot use disabled attribute since using that I won't be able to click on TAB 2 and my pop up panel won't open.
<rich:tabPanel id="tab" switchType="ajax" headerSpacing="10px"style="overflow:auto">
<rich:tab binding="#{Bean.firsttab}" id="tabOne" style="overflow:auto" styleClass="richTab" label="TAB ONE" actionListener="#{Bean.refresh}" switchType="ajax">
<rich:tab binding="#{Bean.secondtab}" id="tabTwo" style="overflow:auto" styleClass="richTab" label="TABTWO" actionListener="#{Bean.refresh}" switchType="ajax">
</rich:tabPanel>
I preferably don't want to use Javascript to achieve the same. How can I achieve this in JSF?
Can you please try using onlabelclick inside <rich:tab. Call a JS method inside this and return a boolean to proceed to the action or not. Hope this works. If it worked kindly post your code snippet in this.
I achieved the same by binding the tab with the backing bean and using the property of the tab to render and rerender the tab based on some conditions...

Cannot detect Frontpage properly in Joomla 2.5 templates

I've seen in Joomla documentation the way to detect if you are in Frontpage while creating a template in Joomla 2.5. This is the code:
<?php
$app = JFactory::getApplication();
$menu = $app->getMenu();
if ($menu->getActive() == $menu->getDefault()) {
echo 'This is the front page';
}
?>
This works when you are at home page (or clicking on Home menu), but I have an slider in home page, and I link in the slider to an article which is not in any menu item in the application. When I load this article the code above returns as I were at frontpage. I guess that if I doesn't click on any menu item, $menu->getActive() doesn't change.
Any suggestion?
Thanks in advance.
You can do one thing to solve this problem. Create a hidden menu of all the article links which are linked in the sliders.By creating hidden menu the link will be initialized and $menu->getActive() will work for all the links..Hopefully it will works for you .
I wish to add to the present answer and provide some clarifications.
In order for the menu selection to be detected the page requires to be assigned to a menu item. If this is a hidden menu than the link to such a page called My Page would be:
/index.php/my-page - “my-page” is the menu title alias for this item
However, if one wants to show the correct hierarchy in the breadcrumbs for the same page, then the menu hierarchy would have to be replicated in the hidden menu.
For example if My Page is under My Articles main menu item, then in the hidden menu you should add “My Articles” item, of the type: Menu Item Alias, which is in the Systems submenu of the menu type field. The My Page item should be a sub-menu item of My Articles.
The “My Articles” menu item in the hidden menu must have a different menu alias than the same one in the main menu hence the new link to My Page would look like:
/index.php/my-articles2/my-page
To create a hidden menu, one simply creates another menu. It does not matter whether one creates a module for it or not, but if one does then one just should not assign any position to that module.

jQuery UI, select tab with text link and load link specific ajax content

I am using jQuery UI tabs to have a tab where I can search for records and then other tabs where I can view individual record details. I am trying to have search results link clicks open the relevant tab and load the specific ajax content for that search result.
I am able to switch tabs using an href with something like the jQuery UI tabs example code:
var $tabs = $('#example').tabs(); // first tab selected
$('#my-text-link').click(function() { // bind click event to link
$tabs.tabs('select', 2); // switch to third tab
return false;
});
I see ajax content is normally loaded via setting the href on the tab itself:
<li><a id="customerTabLink" href="#tabs-2"><span>Customer</span></a></li>
I've tried adding this to the my-text-link onclick function to dynamically set the href for the tab but that doesn't load the content in my tab.
$('#customerTabLink').attr("href", "/view/dspClient.cfm?id_customers=15");
Is there another way I can be loading ajax content in the tab without setting this href? Or am I setting the href incorrectly? Is this something I should be using the load even for? http://docs.jquery.com/Events/load
Thanks!
-Matt
To change the URL that tab is using for AJAX calls you should use this:
$('#example').tabs('url', 1, '/view/dspClient.cfm?id_customers=15');
First argument tells that you want to change tab URL. Second argument is the index of the page you want to change the url (zero-based so 1 is the second tab), and third argument is the new URL.

Resources