US/904 logout & user photo in projects home

stable
Juanfran 2014-09-18 12:32:32 +02:00
parent 4c354e1399
commit c7fddedd87
3 changed files with 46 additions and 2 deletions

View File

@ -23,7 +23,6 @@ taiga = @.taiga
module = angular.module("taigaProject")
bindOnce = @.taiga.bindOnce
class ProjectsController extends taiga.Controller
@.$inject = [
"$scope",
@ -37,12 +36,14 @@ class ProjectsController extends taiga.Controller
"tgLoader"
]
constructor: (@scope, @rs, @rootscope, @navurls, @auth, @location, @appTitle, @projectUrl, @tgLoader) ->
constructor: (@scope, @rs, @rootscope, @navurls, @auth, @location, @appTitle, @projectUrl, @tgLoader, @navUrls) ->
@appTitle.set("Projects")
if !@auth.isAuthenticated()
@location.path(@navurls.resolve("login"))
@.user = @auth.getUser()
@.projects = []
@.loadInitialData()
.then () =>
@ -59,6 +60,10 @@ class ProjectsController extends taiga.Controller
newProject: ->
@rootscope.$broadcast("projects:create")
logout: ->
@auth.logout()
@location.path(@navurls.resolve("login"))
module.controller("ProjectsController", ProjectsController)

View File

@ -6,6 +6,16 @@ block head
block content
div.home-projects-list(ng-controller="ProjectsController as ctrl")
.home-projects-wrapper
div.welcome-user
div.info
p
| Welcome
span(tg-bo-bind="ctrl.user.full_name_display")
a.logout(ng-click="ctrl.logout()" href="", title="Logout") logout
.avatar(href="", title="User preferences")
img(ng-src="{{ctrl.user.photo}}", alt="username")
.home-projects-list-inner
div.recent-projects
ul

View File

@ -11,6 +11,35 @@
position: fixed;
top: 0;
width: 100%;
.welcome-user {
display: flex;
position: absolute;
right: 1rem;
top: 1rem;
p {
color: $whitish;
margin-bottom: 0;
span {
&:before {
content: ' ';
}
}
}
.logout {
@extend %small;
float: right;
&:hover {
color: $red-light;
}
}
.info {
padding: 10px 5px;
padding-right: 1rem;
}
img {
width: 60px;
}
}
}
.home-projects-wrapper {
@include table-flex-child(0, 1200px, 0, 1200px);