From 48bcb662c6af61cdc7b4d9d3d80b3d99af56a893 Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 15 Dec 2014 10:17:00 -0800 Subject: [PATCH] [Indicators] Add notion of indicators Add indicators as a category-of-extension, utilized from the bottom bar to populate its contents. WTD-608. --- platform/commonUI/general/bundle.json | 5 +++ .../general/res/templates/bottombar.html | 26 +++++++++----- .../general/src/BottomBarController.js | 36 +++++++++++++++++++ 3 files changed, 59 insertions(+), 8 deletions(-) create mode 100644 platform/commonUI/general/src/BottomBarController.js diff --git a/platform/commonUI/general/bundle.json b/platform/commonUI/general/bundle.json index e647ebf6b2..54399c428e 100644 --- a/platform/commonUI/general/bundle.json +++ b/platform/commonUI/general/bundle.json @@ -42,6 +42,11 @@ "key": "ViewSwitcherController", "implementation": "ViewSwitcherController.js", "depends": [ "$scope" ] + }, + { + "key": "BottomBarController", + "implementation": "BottomBarController.js", + "depends": [ "indicators[]" ] } ], "directives": [ diff --git a/platform/commonUI/general/res/templates/bottombar.html b/platform/commonUI/general/res/templates/bottombar.html index fc62d56f91..67a7e5731d 100644 --- a/platform/commonUI/general/res/templates/bottombar.html +++ b/platform/commonUI/general/res/templates/bottombar.html @@ -1,13 +1,23 @@ -
+
-
- . - Connected +
+ + {{indicator.getGlyph()}} + + + {{indicator.getText()}} + + + G +
-
\ No newline at end of file diff --git a/platform/commonUI/general/src/BottomBarController.js b/platform/commonUI/general/src/BottomBarController.js new file mode 100644 index 0000000000..0c94d94802 --- /dev/null +++ b/platform/commonUI/general/src/BottomBarController.js @@ -0,0 +1,36 @@ +/*global define*/ + +define( + [], + function () { + "use strict"; + + /** + * Controller for the bottombar template. Exposes + * available indicators (of extension category "indicators") + * @constructor + */ + function BottomBarController(indicators) { + // Utility function used to instantiate indicators + // from their injected constructors. + function instantiate(Indicator) { + return new Indicator(); + } + + indicators = indicators.map(instantiate); + + return { + /** + * Get all indicators to display. + * @returns {Indicator[]} all indicators + * to display in the bottom bar. + */ + getIndicators: function () { + return indicators; + } + }; + } + + return BottomBarController; + } +); \ No newline at end of file