Skip to content

Commit

Permalink
added puppeteer banner directive
Browse files Browse the repository at this point in the history
  • Loading branch information
gbervik committed Feb 22, 2016
1 parent c7abdd9 commit 8515047
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -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": [
"**/.*",
Expand Down
10 changes: 10 additions & 0 deletions src/angular-worldskills-utils.css
Original file line number Diff line number Diff line change
@@ -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;
}
19 changes: 19 additions & 0 deletions src/angular-worldskills-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '<div class="puppet-banner">{{auth.user.puppeteer.first_name}} {{auth.user.puppeteer.last_name}} logged in as {{auth.user.first_name}} {{auth.user.last_name}}</div>',
link: link,
};
});

})();

0 comments on commit 8515047

Please sign in to comment.