# . title: is used visually for displaying the widget
# . name: a simple id suitable for forging css names
#### optional
- # . hidable: whether it can be turned on and off from the UI
+ # . togglable: whether it can be turned on and off from the UI
# like e.g. PleKitToggle
- # . hidden_by_default: if hidable, what's the initial status
+ # . toggled: if togglable, what's the initial status
# . visible: if not set the plugin does not show up at all,
# not quite sure what this was for
#### internal data
# which will result in 'foo' being accessible to the template engine
#
def __init__ (self, title, name,
- visible=True, hidable=True, hidden_by_default=False, **settings):
+ visible=True, togglable=True, toggled=True, **settings):
# what is in this dictionary will get exposed to template and to javascript
self._settings=settings
self.title=title
self.classname=self._classname()
self.add_to_settings ( [ 'uuid', 'classname' ] )
self.visible=visible
- self.hidable=hidable
- self.hidden_by_default=hidden_by_default
- self.add_to_settings( ['visible','hidable','hidden_by_default'] )
+ self.togglable=togglable
+ self.toggled=toggled
+ self.add_to_settings( ['visible','togglable','toggled'] )
# we store as a dictionary the arguments passed to constructor
# e.g. SimpleList (list=[1,2,3]) => _settings = { 'list':[1,2,3] }
# our own settings are not made part of _settings but could be..
-div.plugin-manage {
+div.plugin-toggle {
padding: 10px;
border-style: dotted;
border-width: 1px;
{#<!--begin {{ classname }}{{ name }}{{ uuid }}-->#}
{% if visible %}
-<div class='plugin-manage' id='{{ name }}'>
-{% if hidable %}
- {% if hidden %}
+<div class='plugin-toggle' id='{{ name }}'>
+{% if togglable %}
+ {% if not toggled %}
<p id='show-{{ uuid }}' class='plugin-show'><a href='#'><span>» Show {{ classname }} "{{ title }}"</span></a></p>
<p id='hide-{{ uuid }}' class='plugin-hide' style='display:none;'><a href='#'><span>« Hide {{ classname }} "{{ title }}"</span></a></p>
{% else %}
<p id='show-{{ uuid }}' class='plugin-show' style='display:none;'><a href='#'><span>» Show {{ classname }} "{{ title }}"</span></a></p>
<p id='hide-{{ uuid }}' class='plugin-hide'><a href='#'><span>« Hide {{ classname }} "{{ title }}"</span></a></p>
- {% endif %}
-{% endif %}
-{% endif %}
+ {% endif %}{# toggled #}
+{% endif %}{# togglable #}
+{% endif %}{# visible #}
-<div class='plugin {{ classname }}' id='plugin-{{ uuid }}'>
+<div class='plugin {{ classname }}' id='plugin-{{ uuid }}' {% if not toggled %}style='display:none'{% endif %}>
{{ plugin_content|safe }}
-</div><!--plugin {{ classname }}-->
+</div><!--plugin {{ classname }}{{ name }}{{ uuid }}-->
{% if visible %}
</div>
-{% endif %}
+{% endif %}{# visible #}
{#<!--end {{ classname }}{{ name }}{{ uuid }}-->#}
{# from plugin.php Plugin.render() #}
{# Plugin initialization (if the plugin has the right structure) #}
-if (typeof jQuery('#{{ uuid }}').{{ classname }} != 'undefined') {
- jQuery('#{{ uuid }}').{{ classname }}({{ settings_json|safe }});
+if (typeof jQuery('#plugin-{{ uuid }}').{{ classname }} != 'undefined') {
+ jQuery('#plugin-{{ uuid }}').{{ classname }}({{ settings_json|safe }});
{#jQuery('#{{ uuid }}').{{ classname }}('show');#}
};
main_plugin = \
VerticalLayout ( title='title for the vertical layout',name='vertical1',
sons = [ SimpleList (title='SimpleList and dataTables',
- name='simplelist1',
- list=hard_wired_list,
- header='Hard wired',
- foo='the value for foo',
- with_datatables=True),
- Tabs (title='Sample Tabs',name='tabs1',
- active='raw1',
- sons = [ Raw (title='a raw plugin',name='raw1',
- hidable=False,
- html= 3*lorem_p),
- SliceList(title='a slice list',name='slicelist-main',
- hidable=False,
- list=hard_wired_slice_names),
- Raw (title='raw title',name='raw2',
- hidable=False,html=lorem) ]),
- SimpleList (title='SimpleList with slice names',
- name='simplelist2',
- list=hard_wired_slice_names,
- ) ] )
+ name='simplelist1',
+ list=hard_wired_list,
+ header='Hard wired',
+ foo='the value for foo',
+ with_datatables=True,
+ toggled=False),
+ Tabs (title='Sample Tabs',name='tabs1',
+ active='raw1',
+ sons = [ Raw (title='a raw plugin',name='raw1',
+ togglable=False,
+ html= 3*lorem_p),
+ SliceList(title='a slice list',name='slicelist-main',
+ togglable=False,
+ list=hard_wired_slice_names),
+ Raw (title='raw title',name='raw2',
+ togglable=False,html=lorem) ]),
+ SimpleList (title='SimpleList with slice names',
+ name='simplelist2',
+ list=hard_wired_slice_names,
+ ) ] )
# define 'content_main' to the template engine
template_env [ 'content_main' ] = main_plugin.render(request)