| author | raph |
| Mon, 25 Jan 2010 15:45:44 +0100 | |
| changeset 122 | 7e7f961599ae |
| parent 63 | 0a610af4033f |
| child 126 | b79d7ad83a8d |
| 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 %} |
|
| 63 | 22 |
<li><a id="followup_tab_link" class="cust_behav" href="#followup_settings">{% blocktrans %}Followup{% endblocktrans %}</a></li> |
23 |
{% endif %} |
|
24 |
{% if can_manage_text %} |
|
25 |
<li><a id="embed_tab_link" class="cust_behav" href="#text_embed">{% blocktrans %}Embed{% endblocktrans %}</a></li> |
|
| 0 | 26 |
{% endif %} |
27 |
</ul> |
|
28 |
</div> |
|
29 |
||
30 |
<script type="text/javascript"> |
|
31 |
<!-- |
|
32 |
tb_conf['text-view-url'] = "{% url text-view text.key %}"; |
|
33 |
tb_conf['edit-view-url'] = "{% url text-edit text.key %}"; |
|
34 |
||
35 |
{% if can_manage_text %} |
|
36 |
tb_conf['share-view-url'] = "{% url text-share text.key %}"; |
|
37 |
{% endif %} |
|
38 |
tb_conf['history-view-url'] = "{% url text-history text.key %}"; |
|
39 |
||
40 |
{% if can_manage_text %} |
|
41 |
tb_conf['settings-view-url'] = "{% url text-settings text.key %}"; |
|
42 |
{% endif %} |
|
43 |
||
44 |
{% if user.is_authenticated %} |
|
| 63 | 45 |
tb_conf['followup-view-url'] = "{% url text-followup text.key %}"; |
46 |
{% endif %} |
|
47 |
||
48 |
{% if can_manage_text %} |
|
49 |
tb_conf['embed-view-url'] = "{% url text-embed text.key %}"; |
|
| 0 | 50 |
{% endif %} |
51 |
||
52 |
renderTabs = function (current_tab) { |
|
53 |
||
54 |
var tab_index = 0; |
|
55 |
|
|
56 |
if (current_tab == 'view') { |
|
57 |
tab_index = 0; |
|
58 |
} |
|
59 |
||
60 |
var delta = 0; |
|
61 |
{% if can_edit_text %} |
|
62 |
delta = 1; |
|
63 |
if (current_tab == 'edit') { |
|
64 |
tab_index = 1; |
|
65 |
} |
|
66 |
{% endif %} |
|
67 |
||
68 |
{% if can_manage_text %} |
|
69 |
delta = 2; |
|
70 |
if (current_tab == 'share') { |
|
71 |
tab_index = 2; |
|
72 |
} |
|
73 |
{% endif %} |
|
74 |
if (current_tab == 'history') { |
|
75 |
tab_index = 1 + delta; |
|
76 |
} |
|
77 |
|
|
78 |
{% if can_manage_text %} |
|
79 |
delta = 3; |
|
80 |
if (current_tab == 'settings') { |
|
81 |
tab_index = 4; |
|
82 |
} |
|
83 |
{% endif %} |
|
84 |
{% if user.is_authenticated %} |
|
| 63 | 85 |
if (current_tab == 'followup') { |
| 0 | 86 |
tab_index = 2 + delta; |
87 |
} |
|
88 |
{% endif %} |
|
| 63 | 89 |
{% if can_manage_text %} |
90 |
if (current_tab == 'embed') { |
|
91 |
tab_index = 3 + delta; |
|
92 |
} |
|
93 |
{% endif %} |
|
94 |
|
|
| 0 | 95 |
|
96 |
$("#text-tabs").tabs({ ajaxOptions: { async: false }, selected: tab_index}) ; |
|
97 |
|
|
98 |
$('.cust_behav').click(function() { |
|
99 |
window.location = this.href; |
|
100 |
}); |
|
101 |
|
|
102 |
$("#view_tab_link").attr("href", tb_conf['text-view-url']) ; |
|
103 |
$("#edit_tab_link").attr("href", tb_conf['edit-view-url']) ; |
|
104 |
$("#share_tab_link").attr("href", tb_conf['share-view-url']) ; |
|
105 |
$("#history_tab_link").attr("href", tb_conf['history-view-url']) ; |
|
106 |
$("#settings_tab_link").attr("href", tb_conf['settings-view-url']) ; |
|
| 63 | 107 |
$("#followup_tab_link").attr("href", tb_conf['followup-view-url']) ; |
108 |
$("#embed_tab_link").attr("href", tb_conf['embed-view-url']) ; |
|
| 0 | 109 |
|
110 |
$("#text-tabs").trigger("tabs_ready"); |
|
111 |
||
112 |
} ; |
|
113 |
||
114 |
$(document).ready(function(){ |
|
115 |
renderTabs(tb_conf['current_tab']); |
|
116 |
}) ; |
|
117 |
--> |
|
118 |
</script> |