64c117ee66d74f06c7296c7f06469ff5e8753650
[myslice.git] / templates / render_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 }}' plugin-type='{{ title }}'>
15 {{ plugin_content|safe }}
16 </div><!--plugin {{ title }}-->
17
18 {% if visible %}
19 </div>
20 {% endif %}
21
22 {% if visible and hidable %}
23 {# xxx sounds like this could be optimized by a single call performed on document.ready #}
24 {# that would do that on all DOM elements that require it #}
25
26 {% insert prelude_js %}
27 /* Show / hide plugin */
28
29 jQuery('#show_{{ uuid }}').click(function() {
30 jQuery('#{{ uuid }}').show();
31 if (typeof jQuery('#{{ uuid }}').{{ title }} != 'undefined') {
32 jQuery('#{{ uuid }}').{{ title }}('show');
33 }; 
34 jQuery('#hide_{{ uuid }}').show();
35 jQuery('#show_{{ uuid }}').hide(); 
36 event.preventDefault();
37 }); 
38 jQuery('#hide_{{ uuid }}').click(function() {
39 jQuery('#{{ uuid }}').hide();
40 jQuery('#hide_{{ uuid }}').hide();
41 jQuery('#show_{{ uuid }}').show(); 
42 event.preventDefault();
43 });
44 {% if hidden %}
45 jQuery('#{{ uuid }}').hide()
46 {% endif %}
47 /* {{ optionstr }} optionstr needs more work */
48 {% endinsert %}
49 {% endif %}