src/cm/templates/site/macros/main_tabs.html
author Simon Descarpentries <sid@sopinspace.com>
Fri, 20 Sep 2013 16:28:40 +0200
changeset 536 0c625ce49a81
parent 64 d0478be65c29
permissions -rw-r--r--
- updating jQuery (1.3.2 -> 1.10.2), jQuery UI, jQuery modules - [text_view_frame.html] Add some JS driven CSS tricks for iPad - [text_view_frame.html] move throbber's hiding-call in nested text_view_comments iframe onload signal (so it works with jQuery 1.10.2 and the hiding timing is good) - [text_view_frame.html][base.html] factorize req_yui.html et req_jquery.html - [main_tabs][text_tabs][f_client-min.js] rewrite jQuery UI Tabs API calls select in active - [base.css] CSS fix grey frame appearence for all tabs - hg remove bgiframe -> not loaded in templates anymore - hg remove header_custom.html -> the file has been empty since 4 years - hg remove controls.html -> the file has been empty since 4 years

{% load com %}
{% load i18n %}
{% load local_perms %}

{% get_local_perm request can_manage_workspace as can_manage_workspace %}
{% nb_texts as nb_texts %}
{% nb_users as nb_users %}
<div id="main-tabs">
    <ul>
        <li><a id="dashboard_link" class="cust_behav" href="#dashboard">{% blocktrans %}Dashboard{% endblocktrans %}</a></li>
        <li><a id="text_link" class="cust_behav" href="#text">{% blocktrans with nb_texts as nb_texts %}Texts ({{ nb_texts }}){% endblocktrans %} </a></li>
        {% if can_manage_workspace %}
        <li><a id="user_link" class="cust_behav" href="#user">{% blocktrans with nb_users as nb_users %}People  ({{ nb_users }}){% endblocktrans %}</a></li>
        <li><a id="settings_link" class="cust_behav" href="#settings">{% blocktrans %}Settings{% endblocktrans %}</a></li>
        {% endif %}
        <li><a id="followup_link" class="cust_behav" href="#followup">{% blocktrans %}Followup{% endblocktrans %}</a></li>
    </ul> 
</div>

<script type="text/javascript">
<!--
tb_conf['dashboard-url'] = "{% url index %}";
tb_conf['text-url'] = "{% url text %}";
{% if can_manage_workspace %}
tb_conf['user-url'] = "{% url user %}";
tb_conf['settings-url'] = "{% url settings %}";
{% endif %}
tb_conf['followup-url'] = "{% url followup %}";

renderTabs = function (current_tab) {

    var tab_index = 0;
    
    if (current_tab == 'dashboard') {
        tab_index = 0;
    }    

    if (current_tab == 'text') {
        tab_index = 1;
    }    
    
    {% if can_manage_workspace %}    
    if (current_tab == 'user') {
        tab_index = 2;        
    }    

    if (current_tab == 'settings') {
        tab_index = 3;        
    }    

    if (current_tab == 'followup') {
        tab_index = 4;
    }        
    {% else %}
    if (current_tab == 'followup') {
        tab_index = 2;
    }            
    {% endif %}
    	
    $("#main-tabs").tabs({ ajaxOptions: { async: false }, active: tab_index});
	$("#main-tabs").on( "tabsbeforeactivate", function( event, ui ) {
		window.location = ui.newTab.children ().first ().attr ('href');
	} );

    $("#dashboard_link").attr("href", tb_conf['dashboard-url']) ;
    $("#text_link").attr("href", tb_conf['text-url']) ;
    {% if can_manage_workspace %}    
    $("#user_link").attr("href", tb_conf['user-url']) ;
    $("#settings_link").attr("href", tb_conf['settings-url']) ;
    {% endif %}
    $("#followup_link").attr("href", tb_conf['followup-url']) ;

} ; 

$(document).ready(function(){
    renderTabs(tb_conf['current_tab']);
}) ;
-->
</script>