From 5374406d1e6b911c4a92a826b20ec6282ec31012 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 16 May 2014 16:26:27 +0100 Subject: [PATCH] Add new widget type, "Config", which allows configuration settings to be established for the team. For example:
Fixes bug MKWS-191. --- src/mkws-widget-main.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js index 161f61f..9271602 100644 --- a/src/mkws-widget-main.js +++ b/src/mkws-widget-main.js @@ -405,6 +405,21 @@ mkws.registerWidgetType('MOTD', function() { }); +// This widget has no functionality of its own, but its configuration +// is copied up into its team, allowing it to affect other widgets in +// the team. +// +mkws.registerWidgetType('Config', function() { + var c = this.config; + for (var name in c) { + if (c.hasOwnProperty(name)) { + this.team.config()[name] = c[name]; + this.log(this + " copied property " + name + "='" + c[name] + "' up to team"); + } + } +}); + + // Some elements have mkws* classes that makes them appear as widgets // -- for example, because we want to style them using CSS -- but have // no actual functionality. We register these to prevent ignorable -- 1.7.10.4