src/cm/templates/site/macros/main_tabs.html
author raph
Thu, 15 Jul 2010 16:23:58 +0200
changeset 294 c2c262ac1273
parent 64 d0478be65c29
child 536 0c625ce49a81
permissions -rw-r--r--
do not show permalink if prefix is used in embed params / minified client update

{% 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 }, selected: tab_index}) ;

    $('.cust_behav').click(function() {
        window.location = this.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>