Skip to content

Commit

Permalink
created user-menu on top left of header
Browse files Browse the repository at this point in the history
  • Loading branch information
turbo-ele committed Sep 30, 2013
1 parent 07f3462 commit 7996501
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 14 deletions.
2 changes: 1 addition & 1 deletion assets/js/husky/dist/husky.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/js/husky/dist/husky.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion demos/header/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</head>
<body>

<div data-aura-component="header@husky" ></div>
<div data-aura-component="header@husky" data-aura-user-name="John Doe" data-aura-logout-url="logout" ></div>

<script src="../js/sinon.js"></script>
<script src="../js/jquery.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion dist/husky.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/husky.min.css

Large diffs are not rendered by default.

23 changes: 16 additions & 7 deletions husky_components/header/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* marginMid: add 45px to navWidth
* marginRight: add 20px to margin mid part
* buttonType: type of button at start
* userName: username to be shown in left side of header
* logoutURL: logout link
* userIconURL: logout link
*
* Provided Events:
* husky.header.move-buttons: move middle part to match given navigation width
Expand Down Expand Up @@ -150,9 +153,13 @@ define([], function() {
}
},
defaults = {
marginMid: 45, // add 45px to navWidth
marginRight: 20, // add 20px to margin mid part
buttonType: null // type of button at start
marginMid: 45, // add 45px to navWidth
marginRight: 20, // add 20px to margin mid part
buttonType: null, // type of button at start
userName : null,
logoutUrl: null,
userIconUrl: null

};

return {
Expand Down Expand Up @@ -203,7 +210,7 @@ define([], function() {

// set default user
if (!!this.options.userName) {

this.changeUser(this.options.userName, this.options.logoutUrl, this.options.userIconUrl);
}
},

Expand Down Expand Up @@ -272,9 +279,11 @@ define([], function() {
}
},

changeUser: function(username, logoutlink, usericon) {
var logout = '<a href="' + logoutlink + '">Logout</a>';
this.$left.html(username + ' ' + logout);
changeUser: function(username, logoutLink, usericon) {
var icon = usericon ? '<img src="' + usericon + '" />' : '';
var logout = logoutLink ? '<a href="' + logoutLink + '" class="logout">Log out</a>' : '';
var userSpan = username ? '<span class="username" >' + username + '</span>' : '';
this.$left.html(icon + userSpan + ' ' + logout);
}
};
});
21 changes: 21 additions & 0 deletions scss/modules/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,31 @@ $header-padding-top: 10px;
z-index: 100;
}



.header-left {
position: absolute;

width: $header-left-width;


.username {
display: inline-block;
margin-top: $header-padding-top;
@extend %bold;
}

.logout {
margin-top: $header-padding-top;
margin-left: 5px;
text-decoration: none;
color: inherit;
font-size: 0.8em;

&:hover {
text-decoration: underline;
}
}
}

.header-right {
Expand Down
10 changes: 8 additions & 2 deletions scss/typo.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// --------------------------------------------------



@font-face {
font-family: 'MuseoSansCondensed300';
src: url('fonts/MuseoSansCondensed 300/MuseoSansCnd-300.eot');
Expand Down Expand Up @@ -76,6 +77,11 @@ h5 {
// Bold fonts
// -------------------------

.bold {
%bold {
font-family: 'MuseoSansCondensed700' !important;
}

}

.bold {
@extend %bold;
}

0 comments on commit 7996501

Please sign in to comment.