PageRenderTime 16ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/doc/tpl/admin/_admin_widget_i18n.tpl

http://github.com/zotonic/zotonic
Smarty Template | 63 lines | 48 code | 15 blank | 0 comment | 12 complexity | d18717140b0cd90fc9e91b199891abf1 MD5 | raw file
 1{% extends "admin_edit_widget_i18n.tpl" %}
 2
 3{# 
 4    More complex widget for editing language-depend content.
 5    Look at "doc/admin/tpl/_admin_widget_std.tpl" before start to develop i18n-enabled widget.
 6
 7    Depending on whether mod_translation enabled or disabled:
 8	* if enabled, this widget will be displayed as tabs. See /admin/edit/1 top;
 9	* if disabled - will be displayed as standard widget.
10	  See /admin/edit/1 no-tabs widgets, like "address", etc.
11
12    Before you delete this comment, you should understand: only blocks "widget_content" and "widget_i18n_tab_class"
13    provide localization. They are will be rendered several times: one time per every enabled language.
14    In other words, rendered once per lang tab.
15    All other blocks are rendered only once - when page loads.
16#}
17
18{# See doc/admin/tpl/_admin_widget_std.tpl for block description. #}
19   NOTE: displayed only then mod_translation is disabled. #}
20{% block widget_title %}{_ Basic _}{% endblock %}
21
22
23{# Optional CSS-classes for widget container #}
24{% block widget_i18n_tab_class %}item{% endblock %}
25
26
27{# See doc/admin/tpl/_admin_widget_std.tpl for block description. #}
28{% block widget_before %}{% endblock %}
29
30
31{# See doc/admin/tpl/_admin_widget_std.tpl for block description. 
32   See variables in doc/tpl/admin/README.i18n for i18n variables description.
33   Tags inside this block should be ready for using in i18n and non-i18n enviroments. #}
34{% block widget_content %}
35    {% with m.rsc[id] as r %}
36	<fieldset class="admin-form">
37	    <div class="form-item clearfix">
38		{# Then i18n is disabled, variables "lang_code", "lang_code_with_dollar" and others are undefined, 
39		   so following ids and names goes to unlocalized identifiers. #}
40		<label for="field-title{{ lang_code_with_dollar }}">{_ Title _} {{ lang_code_with_brackets }}</label>
41
42		{# INPUT-tag: Look at name and value attributes: value is rendered using "if" filter: #}
43		<input type="text" id="field-title{{ lang_code_with_dollar }}" name="title{{ lang_code_with_dollar }}" 
44			value="{{ is_i18n|if : r.translation[lang_code].title : r.title }}"
45			{% if not is_editable %}disabled="disabled"{% endif %}/>
46	    </div>
47	</fieldset>
48    {% endwith %}
49{% endblock %}
50
51
52{# See doc/admin/tpl/_admin_widget_std.tpl for block description. #}
53{% block widget_after %}
54    <script language="text/javascript">
55	alert("Hello World!");
56    </script>
57{% endblock %}
58
59
60{# Used only then mod_translation is disabled.
61   See doc/admin/tpl/_admin_widget_std.tpl for description.
62   NOTE: by now the content presence in this block is mandatory. #}
63{% block widget_show_minimized %}false{% endblock %}