diff --git a/app/modules/profile/includes/profile-projects.jade b/app/modules/profile/includes/profile-projects.jade deleted file mode 100644 index 2963a7ee..00000000 --- a/app/modules/profile/includes/profile-projects.jade +++ /dev/null @@ -1,129 +0,0 @@ -section.profile-projects - - for (var x = 0; x < 3; x++) - div.project-list-single - div.project-list-single-left - - div.project-list-single-title - h1 - a(href="", title="View {{ project.title }}") My Side Project - p We plan to build a hundred of so called "telehubs" so people from all over the world can immediately relocate their physical self at any other telehub in microseconds. The technology and science behind this project is sound and we are now ready to build the first telehub and then massproduce them. - - div.project-list-single-tags.tags-container - // Tag border style has to be set by JS - span.tag(style='border-left: 5px solid #73d216;') - span.tag-name python - span.tag(style='border-left: 5px solid #cc0000;') - span.tag-name groovy - span.tag(style='border-left: 5px solid #25f45c;') - span.tag-name opensource - - div.project-list-single-right - - div.project-list-single-stats - div.stat-comments(title="2 comments") - span.icon.icon-comment - span.stat-num 2 - div.stat-favorite.active(title="2 favorites") - span.icon.icon-star-fill - span.stat-num 4 - div.stat-viewer(title="2 followers") - span.icon.icon-open-eye - span.stat-num 4 - - div.project-list-single-members - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/mantia/128.jpg") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/annapickard/128.jpg") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/nexy_dre/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/pixeliris/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/cbillins/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/allisongrayce/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/uxceo/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/syswarren/128.jpg", alt="{{ user.nickname }}") - - div.project-list-single - div.project-list-single-left - div.project-list-single-title - h1 - a(href="", title="View {{ project.title }}") Teletransportation hubs - - div.project-list-single-tags.tags-container - // Tag border style has to be set by JS - span.tag(style='border-left: 5px solid #43d56f;') - span.tag-name javascript - span.tag(style='border-left: 5px solid #0000cc;') - span.tag-name css - span.tag(style='border-left: 5px solid #cc43fd;') - span.tag-name design - - div.project-list-single-right - div.project-list-single-stats - div.stat-comments(title="2 comments") - span.icon.icon-comment - span.stat-num 2 - div.stat-favorite(title="2 favorites") - span.icon.icon-star-fill - span.stat-num 4 - div.stat-viewer(title="2 followers") - span.icon.icon-open-eye - span.stat-num 4 - div.project-list-single-members - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/mantia/128.jpg") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/annapickard/128.jpg") - - div.project-list-single - div.project-list-single-left - - div.project-list-single-title - h1 - a(href="", title="View {{ project.title }}") Taiga - p Una plataforma social para crear comunidad entorno a la tienda. Esta comunidad está pensada para quedar a hacer deporte, compartir iniciativas. - - div.project-list-single-tags.tags-container - // Tag border style has to be set by JS - span.tag(style='border-left: 5px solid #11cd00;') - span.tag-name PHP - span.tag(style='border-left: 5px solid #ff00dd;') - span.tag-name marketing - span.tag(style='border-left: 5px solid #cdcd54;') - span.tag-name wordpress - div.project-list-single-right - - div.project-list-single-stats - div.stat-comments - span.icon.icon-comment - span.stat-num 2 - div.stat-favorite.active - span.icon.icon-star-fill - span.stat-num 4 - div.stat-viewer - span.icon.icon-open-eye - span.stat-num 4 - - div.project-list-single-members - - for (var x = 0; x < 2; x++) - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/mantia/128.jpg") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/annapickard/128.jpg") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/nexy_dre/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/pixeliris/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/cbillins/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/allisongrayce/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/uxceo/128.jpg", alt="{{ user.nickname }}") - a(href="", title="View {{ user.nickname }} profile") - img(src="https://s3.amazonaws.com/uifaces/faces/twitter/syswarren/128.jpg", alt="{{ user.nickname }}") diff --git a/app/modules/profile/profile-projects/profile-projects.directive.coffee b/app/modules/profile/profile-projects/profile-projects.directive.coffee new file mode 100644 index 00000000..d58ea85c --- /dev/null +++ b/app/modules/profile/profile-projects/profile-projects.directive.coffee @@ -0,0 +1,17 @@ +ProfileProjectsDirective = (projectsService) -> + link = (scope, el, attrs, ctrl) -> + scope.vm = {} + taiga.defineImmutableProperty(scope.vm, "projects", () -> projectsService.projects.get("all")) + + directive = { + templateUrl: "profile/profile-projects/profile-projects.html" + scope: {} + link: link + } + + return directive + + +ProfileProjectsDirective.$inject = ["tgProjectsService"] + +angular.module("taigaProfile").directive("tgProfileProjects", ProfileProjectsDirective) diff --git a/app/modules/profile/profile-projects/profile-projects.jade b/app/modules/profile/profile-projects/profile-projects.jade new file mode 100644 index 00000000..b6c6cd16 --- /dev/null +++ b/app/modules/profile/profile-projects/profile-projects.jade @@ -0,0 +1,43 @@ +section.profile-projects + div.project-list-single(tg-repeat="project in vm.projects") + div.project-list-single-left + + div.project-list-single-title + h1 + a(href="#", tg-nav="project:project=project.slug", title="{{ ::project.name }}") {{::project.name}} + p {{ ::project.description | limitTo:300 }} + + div.project-list-single-tags.tags-container + span.tag(style='border-left: 5px solid {{::tag.color}};', ng-repeat="tag in ::project.colorized_tags") + span.tag-name {{::tag.name}} + + div.project-list-single-right + + div.project-list-single-stats + div.stat-comments(title="2 comments") + span.icon.icon-comment + span.stat-num 2 + div.stat-favorite.active(title="2 favorites") + span.icon.icon-star-fill + span.stat-num 4 + div.stat-viewer(title="2 followers") + span.icon.icon-open-eye + span.stat-num 4 + + div.project-list-single-members + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/mantia/128.jpg") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/annapickard/128.jpg") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/nexy_dre/128.jpg", alt="{{ user.nickname }}") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/pixeliris/128.jpg", alt="{{ user.nickname }}") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/cbillins/128.jpg", alt="{{ user.nickname }}") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/allisongrayce/128.jpg", alt="{{ user.nickname }}") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/uxceo/128.jpg", alt="{{ user.nickname }}") + a(href="", title="View {{ user.nickname }} profile") + img(src="https://s3.amazonaws.com/uifaces/faces/twitter/syswarren/128.jpg", alt="{{ user.nickname }}") diff --git a/app/modules/profile/profile.jade b/app/modules/profile/profile.jade index ceede2d0..88d88eb6 100644 --- a/app/modules/profile/profile.jade +++ b/app/modules/profile/profile.jade @@ -10,7 +10,7 @@ div.profile.centered include includes/profile-timeline div(tg-profile-tab="projects", tab-title="Projects Tab", tab-icon="icon-project") - include includes/profile-projects + div(tg-profile-projects) div(tg-profile-tab="contacts", tab-title="Contacts Tab", tab-icon="icon-team") include includes/profile-contacts diff --git a/app/modules/projects/projects.service.coffee b/app/modules/projects/projects.service.coffee index a2ea2ef8..11c41624 100644 --- a/app/modules/projects/projects.service.coffee +++ b/app/modules/projects/projects.service.coffee @@ -21,9 +21,21 @@ class ProjectsService extends taiga.Service @._projectsPromise = @rs.projects.listByMember(@rootScope.user?.id) @._projectsPromise.then (projects) => - for project in projects + _.map projects, (project) => project.url = @projectUrl.get(project) + + console.log project.memberships + + project.colorized_tags = [] + + if project.tags + tags = project.tags.sort() + + project.colorized_tags = _.map tags, (tag) -> + color = project.tags_colors[tag] + return {name: tag, color: color} + @._projects = Immutable.fromJS({ all: projects, recents: projects.slice(0, 10) diff --git a/app/modules/projects/projects.service.spec.coffee b/app/modules/projects/projects.service.spec.coffee index a34d4648..615ac5ce 100644 --- a/app/modules/projects/projects.service.spec.coffee +++ b/app/modules/projects/projects.service.spec.coffee @@ -64,7 +64,7 @@ describe "tgProjects", -> beforeEach -> projects = [ - {"id": 1}, + {"id": 1, tags: ['xx', 'yy', 'aa'], tags_colors: {xx: "red", yy: "blue", aa: "white"}}, {"id": 2}, {"id": 3}, {"id": 4}, @@ -113,6 +113,20 @@ describe "tgProjects", -> expect(projectsService.projects.get("all").toJS()[0].url).to.be.equal("url-1") expect(projectsService.projects.get("recents").toJS()[0].url).to.be.equal("url-1") + it "add sorted colorized_tags project object", () -> + mocks.thenStub.callArg(0, projects) + + tags = [ + {name: "aa", color: "white"}, + {name: "xx", color: "red"}, + {name: "yy", color: "blue"} + ]; + + + colorized_tags = projectsService.projects.get("all").toJS()[0].colorized_tags + + expect(colorized_tags).to.be.eql(tags) + it "newProject, create the wizard lightbox", () -> projectsService.newProject()