use the ‘pubsub’ class as a means to tag DOM elements that need to receive API events
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 10:03:08 +0000 (11:03 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 14 Dec 2013 10:03:08 +0000 (11:03 +0100)
this is instead of the ‘plugin’ class that was used previously, and that relied on the
DOM building helpers and conventions that we have in place for ‘real’ plugins
However we want to be able to deal with plugins that piggyback on existing DOM elts
that do not necessarily have .plugin
As a side effect the topmenu buttons do not need to have .plugin to work with validatebutton

manifold/static/js/manifold.js
manifold/static/js/plugin.js
ui/templates/widget-topmenu.html

index 58f2848..dc72826 100644 (file)
@@ -780,10 +780,10 @@ var manifold = {
         $.each(channels, function(i, channel) {
             if (value === undefined) {
                if (manifold.publish_result_debug) messages.debug("triggering [no value] on channel="+channel+" and event_type="+event_type);
-                $('.plugin').trigger(channel, [event_type]);
+                $('.pubsub').trigger(channel, [event_type]);
             } else {
                if (manifold.publish_result_debug) messages.debug("triggering [value="+value+"] on channel="+channel+" and event_type="+event_type);
-                $('.plugin').trigger(channel, [event_type, value]);
+                $('.pubsub').trigger(channel, [event_type, value]);
             }
         });
     },
index 41d8e8b..fb7bf59 100644 (file)
@@ -30,6 +30,9 @@ var Plugin = Class.extend({
         // reference and a normal reference
         this.element  = element;
         this.$element = $(element);
+       // programmatically add specific class for publishing events
+       // used in manifold.js for triggering API events
+       if ( ! this.$element.hasClass('pubsub')) this.$element.addClass('pubsub');
 
         // return this so we can chain/use the bridge with less code.
         return this;
index 79f1bf8..12cddb9 100644 (file)
@@ -28,7 +28,7 @@
          </ul>
         </li>
         {% else %} 
-       <li class='{% if d.is_active %}active{% else %}other{% endif %} plugin{% if d.disabled %} disabled{%endif%}'
+       <li class='{% if d.is_active %}active{% else %}other{% endif %}{% if d.disabled %} disabled{%endif%}'
        {% if d.domid %} id='{{d.domid}}'{% endif %}>
        <a href="{{ d.href }}"> {{ d.label }} </a> </li>
        {% endif %}