From 85150471d92e60eb17ef9a3d83b0c998ad26f8ea Mon Sep 17 00:00:00 2001 From: Adam Walsh Date: Mon, 22 Feb 2016 23:20:33 +1000 Subject: [PATCH] added puppeteer banner directive --- bower.json | 2 +- src/angular-worldskills-utils.css | 10 ++++++++++ src/angular-worldskills-utils.js | 19 +++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 src/angular-worldskills-utils.css diff --git a/bower.json b/bower.json index d7643fe..0a14098 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "angular-worldskills-utils", "homepage": "https://github.com/worldskills/angular-worldskills-utils", - "main": ["src/angular-worldskills-utils.js", "src/spinner.css"], + "main": ["src/angular-worldskills-utils.js", "src/spinner.css", "src/angular-worldskills-utils.css"], "license": "MIT", "ignore": [ "**/.*", diff --git a/src/angular-worldskills-utils.css b/src/angular-worldskills-utils.css new file mode 100644 index 0000000..b478701 --- /dev/null +++ b/src/angular-worldskills-utils.css @@ -0,0 +1,10 @@ +div.puppet-banner { + top: 0; + left: 0; + background-color: #d24835; + width: 100%; + padding: 10px; + color: white; + text-align: center; + height: 40px; +} \ No newline at end of file diff --git a/src/angular-worldskills-utils.js b/src/angular-worldskills-utils.js index 8e3e924..dec2c30 100644 --- a/src/angular-worldskills-utils.js +++ b/src/angular-worldskills-utils.js @@ -280,5 +280,24 @@ } }; }); + + utils.directive('wsPuppet', function (auth) { + function link(scope, element, attrs) { + scope.$watch(attrs.p, function(val) { + if (val) { + element.show(); + } + else { + element.hide(); + } + }); + } + + return { + restrict: 'E', + template: '
{{auth.user.puppeteer.first_name}} {{auth.user.puppeteer.last_name}} logged in as {{auth.user.first_name}} {{auth.user.last_name}}
', + link: link, + }; + }); })();