From 2c59023275130fa32c3a215df0c192b750aa190f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Sat, 14 Dec 2013 11:03:08 +0100 Subject: [PATCH] =?utf8?q?use=20the=20=E2=80=98pubsub=E2=80=99=20class=20a?= =?utf8?q?s=20a=20means=20to=20tag=20DOM=20elements=20that=20need=20to=20r?= =?utf8?q?eceive=20API=20events=20this=20is=20instead=20of=20the=20?= =?utf8?q?=E2=80=98plugin=E2=80=99=20class=20that=20was=20used=20previousl?= =?utf8?q?y,=20and=20that=20relied=20on=20the=20DOM=20building=20helpers?= =?utf8?q?=20and=20conventions=20that=20we=20have=20in=20place=20for=20?= =?utf8?q?=E2=80=98real=E2=80=99=20plugins=20However=20we=20want=20to=20be?= =?utf8?q?=20able=20to=20deal=20with=20plugins=20that=20piggyback=20on=20e?= =?utf8?q?xisting=20DOM=20elts=20that=20do=20not=20necessarily=20have=20.p?= =?utf8?q?lugin=20As=20a=20side=20effect=20the=20topmenu=20buttons=20do=20?= =?utf8?q?not=20need=20to=20have=20.plugin=20to=20work=20with=20validatebu?= =?utf8?q?tton?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- manifold/static/js/manifold.js | 4 ++-- manifold/static/js/plugin.js | 3 +++ ui/templates/widget-topmenu.html | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/manifold/static/js/manifold.js b/manifold/static/js/manifold.js index 58f28485..dc728264 100644 --- a/manifold/static/js/manifold.js +++ b/manifold/static/js/manifold.js @@ -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]); } }); }, diff --git a/manifold/static/js/plugin.js b/manifold/static/js/plugin.js index 41d8e8b0..fb7bf595 100644 --- a/manifold/static/js/plugin.js +++ b/manifold/static/js/plugin.js @@ -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; diff --git a/ui/templates/widget-topmenu.html b/ui/templates/widget-topmenu.html index 79f1bf83..12cddb92 100644 --- a/ui/templates/widget-topmenu.html +++ b/ui/templates/widget-topmenu.html @@ -28,7 +28,7 @@ {% else %} -
  • {{ d.label }}
  • {% endif %} -- 2.43.0