| author | reno |
| Fri, 11 Dec 2009 12:03:51 +0100 | |
| changeset 59 | 8a2d933209aa |
| parent 0 | 40c8f766c9b8 |
| child 63 | 0a610af4033f |
| permissions | -rw-r--r-- |
| 0 | 1 |
{% load i18n %} |
2 |
{% load com %} |
|
3 |
{% load local_perms %} |
|
4 |
||
5 |
{% get_local_text_perm request text can_edit_text as can_edit_text %} |
|
6 |
{% get_local_text_perm request text can_manage_text as can_manage_text %} |
|
7 |
||
8 |
<div id="text-tabs"> |
|
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 | 11 |
{% if can_edit_text %} |
12 |
<li><a id="edit_tab_link" class="cust_behav" href="#text_edit">{% blocktrans %}Edit{% endblocktrans %}</a></li> |
|
13 |
{% endif %} |
|
14 |
{% if can_manage_text %} |
|
15 |
<li><a id="share_tab_link" class="cust_behav" href="#text_share">{% blocktrans %}People{% endblocktrans %}</a></li> |
|
16 |
{% endif %} |
|
17 |
<li><a id="history_tab_link" class="cust_behav" href="#text_history">{% blocktrans %}Versions{% endblocktrans %} ({{ text.get_versions_number }})</a></li> |
|
18 |
{% if can_manage_text %} |
|
19 |
<li><a id="settings_tab_link" class="cust_behav" href="#text_settings">{% blocktrans %}Settings{% endblocktrans %}</a></li> |
|
20 |
{% endif %} |
|
21 |
{% if user.is_authenticated %} |
|
22 |
<li><a id="notifications_tab_link" class="cust_behav" href="#notifications_settings">{% blocktrans %}Notifications{% endblocktrans %}</a></li> |
|
23 |
{% endif %} |
|
24 |
</ul> |
|
25 |
</div> |
|
26 |
||
27 |
<script type="text/javascript"> |
|
28 |
<!-- |
|
29 |
tb_conf['text-view-url'] = "{% url text-view text.key %}"; |
|
30 |
tb_conf['edit-view-url'] = "{% url text-edit text.key %}"; |
|
31 |
||
32 |
{% if can_manage_text %} |
|
33 |
tb_conf['share-view-url'] = "{% url text-share text.key %}"; |
|
34 |
{% endif %} |
|
35 |
tb_conf['history-view-url'] = "{% url text-history text.key %}"; |
|
36 |
||
37 |
{% if can_manage_text %} |
|
38 |
tb_conf['settings-view-url'] = "{% url text-settings text.key %}"; |
|
39 |
{% endif %} |
|
40 |
||
41 |
{% if user.is_authenticated %} |
|
42 |
tb_conf['notifications-view-url'] = "{% url text-notifications text.key %}"; |
|
43 |
{% endif %} |
|
44 |
||
45 |
renderTabs = function (current_tab) { |
|
46 |
||
47 |
var tab_index = 0; |
|
48 |
|
|
49 |
if (current_tab == 'view') { |
|
50 |
tab_index = 0; |
|
51 |
} |
|
52 |
||
53 |
var delta = 0; |
|
54 |
{% if can_edit_text %} |
|
55 |
delta = 1; |
|
56 |
if (current_tab == 'edit') { |
|
57 |
tab_index = 1; |
|
58 |
} |
|
59 |
{% endif %} |
|
60 |
||
61 |
{% if can_manage_text %} |
|
62 |
delta = 2; |
|
63 |
if (current_tab == 'share') { |
|
64 |
tab_index = 2; |
|
65 |
} |
|
66 |
{% endif %} |
|
67 |
if (current_tab == 'history') { |
|
68 |
tab_index = 1 + delta; |
|
69 |
} |
|
70 |
|
|
71 |
{% if can_manage_text %} |
|
72 |
delta = 3; |
|
73 |
if (current_tab == 'settings') { |
|
74 |
tab_index = 4; |
|
75 |
} |
|
76 |
{% endif %} |
|
77 |
{% if user.is_authenticated %} |
|
78 |
if (current_tab == 'notifications') { |
|
79 |
tab_index = 2 + delta; |
|
80 |
} |
|
81 |
{% endif %} |
|
82 |
|
|
83 |
$("#text-tabs").tabs({ ajaxOptions: { async: false }, selected: tab_index}) ; |
|
84 |
|
|
85 |
$('.cust_behav').click(function() { |
|
86 |
window.location = this.href; |
|
87 |
}); |
|
88 |
|
|
89 |
$("#view_tab_link").attr("href", tb_conf['text-view-url']) ; |
|
90 |
$("#edit_tab_link").attr("href", tb_conf['edit-view-url']) ; |
|
91 |
$("#share_tab_link").attr("href", tb_conf['share-view-url']) ; |
|
92 |
$("#history_tab_link").attr("href", tb_conf['history-view-url']) ; |
|
93 |
$("#settings_tab_link").attr("href", tb_conf['settings-view-url']) ; |
|
94 |
$("#notifications_tab_link").attr("href", tb_conf['notifications-view-url']) ; |
|
95 |
||
96 |
$("#text-tabs").trigger("tabs_ready"); |
|
97 |
||
98 |
} ; |
|
99 |
||
100 |
$(document).ready(function(){ |
|
101 |
renderTabs(tb_conf['current_tab']); |
|
102 |
}) ; |
|
103 |
--> |
|
104 |
</script> |