PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/modules/mod_admin/templates/_admin_edit_body.tpl

https://code.google.com/p/zotonic/
Smarty Template | 64 lines | 54 code | 10 blank | 0 comment | 8 complexity | 20161dcb329e553a22e17da37aff9aae MD5 | raw file
 1{% extends "admin_edit_widget_i18n.tpl" %}
 2
 3{% block widget_title %}{_ Content _}{% endblock %}
 4{% block widget_show_minimized %}false{% endblock %}
 5
 6
 7{% block widget_content %}
 8{% with m.rsc[id] as r %}
 9<fieldset class="admin-form">
10	{% button action={zmedia id=id media_div_id=#media subject_id=id} text=_"Add media to body" id="zmedia-open-dialog" style="display:none" %}
11	{% wire action={event type='named' name="zmedia" action={zmedia id=id media_div_id=#media subject_id=id}} %}
12	{% wire action={event type='named' name="zlink" action={dialog_open title="Add link" template="_action_dialog_zlink.tpl"}} %}
13
14	<div class="form-item clearfix">
15	    {% with is_i18n|if:r.translation[lang_code].body:r.body  as  body %}
16		{% if is_editable %}
17		    <textarea rows="10" cols="10" id="rsc-body{{ lang_code_with_dollar }}" name="body{{ lang_code_with_dollar }}" class="body tinymce-init">{{ body|escape }}</textarea>
18		{% else %}
19		    {{ body }}
20		{% endif %}
21	    {% endwith %}
22	</div>
23</fieldset>
24
25{% include "_admin_save_buttons.tpl" %}
26{% endwith %}
27{% endblock %}
28
29
30{# some tinymce js #}
31{% block widget_after %}
32<script type="text/javascript" src="/lib/js/modules/tinymce3.4.3.2/tiny_mce.js"></script>
33<script type="text/javascript" src="/lib/js/modules/tinymce3.4.3.2/jquery.tinymce.js"></script>
34<script type="text/javascript">
35$(document).ready(function(){
36	/* Initialize translation tabs, select correct language */
37	if ($(".translations").length) {
38		$(".translations").tabs();
39
40		$(".translations").bind('tabsshow', function(event, ui) {
41			$(".tinymce-init", ui.panel).each(function() { 
42			    var self = $(this);
43			    setTimeout(function() { self.tinymce(tinyInit); }, 200);
44			}).removeClass('tinymce-init').addClass('tinymce');
45			$(".translations").tabs("select", ui.index);
46		});
47
48		var tab_index = $(".translations ul.ui-tabs-nav .tab-{{ z_language }}:visible").attr('data-index');
49		if (typeof(tab_index) == 'undefined') {
50			tab_index = $(".translations ul.ui-tabs-nav li:visible").attr('data-index');
51		}
52		if (typeof(tab_index) != "undefined") {
53			$(".translations").tabs("select", parseInt(tab_index));
54		}
55	}
56
57	/* Initialize all non-initialized tinymce controls */
58	$(".tinymce-init:visible").each(function() { 
59	    var self = $(this);
60	    setTimeout(function() { self.tinymce(tinyInit); }, 200);
61	}).removeClass('tinymce-init').addClass('tinymce');
62});
63</script>
64{% endblock %}