the move about plugin's 'toggled' becoming more elaborate and pas-aware : setting...
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 25 Mar 2013 08:18:36 +0000 (09:18 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Mon, 25 Mar 2013 08:18:36 +0000 (09:18 +0100)
we only have True and False for now

unfold/js/plugin.js
unfold/plugin.py

index 5aa90fa..599d079 100644 (file)
@@ -1,3 +1,6 @@
+// xxx NOTE : pending move towards a more elaborate mode for 'toggled'
+// for now it's just True or False and most of this code is not in action yet
+// init_all_plugins does kick in though
 var plugin = {
 
     debug:true,
@@ -18,22 +21,6 @@ var plugin = {
        if (debug) console.log ("Applying retrieved status " + retrieved +  " to " + domid);
        set_visible(domid,retrieved);
     },
-    // triggered upon $(document).ready
-    init_all_plugins: function() {
-       $('.plugin-hide').each(function() {
-           $(this).click(function () { 
-               var plugin='#'+this.id.replace('hide-',''); 
-               var show='#'+this.id.replace('hide-','show-'); 
-               $(plugin).slideUp(); $(show).show(); $(this).hide();});
-       });
-       $('.plugin-show').each(function() {
-           $(this).click(function () { 
-               var plugin='#'+this.id.replace('show-',''); 
-               var hide='#'+this.id.replace('show-','hide-'); 
-               $(plugin).slideDown(); $(hide).show(); $(this).hide();});
-       });
-       $('.plugin-tooltip').each(function(){ $(this).tooltip({'selector':'','placement':'right'}); });
-    },
     toggle : function (domid) {
        var plugin=$('#'+domid);
        plugin.toggle();
@@ -56,6 +43,22 @@ var plugin = {
            plugin.toggle (domid);
        }
     },
+    // triggered upon $(document).ready
+    init_all_plugins: function() {
+       $('.plugin-hide').each(function() {
+           $(this).click(function () { 
+               var plugin='#'+this.id.replace('hide-',''); 
+               var show='#'+this.id.replace('hide-','show-'); 
+               $(plugin).slideUp(); $(show).show(); $(this).hide();});
+       });
+       $('.plugin-show').each(function() {
+           $(this).click(function () { 
+               var plugin='#'+this.id.replace('show-',''); 
+               var hide='#'+this.id.replace('show-','hide-'); 
+               $(plugin).slideDown(); $(hide).show(); $(this).hide();});
+       });
+       $('.plugin-tooltip').each(function(){ $(this).tooltip({'selector':'','placement':'right'}); });
+    },
 } // global unfold
 
 /* upon document completion, we locate all the hide and show areas, 
index 278c362..65195cd 100644 (file)
@@ -43,10 +43,19 @@ class Plugin:
     # . page: the context of the request being served
     # . title: is used visually for displaying the widget
     #### optional
-    # . togglable: whether it can be turned on and off (like PleKitToggle)
-    # . 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)
+    # . togglable: whether it can be turned on and off by clicking on the title (like PleKitToggle)
+    # . toggled:   whether the plugin should startup open/shown or closed/hidden
+    #### xxx NOTE : pending move towards a more elaborate mode for 'toggled'
+    # . toggled: if togglable, what's the initial status; possible values are
+    #    .. True   : start up open/hidden
+    #    .. False  : start up closed/shown
+    #    .. 'last' : start up as it was the last time that browser showed it (based on 'domid')
+    #    .. None   : if not passed to __init__ at all, then the DefaultTaggled() method is called
+    #    ..        : anything else, defaults to True
+    #### xxx NOTE : pending move towards a more elaborate mode for 'toggled'
+    # 
     #### internal data
     # . domid: created internally, but can be set at creation time if needed
     #          useful for hand-made css, or for selecting an active plugin in a composite