profile contacts
parent
3bf6a5ad7e
commit
a0617a9776
|
@ -538,7 +538,11 @@
|
|||
"PROJECTS": "Projects",
|
||||
"CLOSED_US": "Closed US",
|
||||
"CONTACTS": "Contacts",
|
||||
"REPORT": "Report Abuse"
|
||||
"REPORT": "Report Abuse",
|
||||
"ACTIVITY_TAB": "Activity Tab",
|
||||
"PROJECTS_TAB": "Projects Tab",
|
||||
"CONTACTS_TAB": "Contacts Tab",
|
||||
"FAVORITES_TAB": "Favorites Tab"
|
||||
}
|
||||
},
|
||||
"PROJECT": {
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
section.profile-contacts
|
||||
nav.profile-contact-filters
|
||||
a.active(href="", title="No Filter") all
|
||||
a(href="", title="Only show your team") team
|
||||
a(href="", title="Only show people you follow") following
|
||||
a(href="", title="Only show people follow you") followers
|
||||
- for (var x = 0; x < 3; x++)
|
||||
div.profile-contact-single
|
||||
div.profile-contact-picture
|
||||
a(href="", title="See {{ user.nickname }} profile")
|
||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/koridhandy/128.jpg", alt="{{ user.nickname }}")
|
||||
div.profile-contact-data
|
||||
h1
|
||||
a(href="", title="See {{ user.nickname}} profile") Sebastián Molina
|
||||
span.your-contact Your contact
|
||||
p Chief GIF Officer at myamazingpage.com. Tweet me at @sebas
|
||||
div.extra-info
|
||||
span.position Back-end developer & Stakeholder
|
||||
span.location Madrid
|
||||
div.profile-project-stats
|
||||
div.stat-projects(title="2 projects")
|
||||
span.icon.icon-project
|
||||
span.stat-num 2
|
||||
div.stat-viewer(title="2 followers")
|
||||
span.icon.icon-open-eye
|
||||
span.stat-num 4
|
||||
|
||||
div.profile-contact-single
|
||||
div.profile-contact-picture
|
||||
a(href="", title="See {{ user.nickname }} profile")
|
||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/marktimemedia/128.jpg", alt="{{ user.nickname }}")
|
||||
div.profile-contact-data
|
||||
h1
|
||||
a(href="", title="See {{ user.nickname}} profile") Ane Moreno
|
||||
p Have some experience working with sock monkeys in Orlando, FL. Crossed the country licensing bongos in Miami, FL. What gets me going now is deploying catfish in Bethesda, MD. Prior to my current job I was selling dandruff in Minneapolis, MN. In 2009 I was marketing Elvis Presley in Hanford, CA.
|
||||
div.extra-info
|
||||
span.position Monkey Socker & Deployer
|
||||
span.location Miami
|
||||
div.profile-project-stats
|
||||
div.stat-comments(title="2 comments")
|
||||
span.icon.icon-project
|
||||
span.stat-num 2
|
||||
div.stat-viewer(title="2 followers")
|
||||
span.icon.icon-open-eye
|
||||
span.stat-num 4
|
|
@ -0,0 +1,17 @@
|
|||
class ProfileContactsController
|
||||
@.$inject = [
|
||||
"tgUserService",
|
||||
"$tgAuth"
|
||||
]
|
||||
|
||||
constructor: (@userService, @auth) ->
|
||||
|
||||
loadContacts: () ->
|
||||
userId = @auth.getUser().id
|
||||
|
||||
@userService.getUserContacts(userId)
|
||||
.then (contacts) =>
|
||||
@.contacts = contacts
|
||||
|
||||
angular.module("taigaProfile")
|
||||
.controller("ProfileContacts", ProfileContactsController)
|
|
@ -0,0 +1,63 @@
|
|||
describe "ProfileContacts", ->
|
||||
$controller = null
|
||||
$q = null
|
||||
provide = null
|
||||
$rootScope = null
|
||||
mocks = {}
|
||||
|
||||
_mockUserService = () ->
|
||||
mocks.userService = {
|
||||
getUserContacts: sinon.stub()
|
||||
}
|
||||
|
||||
provide.value "tgUserService", mocks.userService
|
||||
|
||||
_mockAuthService = () ->
|
||||
stub = sinon.stub()
|
||||
|
||||
stub.returns({id: 2})
|
||||
|
||||
provide.value "$tgAuth", {
|
||||
getUser: stub
|
||||
}
|
||||
|
||||
_mocks = () ->
|
||||
module ($provide) ->
|
||||
provide = $provide
|
||||
_mockUserService()
|
||||
_mockAuthService()
|
||||
|
||||
return null
|
||||
|
||||
_inject = (callback) ->
|
||||
inject (_$controller_, _$q_, _$rootScope_) ->
|
||||
$q = _$q_
|
||||
$rootScope = _$rootScope_
|
||||
$controller = _$controller_
|
||||
|
||||
beforeEach ->
|
||||
module "taigaProfile"
|
||||
_mocks()
|
||||
_inject()
|
||||
|
||||
it "load projects with contacts attached", (done) ->
|
||||
userId = 2
|
||||
contacts = [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3}
|
||||
]
|
||||
|
||||
mocks.userService.getUserContacts = (userId) ->
|
||||
expect(userId).to.be.equal(userId)
|
||||
|
||||
return $q (resolve, reject) ->
|
||||
resolve(contacts)
|
||||
|
||||
ctrl = $controller("ProfileContacts")
|
||||
|
||||
ctrl.loadContacts().then () ->
|
||||
expect(ctrl.contacts).to.be.equal(contacts)
|
||||
done()
|
||||
|
||||
$rootScope.$apply()
|
|
@ -0,0 +1,13 @@
|
|||
ProfileContactsDirective = () ->
|
||||
link = (scope, elm, attrs, ctrl) ->
|
||||
ctrl.loadContacts()
|
||||
|
||||
return {
|
||||
templateUrl: "profile/profile-contacts/profile-contacts.html",
|
||||
scope: {},
|
||||
controllerAs: "vm",
|
||||
controller: "ProfileContacts",
|
||||
link: link
|
||||
}
|
||||
|
||||
angular.module("taigaProfile").directive("tgProfileContacts", ProfileContactsDirective)
|
|
@ -0,0 +1,30 @@
|
|||
section.profile-contacts
|
||||
// nav.profile-contact-filters
|
||||
// a.active(href="", title="No Filter") all
|
||||
// a(href="", title="Only show your team") team
|
||||
// a(href="", title="Only show people you follow") following
|
||||
// a(href="", title="Only show people follow you") followers
|
||||
|
||||
div.profile-contact-single(tg-repeat="contact in ::vm.contacts")
|
||||
div.profile-contact-picture
|
||||
a(tg-nav="user-profile:username=contact.username", title="{{::contact.name }}")
|
||||
img(ng-src='{{::contact.photo}}', alt='{{::contact.full_name}}')
|
||||
|
||||
div.profile-contact-data
|
||||
h1
|
||||
a(tg-nav="user-profile:username=contact.username", title="{{::contact.name }}")
|
||||
| {{::contact.full_name}}
|
||||
// span.your-contact Your contact
|
||||
|
||||
p(ng-if="contact.bio") {{::contact.bio}}
|
||||
|
||||
div.extra-info
|
||||
span.position {{::contact.roles.join(", ")}}
|
||||
// span.location todo
|
||||
// div.profile-project-stats
|
||||
// div.stat-projects(title="2 projects")
|
||||
// span.icon.icon-project
|
||||
// span.stat-num 2
|
||||
// div.stat-viewer(title="2 followers")
|
||||
// span.icon.icon-open-eye
|
||||
// span.stat-num 4
|
|
@ -2,8 +2,10 @@ ProfileTabDirective = () ->
|
|||
link = (scope, element, attrs, ctrl, transclude) ->
|
||||
scope.tab = {}
|
||||
|
||||
attrs.$observe "tabTitle", (title) ->
|
||||
scope.tab.title = title
|
||||
|
||||
scope.tab.name = attrs.tgProfileTab
|
||||
scope.tab.title = attrs.tabTitle
|
||||
scope.tab.icon = attrs.tabIcon
|
||||
scope.tab.active = !!attrs.tabActive
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
div
|
||||
nav.profile-content-tabs
|
||||
a.tab(ng-repeat="tab in ::vm.tabs", href="", title="{{::tab.title}}", ng-class="{active: tab.active}" ng-click="vm.toggleTab(tab)")
|
||||
a.tab(ng-repeat="tab in ::vm.tabs", href="", title="{{tab.title}}", ng-class="{active: tab.active}" ng-click="vm.toggleTab(tab)")
|
||||
span.icon(ng-class="::tab.icon")
|
||||
span {{::tab.name}}
|
||||
|
||||
|
|
|
@ -3,16 +3,16 @@ div.profile.centered
|
|||
include includes/profile-bar
|
||||
div.main
|
||||
div.timeline-wrapper(tg-profile-tabs)
|
||||
div(tg-profile-tab="activity", tab-title="Activity Tab", tab-icon="icon-timeline", tab-active)
|
||||
div(tg-profile-tab="activity", tab-title="{{'USER.PROFILE.ACTIVITY_TAB' | translate}}", tab-icon="icon-timeline", tab-active)
|
||||
div(tg-profile-timeline)
|
||||
|
||||
div(tg-profile-tab="projects", tab-title="Projects Tab", tab-icon="icon-project")
|
||||
div(tg-profile-tab="projects", tab-title="{{'USER.PROFILE.PROJECTS_TAB' | translate}}", tab-icon="icon-project")
|
||||
div(tg-profile-projects)
|
||||
|
||||
div(tg-profile-tab="contacts", tab-title="Contacts Tab", tab-icon="icon-team")
|
||||
include includes/profile-contacts
|
||||
div(tg-profile-tab="contacts", tab-title="{{'USER.PROFILE.CONTACTS_TAB' | translate}}", tab-icon="icon-team")
|
||||
div(tg-profile-contacts)
|
||||
|
||||
div(tg-profile-tab="favorites", tab-title="Favorites Tab", tab-icon="icon-star-fill")
|
||||
include includes/profile-favorites
|
||||
// div(tg-profile-tab="favorites", tab-title="{{'USER.PROFILE.FAVORITES_TAB' | translate}}", tab-icon="icon-star-fill")
|
||||
// include includes/profile-favorites
|
||||
|
||||
include includes/profile-sidebar
|
||||
|
|
|
@ -10,8 +10,7 @@ class UserService extends taiga.Service
|
|||
.then (projects) -> return Immutable.fromJS(projects)
|
||||
|
||||
attachUserContactsToProjects: (userId, projects) ->
|
||||
return @rs.users.contacts(userId)
|
||||
.then (contacts) -> return Immutable.fromJS(contacts)
|
||||
return @.getUserContacts(userId)
|
||||
.then (contacts) ->
|
||||
projects = projects.map (project) ->
|
||||
project.contacts = contacts.filter (contact) ->
|
||||
|
@ -22,4 +21,8 @@ class UserService extends taiga.Service
|
|||
|
||||
return projects
|
||||
|
||||
getUserContacts: (userId) ->
|
||||
return @rs.users.contacts(userId)
|
||||
.then (contacts) -> return Immutable.fromJS(contacts)
|
||||
|
||||
angular.module("taigaCommon").service("tgUserService", UserService)
|
||||
|
|
|
@ -91,3 +91,24 @@ describe.skip "UserService", ->
|
|||
done()
|
||||
|
||||
$rootScope.$apply()
|
||||
|
||||
it "get user contacts", (done) ->
|
||||
userId = 2
|
||||
|
||||
contacts = [
|
||||
{id: 1},
|
||||
{id: 2},
|
||||
{id: 3}
|
||||
]
|
||||
|
||||
mocks.resources.user.contacts = (userId) ->
|
||||
expect(userId).to.be.equal(userId)
|
||||
|
||||
return $q (resolve, reject) ->
|
||||
resolve(contacts)
|
||||
|
||||
userService.getUserContacts(userId).then (_contacts_) ->
|
||||
expect(_contacts_.toJS()).to.be.eql(contacts)
|
||||
done()
|
||||
|
||||
$rootScope.$apply()
|
||||
|
|
Loading…
Reference in New Issue