src/cm/templates/site/macros/text_tabs.html
author rbernard
Fri, 12 Feb 2010 21:58:53 +0100
changeset 172 9a355903350d
parent 126 b79d7ad83a8d
child 536 0c625ce49a81
permissions -rw-r--r--
renaming variables
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     1
{% load i18n %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     2
{% load com %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     3
{% load local_perms %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     4
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     5
{% get_local_text_perm request text can_edit_text as can_edit_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     6
{% get_local_text_perm request text can_manage_text as can_manage_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     7
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     8
<div id="text-tabs">
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
     9
    <ul>
59
8a2d933209aa BUG FIX : in text history tab text view frame now expands to maximum
reno
parents: 0
diff changeset
    10
        <li><a id="view_tab_link" class="cust_behav" href="#autoexpand_text_view_frame_container">{% blocktrans %}Text{% endblocktrans %}</a></li>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    11
        {% if can_edit_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    12
        <li><a id="edit_tab_link" class="cust_behav" href="#text_edit">{% blocktrans %}Edit{% endblocktrans %}</a></li>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    13
        {% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    14
        {% if can_manage_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    15
        <li><a id="share_tab_link" class="cust_behav" href="#text_share">{% blocktrans %}People{% endblocktrans %}</a></li>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    16
        {% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    17
        <li><a id="history_tab_link" class="cust_behav" href="#text_history">{% blocktrans %}Versions{% endblocktrans %} ({{ text.get_versions_number }})</a></li>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    18
        {% if can_manage_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    19
        <li><a id="settings_tab_link" class="cust_behav" href="#text_settings">{% blocktrans %}Settings{% endblocktrans %}</a></li>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    20
        {% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    21
        {% if user.is_authenticated %}
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    22
        <li><a id="followup_tab_link" class="cust_behav" href="#followup_settings">{% blocktrans %}Followup{% endblocktrans %}</a></li>
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    23
        {% endif %}
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    24
        <li><a id="embed_tab_link" class="cust_behav" href="#text_embed">{% blocktrans %}Embed{% endblocktrans %}</a></li>
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    25
    </ul> 
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    26
</div>
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    27
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    28
<script type="text/javascript">
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    29
<!--
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    30
tb_conf['text-view-url'] = "{% url text-view text.key %}";
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    31
tb_conf['edit-view-url'] = "{% url text-edit text.key %}";
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    32
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    33
{% if can_manage_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    34
tb_conf['share-view-url'] = "{% url text-share text.key %}";
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    35
{% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    36
tb_conf['history-view-url'] = "{% url text-history text.key %}";
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    37
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    38
{% if can_manage_text %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    39
tb_conf['settings-view-url'] = "{% url text-settings text.key %}";
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    40
{% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    41
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    42
{% if user.is_authenticated %}
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    43
tb_conf['followup-view-url'] = "{% url text-followup text.key %}";
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    44
{% endif %}
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    45
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    46
tb_conf['embed-view-url'] = "{% url text-embed text.key %}";
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    47
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    48
renderTabs = function (current_tab) {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    49
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    50
    var delta = -1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    51
    var tab_index = 0;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    52
    
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    53
	delta = delta + 1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    54
    if (current_tab == 'view') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    55
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    56
    }    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    57
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    58
    {% if can_edit_text %}
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    59
	delta = delta + 1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    60
    if (current_tab == 'edit') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    61
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    62
    }
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    63
    {% endif %}    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    64
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    65
    {% if can_manage_text %}
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    66
	delta = delta + 1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    67
    if (current_tab == 'share') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    68
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    69
    }
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    70
    {% endif %}
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    71
	delta = delta + 1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    72
    if (current_tab == 'history') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    73
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    74
    }    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    75
    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    76
    {% if can_manage_text %}
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    77
	delta = delta + 1;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    78
    if (current_tab == 'settings') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    79
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    80
    }
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    81
    {% endif %}
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    82
    {% if user.is_authenticated %}    
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    83
	delta = delta + 1;
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    84
    if (current_tab == 'followup') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    85
        tab_index = delta;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    86
    }
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    87
    {% endif %}
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    88
	delta = delta + 1;
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    89
    if (current_tab == 'embed') {
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    90
        tab_index = delta;
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
    91
    }
126
b79d7ad83a8d embed for public texts
raph
parents: 63
diff changeset
    92
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    93
    $("#text-tabs").tabs({ ajaxOptions: { async: false }, selected: tab_index}) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    94
    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    95
    $('.cust_behav').click(function() {
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    96
        window.location = this.href;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    97
    });
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    98
    
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
    99
    $("#view_tab_link").attr("href", tb_conf['text-view-url']) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   100
    $("#edit_tab_link").attr("href", tb_conf['edit-view-url']) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   101
    $("#share_tab_link").attr("href", tb_conf['share-view-url']) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   102
    $("#history_tab_link").attr("href", tb_conf['history-view-url']) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   103
    $("#settings_tab_link").attr("href", tb_conf['settings-view-url']) ;
63
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
   104
    $("#followup_tab_link").attr("href", tb_conf['followup-view-url']) ;
0a610af4033f split followup and embed
raph
parents: 59
diff changeset
   105
    $("#embed_tab_link").attr("href", tb_conf['embed-view-url']) ;
0
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   106
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   107
    $("#text-tabs").trigger("tabs_ready");
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   108
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   109
} ; 
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   110
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   111
$(document).ready(function(){
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   112
    renderTabs(tb_conf['current_tab']);
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   113
}) ;
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   114
-->
40c8f766c9b8 import from internal svn r 4007
raph
parents:
diff changeset
   115
</script>