pass python settings to the js layer - from plugin.php
[unfold.git] / templates / widget-plugin.html
1 {% if visible %}
2 <div class='plugin-manage'>
3 {% if hidable %}
4   {% if hidden %}
5 <p id='show-{{ uuid }}' class='plugin-show'><a href='#'><span>&raquo; Show {{ title }}</span></a></p>
6 <p id='hide-{{ uuid }}' class='plugin-hide' style='display:none;'><a href='#'><span>&laquo; Hide {{ title }}</span></a></p>
7   {% else %}
8 <p id='show-{{ uuid }}' class='plugin-show' style='display:none;'><a href='#'><span>&raquo; Show {{ title }}</span></a></p>
9 <p id='hide-{{ uuid }}' class='plugin-hide'><a href='#'><span>&laquo; Hide {{ title }}</span></a></p>
10   {% endif %}
11 {% endif %}
12 {% endif %}
13
14 <div class='plugin {{ title }}' id='plugin-{{ uuid }}'>
15 {{ plugin_content|safe }}
16 </div><!--plugin {{ title }}-->
17
18 {% if visible %}
19 </div>
20 {% endif %}
21
22 {% insert prelude_js %}
23 {% if visible and hidable %}
24 {# xxx sounds like this could be optimized by a single call performed on document.ready #}
25 {# that would do that on all DOM elements that require it #}
26
27 /* Show / hide plugin */
28 jQuery('#show_{{ uuid }}').click(function() {
29 jQuery('#{{ uuid }}').show();
30 if (typeof jQuery('#{{ uuid }}').{{ title }} != 'undefined') {
31 jQuery('#{{ uuid }}').{{ title }}('show');
32 }; 
33 jQuery('#hide_{{ uuid }}').show();
34 jQuery('#show_{{ uuid }}').hide(); 
35 event.preventDefault();
36 }); 
37 jQuery('#hide_{{ uuid }}').click(function() {
38 jQuery('#{{ uuid }}').hide();
39 jQuery('#hide_{{ uuid }}').hide();
40 jQuery('#show_{{ uuid }}').show(); 
41 event.preventDefault();
42 });
43 {% if hidden %}
44 jQuery('#{{ uuid }}').hide()
45 {% endif %}
46 {% endif %}
47 /* Plugin initialization (if the plugin has the right structure) - from plugin.php */
48 if (typeof jQuery('#{{ uuid }}').$title != 'undefined') {
49   jQuery('#{{ uuid }}').$title({ {{ settings }} plugin_uuid: '{{ uuid }}' });
50   //jQuery('#{{ uuid }}').$title('show');
51   }; 
52 {% endinsert %}