From 67fb2a6dd0e2598441f0f3120e6de2328ad98b1c Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 20 Apr 2015 15:22:46 +0200 Subject: [PATCH] profile timeline with the new front architecture --- app/coffee/app.coffee | 2 +- app/coffee/modules/profile.coffee | 22 -- app/coffee/modules/profile/main.coffee | 24 -- .../profile/profile-tabs.directive.coffee | 26 -- .../timeline-attachment.directive.coffee | 29 --- .../profile/includes}/profile-bar.jade | 0 .../profile/includes}/profile-contacts.jade | 0 .../profile/includes}/profile-favorites.jade | 0 .../profile/includes}/profile-projects.jade | 0 .../profile/includes}/profile-sidebar.jade | 0 .../profile/includes}/profile-timeline.jade | 2 +- .../profile-tab}/profile-tab.directive.coffee | 0 .../profile-tabs.controller.coffee | 14 + .../profile-tabs.controller.spec.coffee | 41 +++ .../profile-tabs.directive.coffee | 11 + .../profile/profile-tabs/profile-tabs.jade | 7 + .../profile-timeline-attachment-image.jade} | 0 ...ofile-timeline-attachment.directive.coffee | 34 +++ ...-timeline-attachment.directive.spec.coffee | 58 +++++ .../profile-timeline-attachment.jade | 3 + ...profile-timeline-item-title.service.coffee | 90 +++++++ ...le-timeline-item-title.service.spec.coffee | 244 ++++++++++++++++++ ...profile-timeline-item-type.service.coffee} | 124 +-------- ...ile-timeline-item-type.service.spec.coffee | 31 +++ .../profile-timeline-item.controller.coffee | 40 +++ ...ofile-timeline-item.controller.spec.coffee | 101 ++++++++ .../profile-timeline-item.directive.coffee | 13 + .../profile-timeline-item.jade | 22 ++ .../profile-timeline.controller.coffee | 45 +++- .../profile-timeline.controller.spec.coffee | 116 +++++++++ .../profile-timeline}/profile-timeline.scss | 0 .../profile/profile.jade} | 14 +- app/modules/profile/profile.module.coffee | 1 + .../layout => modules/profile}/profile.scss | 0 .../profile/styles}/profile-bar.scss | 0 .../profile/styles}/profile-contacts.scss | 0 .../profile/styles}/profile-content-tabs.scss | 0 .../profile/styles}/profile-favorites.scss | 0 .../profile/styles}/profile-projects.scss | 0 .../profile/styles}/profile-sidebar.scss | 0 app/partials/profile/profile-tabs.jade | 7 - .../profile/timeline/timeline-attachment.jade | 3 - .../profile/timeline/timeline-item.jade | 22 -- gulpfile.js | 3 +- 44 files changed, 871 insertions(+), 278 deletions(-) delete mode 100644 app/coffee/modules/profile.coffee delete mode 100644 app/coffee/modules/profile/main.coffee delete mode 100644 app/coffee/modules/profile/profile-tabs.directive.coffee delete mode 100644 app/coffee/modules/profile/timeline-attachment.directive.coffee rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-bar.jade (100%) rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-contacts.jade (100%) rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-favorites.jade (100%) rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-projects.jade (100%) rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-sidebar.jade (100%) rename app/{partials/includes/modules/profile => modules/profile/includes}/profile-timeline.jade (67%) rename app/{coffee/modules/profile => modules/profile/profile-tab}/profile-tab.directive.coffee (100%) create mode 100644 app/modules/profile/profile-tabs/profile-tabs.controller.coffee create mode 100644 app/modules/profile/profile-tabs/profile-tabs.controller.spec.coffee create mode 100644 app/modules/profile/profile-tabs/profile-tabs.directive.coffee create mode 100644 app/modules/profile/profile-tabs/profile-tabs.jade rename app/{partials/profile/timeline/timeline-attachment-image.jade => modules/profile/profile-timeline-attachment/profile-timeline-attachment-image.jade} (100%) create mode 100644 app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.coffee create mode 100644 app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.spec.coffee create mode 100644 app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.jade create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.coffee create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.spec.coffee rename app/{coffee/modules/profile/timeline-item.directive.coffee => modules/profile/profile-timeline-item/profile-timeline-item-type.service.coffee} (58%) create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.spec.coffee create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item.controller.coffee create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item.controller.spec.coffee create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item.directive.coffee create mode 100644 app/modules/profile/profile-timeline-item/profile-timeline-item.jade rename app/{coffee/modules/profile => modules/profile/profile-timeline}/profile-timeline.controller.coffee (62%) create mode 100644 app/modules/profile/profile-timeline/profile-timeline.controller.spec.coffee rename app/{styles/modules/profile => modules/profile/profile-timeline}/profile-timeline.scss (100%) rename app/{partials/profile/public-profile.jade => modules/profile/profile.jade} (54%) create mode 100644 app/modules/profile/profile.module.coffee rename app/{styles/layout => modules/profile}/profile.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-bar.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-contacts.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-content-tabs.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-favorites.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-projects.scss (100%) rename app/{styles/modules/profile => modules/profile/styles}/profile-sidebar.scss (100%) delete mode 100644 app/partials/profile/profile-tabs.jade delete mode 100644 app/partials/profile/timeline/timeline-attachment.jade delete mode 100644 app/partials/profile/timeline/timeline-item.jade diff --git a/app/coffee/app.coffee b/app/coffee/app.coffee index 30bc4e3e..efacc87a 100644 --- a/app/coffee/app.coffee +++ b/app/coffee/app.coffee @@ -140,7 +140,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $tgEven # User profile $routeProvider.when("/profile", - {templateUrl: "profile/public-profile.html"}) + {templateUrl: "profile/profile.html"}) # Auth $routeProvider.when("/login", diff --git a/app/coffee/modules/profile.coffee b/app/coffee/modules/profile.coffee deleted file mode 100644 index a32f6001..00000000 --- a/app/coffee/modules/profile.coffee +++ /dev/null @@ -1,22 +0,0 @@ -### -# Copyright (C) 2014 Andrey Antukh -# Copyright (C) 2014 Jesús Espino Garcia -# Copyright (C) 2014 David Barragán Merino -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# File: modules/team.coffee -### - -module = angular.module("taigaProfile", []) diff --git a/app/coffee/modules/profile/main.coffee b/app/coffee/modules/profile/main.coffee deleted file mode 100644 index 6a97f450..00000000 --- a/app/coffee/modules/profile/main.coffee +++ /dev/null @@ -1,24 +0,0 @@ -### -# Copyright (C) 2014 Andrey Antukh -# Copyright (C) 2014 Jesús Espino Garcia -# Copyright (C) 2014 David Barragán Merino -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -# File: modules/team/main.coffee -### - -taiga = @.taiga - -module = angular.module("taigaProfile") diff --git a/app/coffee/modules/profile/profile-tabs.directive.coffee b/app/coffee/modules/profile/profile-tabs.directive.coffee deleted file mode 100644 index 9df742dd..00000000 --- a/app/coffee/modules/profile/profile-tabs.directive.coffee +++ /dev/null @@ -1,26 +0,0 @@ -class ProfileTabsController - constructor: (@scope) -> - @scope.tabs = [] - - addTab: (tab) -> - @scope.tabs.push(tab) - -ProfileTabsController.$inject = ["$scope"] - -ProfileTabsDirective = () -> - link = ($scope, $el, $attrs) -> - $scope.toggleTab = (tab) -> - _.map $scope.tabs, (tab) => tab.active = false - - tab.active = true - - return { - scope: {} - controller: ProfileTabsController - templateUrl: "profile/profile-tabs.html" - link: link - transclude: true - } - -angular.module("taigaProfile") - .directive("tgProfileTabs", ProfileTabsDirective) diff --git a/app/coffee/modules/profile/timeline-attachment.directive.coffee b/app/coffee/modules/profile/timeline-attachment.directive.coffee deleted file mode 100644 index 88669bdd..00000000 --- a/app/coffee/modules/profile/timeline-attachment.directive.coffee +++ /dev/null @@ -1,29 +0,0 @@ -TimelineAttachmentDirective = ($tgTemplate, $compile) -> - validFileExtensions = [".jpg", ".jpeg", ".bmp", ".gif", ".png"] - - isImage = (url) -> - url = url.toLowerCase() - - return _.some validFileExtensions, (extension) => - return url.indexOf(extension, url - extension.length) != -1 - - link = ($scope, $el, $attrs) -> - is_image = isImage($scope.attachment.url) - - if is_image - template = $tgTemplate.get("profile/timeline/timeline-attachment-image.html") - else - template = $tgTemplate.get("profile/timeline/timeline-attachment.html") - - $el.html(template) - $compile($el.contents())($scope) - - return { - link: link - scope: { - attachment: "=tgTimelineAttachment" - } - } - -angular.module("taigaProfile") - .directive("tgTimelineAttachment", ["$tgTemplate", "$compile", TimelineAttachmentDirective]) diff --git a/app/partials/includes/modules/profile/profile-bar.jade b/app/modules/profile/includes/profile-bar.jade similarity index 100% rename from app/partials/includes/modules/profile/profile-bar.jade rename to app/modules/profile/includes/profile-bar.jade diff --git a/app/partials/includes/modules/profile/profile-contacts.jade b/app/modules/profile/includes/profile-contacts.jade similarity index 100% rename from app/partials/includes/modules/profile/profile-contacts.jade rename to app/modules/profile/includes/profile-contacts.jade diff --git a/app/partials/includes/modules/profile/profile-favorites.jade b/app/modules/profile/includes/profile-favorites.jade similarity index 100% rename from app/partials/includes/modules/profile/profile-favorites.jade rename to app/modules/profile/includes/profile-favorites.jade diff --git a/app/partials/includes/modules/profile/profile-projects.jade b/app/modules/profile/includes/profile-projects.jade similarity index 100% rename from app/partials/includes/modules/profile/profile-projects.jade rename to app/modules/profile/includes/profile-projects.jade diff --git a/app/partials/includes/modules/profile/profile-sidebar.jade b/app/modules/profile/includes/profile-sidebar.jade similarity index 100% rename from app/partials/includes/modules/profile/profile-sidebar.jade rename to app/modules/profile/includes/profile-sidebar.jade diff --git a/app/partials/includes/modules/profile/profile-timeline.jade b/app/modules/profile/includes/profile-timeline.jade similarity index 67% rename from app/partials/includes/modules/profile/profile-timeline.jade rename to app/modules/profile/includes/profile-timeline.jade index 8bc2c435..7ec2c7ee 100644 --- a/app/partials/includes/modules/profile/profile-timeline.jade +++ b/app/modules/profile/includes/profile-timeline.jade @@ -1,3 +1,3 @@ section.profile-timeline(ng-controller="ProfileTimeline as ctrl") div(infinite-scroll="ctrl.loadTimeline()", infinite-scroll-distance="3", infinite-scroll-disabled='ctrl.loadingData') - div(ng-repeat="timeline in ctrl.timelineList", tg-timeline-item="timeline") + div(ng-repeat="timeline in ctrl.timelineList", tg-profile-timeline-item="timeline") diff --git a/app/coffee/modules/profile/profile-tab.directive.coffee b/app/modules/profile/profile-tab/profile-tab.directive.coffee similarity index 100% rename from app/coffee/modules/profile/profile-tab.directive.coffee rename to app/modules/profile/profile-tab/profile-tab.directive.coffee diff --git a/app/modules/profile/profile-tabs/profile-tabs.controller.coffee b/app/modules/profile/profile-tabs/profile-tabs.controller.coffee new file mode 100644 index 00000000..00ac82f5 --- /dev/null +++ b/app/modules/profile/profile-tabs/profile-tabs.controller.coffee @@ -0,0 +1,14 @@ +class ProfileTabsController + constructor: () -> + @tabs = [] + + addTab: (tab) -> + @tabs.push(tab) + + toggleTab: (tab) -> + _.map @tabs, (tab) -> tab.active = false + + tab.active = true + +angular.module("taigaProfile") + .controller("ProfileTabs", ProfileTabsController) diff --git a/app/modules/profile/profile-tabs/profile-tabs.controller.spec.coffee b/app/modules/profile/profile-tabs/profile-tabs.controller.spec.coffee new file mode 100644 index 00000000..59312095 --- /dev/null +++ b/app/modules/profile/profile-tabs/profile-tabs.controller.spec.coffee @@ -0,0 +1,41 @@ +describe "ProfileTabsController", -> + myCtrl = scope = null + + beforeEach -> + module "taigaProfile" + + inject ($controller) -> + scope = {} + myCtrl = $controller "ProfileTabs", + $scope: scope + + it "tabs should be an array", () -> + expect(myCtrl.tabs).is.an("array") + + it "add new tab", () -> + tab = {"fakeTab": true} + + myCtrl.addTab(tab) + + expect(myCtrl.tabs[0]).to.be.eql(tab) + + it "toggleTab, mark the tab passed as parameter to active", () -> + fakeTabs = [ + {id: 1}, + {id: 2}, + {id: 3} + ] + + myCtrl.tabs = fakeTabs + + myCtrl.toggleTab(fakeTabs[1]) + + expect(myCtrl.tabs[0].active).to.be.false + expect(myCtrl.tabs[1].active).to.be.true + expect(myCtrl.tabs[2].active).to.be.false + + myCtrl.toggleTab(fakeTabs[0]) + + expect(myCtrl.tabs[0].active).to.be.true + expect(myCtrl.tabs[1].active).to.be.false + expect(myCtrl.tabs[2].active).to.be.false diff --git a/app/modules/profile/profile-tabs/profile-tabs.directive.coffee b/app/modules/profile/profile-tabs/profile-tabs.directive.coffee new file mode 100644 index 00000000..999e2900 --- /dev/null +++ b/app/modules/profile/profile-tabs/profile-tabs.directive.coffee @@ -0,0 +1,11 @@ +ProfileTabsDirective = () -> + return { + scope: {} + controller: "ProfileTabs" + controllerAs: "vm" + templateUrl: "profile/profile-tabs/profile-tabs.html" + transclude: true + } + +angular.module("taigaProfile") + .directive("tgProfileTabs", ProfileTabsDirective) diff --git a/app/modules/profile/profile-tabs/profile-tabs.jade b/app/modules/profile/profile-tabs/profile-tabs.jade new file mode 100644 index 00000000..727a4d3e --- /dev/null +++ b/app/modules/profile/profile-tabs/profile-tabs.jade @@ -0,0 +1,7 @@ +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)") + span.icon(ng-class="::tab.icon") + span {{::tab.name}} + + ng-transclude \ No newline at end of file diff --git a/app/partials/profile/timeline/timeline-attachment-image.jade b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment-image.jade similarity index 100% rename from app/partials/profile/timeline/timeline-attachment-image.jade rename to app/modules/profile/profile-timeline-attachment/profile-timeline-attachment-image.jade diff --git a/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.coffee b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.coffee new file mode 100644 index 00000000..268bcd73 --- /dev/null +++ b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.coffee @@ -0,0 +1,34 @@ +ProfileTimelineAttachmentDirective = (template, $compile) -> + validFileExtensions = [".jpg", ".jpeg", ".bmp", ".gif", ".png"] + + isImage = (url) -> + url = url.toLowerCase() + + return _.some validFileExtensions, (extension) -> + return url.indexOf(extension, url - extension.length) != -1 + + link = (scope, el) -> + is_image = isImage(scope.attachment.url) + + if is_image + template = template.get("profile/profile-timeline-attachment/profile-timeline-attachment-image.html") + else + template = template.get("profile/profile-timeline-attachment/profile-timeline-attachment.html") + + el.html(template) + $compile(el.contents())(scope) + + return { + link: link + scope: { + attachment: "=tgProfileTimelineAttachment" + } + } + +ProfileTimelineAttachmentDirective.$inject = [ + "$tgTemplate", + "$compile" +] + +angular.module("taigaProfile") + .directive("tgProfileTimelineAttachment", ProfileTimelineAttachmentDirective) diff --git a/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.spec.coffee b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.spec.coffee new file mode 100644 index 00000000..c2e24a9d --- /dev/null +++ b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.directive.spec.coffee @@ -0,0 +1,58 @@ +describe "profileTimelineAttachmentDirective", () -> + element = scope = compile = provide = null + mockTgTemplate = null + template = "
" + + _mockTgTemplate= () -> + mockTgTemplate = { + get: sinon.stub() + } + + provide.value "$tgTemplate", mockTgTemplate + + _mocks = () -> + module ($provide) -> + provide = $provide + _mockTgTemplate() + + return null + + createDirective = () -> + elm = compile(template)(scope) + + return elm + + beforeEach -> + module "taigaProfile" + + _mocks() + + inject ($rootScope, $compile) -> + scope = $rootScope.$new() + compile = $compile + + it "attachment image template", () -> + scope.attachment = { + url: "path/path/file.jpg" + } + + mockTgTemplate.get + .withArgs("profile/profile-timeline-attachment/profile-timeline-attachment-image.html") + .returns("
") + + elm = createDirective() + + expect(elm.find('#image')).to.have.length(1) + + it "attachment file template", () -> + scope.attachment = { + url: "path/path/file.pdf" + } + + mockTgTemplate.get + .withArgs("profile/profile-timeline-attachment/profile-timeline-attachment.html") + .returns("
") + + elm = createDirective() + + expect(elm.find('#file')).to.have.length(1) diff --git a/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.jade b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.jade new file mode 100644 index 00000000..8deca77a --- /dev/null +++ b/app/modules/profile/profile-timeline-attachment/profile-timeline-attachment.jade @@ -0,0 +1,3 @@ +p TODO: ATTACHMENT +p + a(ng-href="attachment.url") {{attachment.filename}} \ No newline at end of file diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.coffee new file mode 100644 index 00000000..a4079994 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.coffee @@ -0,0 +1,90 @@ +class ProfileTimelineItemTitle + @.$inject = [ + "$translate" + ] + + _fieldTranslationKey: { + 'status': 'COMMON.FIELDS.STATUS', + 'subject': 'COMMON.FIELDS.SUBJECT', + 'description': 'COMMON.FIELDS.DESCRIPTION', + 'points': 'COMMON.FIELDS.POINTS', + 'severity': 'ISSUES.FIELDS.SEVERITY', + 'priority': 'ISSUES.FIELDS.PRIORITY', + 'type': 'ISSUES.FIELDS.TYPE', + 'is_iocaine': 'TASK.FIELDS.IS_IOCAINE' + } + + constructor: (@translate) -> + + + _translateTitleParams: (param, timeline, event) -> + if param == "username" + user = timeline.data.user + title_attr = @translate.instant('COMMON.SEE_USER_PROFILE', {username: user.username}) + url = 'user-profile:username=activity.user.username' + return @._getLink(url, user.username, title_attr) + + else if param == 'field_name' + field_name = Object.keys(timeline.data.values_diff)[0] + + return @translate.instant(@._fieldTranslationKey[field_name]) + + else if param == 'project_name' + url = 'project:project=activity.project.slug' + + return @._getLink(url, timeline.data.project.name) + + else if param == 'sprint_name' + url = 'project-taskboard:project=activity.project.slug,sprint=activity.sprint.slug' + + return @._getLink(url, timeline.data.milestone.name) + + else if param == 'obj_name' + obj = @._getTimelineObj(timeline, event) + url = @._getDetailObjUrl(event) + + if event.obj == 'wikipage' + text = obj.slug + else if event.obj == 'milestone' + text = obj.name + else + text = '#' + obj.ref + ' ' + obj.subject + + return @._getLink(url, text) + + _getTimelineObj: (timeline, event) -> + return timeline.data[event.obj] + + _getDetailObjUrl: (event) -> + url = { + "issue": ["project-issues-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.ref"], + "wikipage": ["project-wiki-page", ":project=vm.activity.project.slug,slug=vm.activity.obj.slug"], + "task": ["project-tasks-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.ref"], + "userstory": ["project-userstories-detail", ":project=vm.activity.project.slug,ref=vm.activity.obj.ref"], + "milestone": ["project-taskboard", ":project=vm.activity.project.slug,sprint=vm.activity.obj.slug"] + } + + return url[event.obj][0] + url[event.obj][1] + + _getLink: (url, text, title) -> + title = title || text + + return $('') + .attr('tg-nav', url) + .text(text) + .attr('title', title) + .prop('outerHTML') + + _getParams: (timeline, event, timeline_type) -> + params = {} + + timeline_type.translate_params.forEach (param) => + params[param] = @._translateTitleParams(param, timeline, event) + + return params + + getTitle: (timeline, event, type) -> + return @translate.instant(type.key, @._getParams(timeline, event, type)) + +angular.module("taigaProfile") + .service("tgProfileTimelineItemTitle", ProfileTimelineItemTitle) diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.spec.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.spec.coffee new file mode 100644 index 00000000..133dde8b --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item-title.service.spec.coffee @@ -0,0 +1,244 @@ +describe "tgProfileTimelineItemTitle", -> + mySvc = null + mockTranslate = null + timeline = event = type = null + + _mockTranslate = () -> + _provide (provide) -> + mockTranslate = { + instant: sinon.stub() + } + + provide.value "$translate", mockTranslate + + _provide = (callback) -> + module ($provide) -> + callback($provide) + return null + + _mocks = () -> + _mockTranslate() + + _inject = -> + inject (_tgProfileTimelineItemTitle_) -> + mySvc = _tgProfileTimelineItemTitle_ + + _setup = -> + _mocks() + _inject() + + beforeEach -> + module "taigaProfile" + _setup() + + it "title with username", () -> + timeline = { + data: { + user: { + username: 'xx' + } + } + } + + event = {} + + type = { + key: 'TITLE_USER_NAME', + translate_params: ['username'] + } + + mockTranslate.instant + .withArgs('COMMON.SEE_USER_PROFILE', {username: timeline.data.user.username}) + .returns('user-param') + + usernamelink = sinon.match ((value) -> + return value.username == 'xx' + ), "usernamelink" + + mockTranslate.instant + .withArgs('TITLE_USER_NAME', usernamelink) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title with a field name", () -> + timeline = { + data: { + values_diff: { + status: {} + } + } + } + + event = {} + + type = { + key: 'TITLE_FIELD', + translate_params: ['field_name'] + } + + mockTranslate.instant + .withArgs('COMMON.FIELDS.STATUS') + .returns('field-params') + + fieldparam = sinon.match ((value) -> + return value.field_name == 'field-params' + ), "fieldparam" + + mockTranslate.instant + .withArgs('TITLE_FIELD', fieldparam) + .returns('title_ok') + + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title with project name", () -> + timeline = { + data: { + project: { + name: "project_name" + } + } + } + + event = {} + + type = { + key: 'TITLE_PROJECT', + translate_params: ['project_name'] + } + + projectparam = sinon.match ((value) -> + return value.project_name == 'project_name' + ), "projectparam" + + mockTranslate.instant + .withArgs('TITLE_PROJECT', projectparam) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title with sprint name", () -> + timeline = { + data: { + milestone: { + name: "milestone_name" + } + } + } + + event = {} + + type = { + key: 'TITLE_MILESTONE', + translate_params: ['sprint_name'] + } + + milestoneparam = sinon.match ((value) -> + return value.sprint_name == 'milestone_name' + ), "milestoneparam" + + mockTranslate.instant + .withArgs('TITLE_MILESTONE', milestoneparam) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title with object", () -> + timeline = { + data: { + issue: { + ref: '123', + subject: 'subject' + } + } + } + + event = { + obj: 'issue', + } + + type = { + key: 'TITLE_OBJ', + translate_params: ['obj_name'] + } + + objparam = sinon.match ((value) -> + return value.obj_name == '#123 subject' + ), "objparam" + + mockTranslate.instant + .withArgs('TITLE_OBJ', objparam) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title obj wiki", () -> + timeline = { + data: { + wikipage: { + slug: 'slugwiki', + } + } + } + + event = { + obj: 'wikipage', + } + + type = { + key: 'TITLE_OBJ', + translate_params: ['obj_name'] + } + + objparam = sinon.match ((value) -> + return value.obj_name == 'slugwiki' + ), "objparam" + + mockTranslate.instant + .withArgs('TITLE_OBJ', objparam) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") + + it "title obj milestone", () -> + timeline = { + data: { + milestone: { + name: 'milestone_name', + } + } + } + + event = { + obj: 'milestone', + } + + type = { + key: 'TITLE_OBJ', + translate_params: ['obj_name'] + } + + objparam = sinon.match ((value) -> + return value.obj_name == 'milestone_name' + ), "objparam" + + mockTranslate.instant + .withArgs('TITLE_OBJ', objparam) + .returns('title_ok') + + title = mySvc.getTitle(timeline, event, type) + + expect(title).to.be.equal("title_ok") diff --git a/app/coffee/modules/profile/timeline-item.directive.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.coffee similarity index 58% rename from app/coffee/modules/profile/timeline-item.directive.coffee rename to app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.coffee index 88e7083f..29987438 100644 --- a/app/coffee/modules/profile/timeline-item.directive.coffee +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.coffee @@ -150,126 +150,8 @@ timelineType = (timeline, event) -> return _.find types, (obj) -> return obj.check(timeline, event, field_name) -TimelineItemDirective = ($tgTemplate, $compile, $navUrls, $translate, $sce) -> - fieldTranslationKey = { - 'status': 'COMMON.FIELDS.STATUS', - 'subject': 'COMMON.FIELDS.SUBJECT', - 'description': 'COMMON.FIELDS.DESCRIPTION', - 'points': 'COMMON.FIELDS.POINTS', - 'severity': 'ISSUES.FIELDS.SEVERITY', - 'priority': 'ISSUES.FIELDS.PRIORITY', - 'type': 'ISSUES.FIELDS.TYPE', - 'is_iocaine': 'TASK.FIELDS.IS_IOCAINE' - } - - parseEventType = (event_type) -> - event_type = event_type.split(".") - - return { - section: event_type[0], - obj: event_type[1], - type: event_type[2] - } - - getDetailObjUrl = (event) -> - url = { - "issue": ["project-issues-detail", ":project=activity.project.slug,ref=activity.obj.ref"], - "wikipage": ["project-wiki-page", ":project=activity.project.slug,slug=activity.obj.slug"], - "task": ["project-tasks-detail", ":project=activity.project.slug,ref=activity.obj.ref"], - "userstory": ["project-userstories-detail", ":project=activity.project.slug,ref=activity.obj.ref"], - "milestone": ["project-taskboard", ":project=activity.project.slug,sprint=activity.obj.slug"] - } - - return url[event.obj][0] + url[event.obj][1] - - getLink = (url, text, title) -> - title = title || text - - return $('') - .attr('tg-nav', url) - .text(text) - .attr('title', title) - .prop('outerHTML') - - translate_params = { - username: (timeline) -> - user = timeline.data.user - title_attr = $translate.instant('COMMON.SEE_USER_PROFILE', {username: user.username}) - url = 'user-profile:username=activity.user.username' - return getLink(url, user.username, title_attr) - - field_name: (timeline) -> - field_name = Object.keys(timeline.data.values_diff)[0] - - return $translate.instant(fieldTranslationKey[field_name]) - - project_name: (timeline) -> - url = 'project:project=activity.project.slug' - - return getLink(url, timeline.data.project.name) - - sprint_name: (timeline) -> - url = 'project-taskboard:project=activity.project.slug,sprint=activity.sprint.slug' - - return getLink(url, timeline.data.milestone.name) - - obj_name: (timeline, event) -> - obj = getTimelineObj(timeline, event) - url = getDetailObjUrl(event) - - if event.obj == 'wikipage' - text = obj.slug - else if event.obj == 'milestone' - text = obj.name - else - text = '#' + obj.ref + ' ' + obj.subject - - return getLink(url, text) - } - - getTimelineObj = (timeline, event) -> - return timeline.data[event.obj] - - getParams = (timeline, event, timeline_type) -> - params = {} - - timeline_type.translate_params.forEach (param) -> - params[param] = translate_params[param](timeline, event) - - return params - - getTitle = (timeline, event, type) -> - return $translate.instant(type.key, getParams(timeline, event, type)) - - link = ($scope, $el, $attrs) -> - event = parseEventType($scope.timeline.event_type) - type = timelineType($scope.timeline, event) - - $scope.activity = {} - - $scope.activity.obj = getTimelineObj($scope.timeline, event) - $scope.activity.user = $scope.timeline.data.user - $scope.activity.project = $scope.timeline.data.project - $scope.activity.sprint = $scope.timeline.data.milestone - $scope.activity.title = getTitle($scope.timeline, event, type) - $scope.activity.created_formated = moment($scope.timeline.created).fromNow() - - if type.description - $scope.activity.description = $sce.trustAsHtml(type.description($scope.timeline)) - - if type.member - $scope.activity.member = type.member($scope.timeline) - - if $scope.timeline.data.values_diff?.attachments - $scope.activity.attachments = $scope.timeline.data.values_diff.attachments.new - - return { - link: link - templateUrl: "profile/timeline/timeline-item.html" - scope: { - timeline: "=tgTimelineItem" - } - } +class ProfileTimelineType + getType: (timeline, event) -> timelineType(timeline, event) angular.module("taigaProfile") - .directive("tgTimelineItem", ["$tgTemplate", "$compile", "$tgNavUrls", "$translate", "$sce", TimelineItemDirective]) + .service("tgProfileTimelineItemType", ProfileTimelineType) diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.spec.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.spec.coffee new file mode 100644 index 00000000..ecc15084 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item-type.service.spec.coffee @@ -0,0 +1,31 @@ +describe "tgProfileTimelineItemType", -> + mySvc = null + + _provide = (callback) -> + module ($provide) -> + callback($provide) + return null + + _inject = -> + inject (_tgProfileTimelineItemType_) -> + mySvc = _tgProfileTimelineItemType_ + + _setup = -> + _inject() + + beforeEach -> + module "taigaProfile" + _setup() + + it "get the timeline type", () -> + timeline = { + data: {} + } + + event = { + obj: 'membership' + } + + type = mySvc.getType(timeline, event) + + expect(type.key).to.be.equal("TIMELINE.NEW_MEMBER") diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.coffee new file mode 100644 index 00000000..e0cf1141 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.coffee @@ -0,0 +1,40 @@ +class ProfileTimelineItemController + @.$inject = [ + "$scope", + "$sce", + "tgProfileTimelineItemType", + "tgProfileTimelineItemTitle" + ] + + constructor: (@scope, @sce, @profileTimelineItemType, @profileTimelineItemTitle) -> + event = @parseEventType(@scope.vm.timeline.event_type) + type = @profileTimelineItemType.getType(@scope.vm.timeline, event) + + @.activity = {} + + @.activity.user = @scope.vm.timeline.data.user + @.activity.project = @scope.vm.timeline.data.project + @.activity.sprint = @scope.vm.timeline.data.milestone + @.activity.title = @profileTimelineItemTitle.getTitle(@scope.vm.timeline, event, type) + @.activity.created_formated = moment(@scope.vm.timeline.created).fromNow() + + if type.description + @.activity.description = @sce.trustAsHtml(type.description(@scope.vm.timeline)) + + if type.member + @.activity.member = type.member(@scope.vm.timeline) + + if @scope.vm.timeline.data.values_diff?.attachments + @.activity.attachments = @scope.vm.timeline.data.values_diff.attachments.new + + parseEventType: (event_type) -> + event_type = event_type.split(".") + + return { + section: event_type[0], + obj: event_type[1], + type: event_type[2] + } + +angular.module("taigaProfile") + .controller("ProfileTimelineItem", ProfileTimelineItemController) diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.spec.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.spec.coffee new file mode 100644 index 00000000..5f59fbd0 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item.controller.spec.coffee @@ -0,0 +1,101 @@ +describe "ProfileTimelineItemController", -> + controller = scope = provide = null + timeline = event = null + mockTgProfileTimelineItemType = null + mockTgProfileTimelineItemTitle = null + mockType = null + + _mockTgProfileTimelineItemType = () -> + mockTgProfileTimelineItemType = { + getType: sinon.stub() + } + + mockType = { + description: sinon.stub(), + member: sinon.stub() + } + + mockTgProfileTimelineItemType.getType.withArgs(timeline).returns(mockType) + + provide.value "tgProfileTimelineItemType", mockTgProfileTimelineItemType + + _mockTgProfileTimelineItemTitle = () -> + mockTgProfileTimelineItemTitle = { + getTitle: sinon.stub() + } + + mockTgProfileTimelineItemTitle.getTitle.withArgs(timeline, event, mockType).returns("fakeTitle") + + provide.value "tgProfileTimelineItemTitle", mockTgProfileTimelineItemTitle + + _mocks = () -> + module ($provide) -> + provide = $provide + _mockTgProfileTimelineItemType() + _mockTgProfileTimelineItemTitle() + + return null + + _setup = () -> + event = { + section: 'issues', + obj: 'issue', + type: 'created' + } + + timeline = { + event_type: 'issues.issue.created', + data: { + user: 'user_fake', + project: 'project_fake', + milestone: 'milestone_fake', + created: new Date().getTime(), + values_diff: {} + } + } + + scope = { + vm: { + timeline: timeline + } + } + + beforeEach -> + module "taigaProfile" + + _setup() + _mocks() + + inject ($controller) -> + controller = $controller + + it "basic activity fields filled", () -> + timeline = scope.vm.timeline + + myCtrl = controller("ProfileTimelineItem", {$scope: scope}) + + expect(myCtrl.activity.user).to.be.equal(timeline.data.user) + expect(myCtrl.activity.project).to.be.equal(timeline.data.project) + expect(myCtrl.activity.sprint).to.be.equal(timeline.data.milestone) + expect(myCtrl.activity.title).to.be.equal("fakeTitle") + expect(myCtrl.activity.created_formated).to.have.length.above(1) + + it "all activity fields filled", () -> + timeline = scope.vm.timeline + + attachment = "fakeAttachment" + timeline.data.values_diff.attachments = { + new: attachment + } + + description = "fakeDescription" + member = "fakeMember" + + mockType.description.withArgs(timeline).returns(description) + mockType.member.withArgs(timeline).returns(member) + + myCtrl = controller("ProfileTimelineItem", {$scope: scope}) + + expect(myCtrl.activity.description).to.be.an('object') # $sce.trustAsHtml + expect(myCtrl.activity.member).to.be.equal(member) + expect(myCtrl.activity.attachments).to.be.equal(attachment) diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item.directive.coffee b/app/modules/profile/profile-timeline-item/profile-timeline-item.directive.coffee new file mode 100644 index 00000000..d15cf6b9 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item.directive.coffee @@ -0,0 +1,13 @@ +ProfileTimelineItemDirective = () -> + return { + controllerAs: "vm" + controller: "ProfileTimelineItem" + bindToController: true + templateUrl: "profile/profile-timeline-item/profile-timeline-item.html" + scope: { + timeline: "=tgProfileTimelineItem" + } + } + +angular.module("taigaProfile") + .directive("tgProfileTimelineItem", ProfileTimelineItemDirective) diff --git a/app/modules/profile/profile-timeline-item/profile-timeline-item.jade b/app/modules/profile/profile-timeline-item/profile-timeline-item.jade new file mode 100644 index 00000000..64471945 --- /dev/null +++ b/app/modules/profile/profile-timeline-item/profile-timeline-item.jade @@ -0,0 +1,22 @@ +div.activity-image + span.activity-date {{::vm.activity.created_formated}} + div.activity-info + div.profile-contact-picture + a(tg-nav="user-profile:username=vm.activity.user.username", title="{{::vm.activity.user.name }}") + img(ng-src="{{::vm.activity.user.photo}}", alt="{{::vm.activity.user.name}}") + + p(tg-compile-html="vm.activity.title") + + .activity-comment-quote(ng-if="::vm.activity.description") + p(ng-bind-html="vm.activity.description") + + .activity-member-view(ng-if="::vm.activity.member") + .profile-member-picture + img(ng-src="{{::vm.activity.member.user.photo}}", alt="{{::vm.activity.member.user.name}}") + .activity-member-info + a(tg-nav="user-profile:username=activity.member.user.username", title="{{::vm.activity.member.user.name }}") + span {{::vm.activity.member.user.name}} + p {{::vm.activity.member.role.name}} + +div(ng-repeat="attachment in vm.activity.attachments") + div(tg-profile-timeline-attachment="vm.attachment") \ No newline at end of file diff --git a/app/coffee/modules/profile/profile-timeline.controller.coffee b/app/modules/profile/profile-timeline/profile-timeline.controller.coffee similarity index 62% rename from app/coffee/modules/profile/profile-timeline.controller.coffee rename to app/modules/profile/profile-timeline/profile-timeline.controller.coffee index acaaa365..714d89ae 100644 --- a/app/coffee/modules/profile/profile-timeline.controller.coffee +++ b/app/modules/profile/profile-timeline/profile-timeline.controller.coffee @@ -29,21 +29,39 @@ class ProfileTimelineController extends mixOf(taiga.Controller, taiga.PageMixin, "$tgAuth" ] - valid_fields: ['status', 'subject', 'description', 'assigned_to', 'points', 'severity', 'priority', 'type', 'attachments', 'milestone', 'is_blocked', 'is_iocaine', 'content_diff', 'name', 'estimated_finish', 'estimated_start'] + _valid_fields: [ + 'status', + 'subject', + 'description', + 'assigned_to', + 'points', + 'severity', + 'priority', + 'type', + 'attachments', + 'milestone', + 'is_blocked', + 'is_iocaine', + 'content_diff', + 'name', + 'estimated_finish', + 'estimated_start' + ] constructor: (@rs, @auth) -> - @timelineList = [] - @pagination = {page: 1} + @.timelineList = [] + @.pagination = {page: 1} + @.loadingData = false - isValidField: (values) => - return _.some values, (value) => @valid_fields.indexOf(value) != -1 + _isValidField: (values) => + return _.some values, (value) => @._valid_fields.indexOf(value) != -1 - filterValidTimelineItems: (timeline) => + _filterValidTimelineItems: (timeline) => if timeline.data.values_diff values = Object.keys(timeline.data.values_diff) if values && values.length - if !@isValidField(values) + if !@._isValidField(values) return false else if values[0] == 'attachments' && timeline.data.values_diff.attachments.new.length == 0 return false @@ -53,14 +71,13 @@ class ProfileTimelineController extends mixOf(taiga.Controller, taiga.PageMixin, loadTimeline: () -> user = @auth.getUser() - @loadingData = true + @.loadingData = true - return @rs.timeline.profile(user.id, @pagination).then (result) => - newTimelineList = _.filter result.data, @filterValidTimelineItems - - @timelineList = @timelineList.concat(newTimelineList) - @pagination.page++ - @loadingData = false + return @rs.timeline.profile(user.id, @.pagination).then (result) => + newTimelineList = _.filter result.data, @._filterValidTimelineItems + @.timelineList = @timelineList.concat(newTimelineList) + @.pagination.page++ + @.loadingData = false angular.module("taigaProfile") .controller("ProfileTimeline", ProfileTimelineController) diff --git a/app/modules/profile/profile-timeline/profile-timeline.controller.spec.coffee b/app/modules/profile/profile-timeline/profile-timeline.controller.spec.coffee new file mode 100644 index 00000000..18669f00 --- /dev/null +++ b/app/modules/profile/profile-timeline/profile-timeline.controller.spec.coffee @@ -0,0 +1,116 @@ +describe "ProfileTimelineController", -> + myCtrl = scope = $q = provide = null + + mockUser = {id: 3} + + _mockTgResources = () -> + provide.value "$tgResources", { + timeline: {} + } + + _mockTgAuth = () -> + provide.value "$tgAuth", { + getUser: () -> + return mockUser + } + + _mocks = () -> + module ($provide) -> + provide = $provide + _mockTgResources() + _mockTgAuth() + + return null + + + beforeEach -> + module "taigaProfile" + _mocks() + + inject ($controller, _$q_) -> + $q = _$q_ + myCtrl = $controller "ProfileTimeline" + + it "timelineList should be an array", () -> + expect(myCtrl.timelineList).is.an("array") + + + it "pagination starts at 1", () -> + expect(myCtrl.pagination.page).to.be.equal(1) + + describe "load timeline", () -> + thenStub = timelineList = null + + beforeEach () -> + timelineList = { + data: [ + { # valid item + data: { + values_diff: { + "status": "xx", + "subject": "xx" + } + } + }, + { # invalid item + data: { + values_diff: { + "fake": "xx" + } + } + }, + { # invalid item + data: { + values_diff: { + "fake2": "xx" + } + } + }, + { # valid item + data: { + values_diff: { + "fake2": "xx", + "milestone": "xx" + } + } + } + ] + } + + thenStub = sinon.stub() + + profileStub = sinon.stub() + .withArgs(mockUser.id, myCtrl.pagination) + .returns({ + then: thenStub + }) + + myCtrl.rs.timeline.profile = profileStub + + it "the loadingData variable must be true during the timeline load", () -> + expect(myCtrl.loadingData).to.be.false + + myCtrl.loadTimeline() + + expect(myCtrl.loadingData).to.be.true + + thenStub.callArgWith(0, timelineList) + + expect(myCtrl.loadingData).to.be.false + + it "pagiantion increase one every call to loadTimeline", () -> + expect(myCtrl.pagination.page).to.equal(1) + + myCtrl.loadTimeline() + + thenStub.callArgWith(0, timelineList) + + expect(myCtrl.pagination.page).to.equal(2) + + it "filter the invalid timeline items", () -> + myCtrl.loadTimeline() + + thenStub.callArgWith(0, timelineList) + + expect(myCtrl.timelineList[0]).to.be.equal(timelineList.data[0]) + expect(myCtrl.timelineList[1]).to.be.equal(timelineList.data[3]) diff --git a/app/styles/modules/profile/profile-timeline.scss b/app/modules/profile/profile-timeline/profile-timeline.scss similarity index 100% rename from app/styles/modules/profile/profile-timeline.scss rename to app/modules/profile/profile-timeline/profile-timeline.scss diff --git a/app/partials/profile/public-profile.jade b/app/modules/profile/profile.jade similarity index 54% rename from app/partials/profile/public-profile.jade rename to app/modules/profile/profile.jade index 298a6637..ceede2d0 100644 --- a/app/partials/profile/public-profile.jade +++ b/app/modules/profile/profile.jade @@ -1,21 +1,21 @@ -include ../includes/components/beta +include ../../partials/includes/components/beta div.profile.centered - include ../includes/modules/profile/profile-bar + include includes/profile-bar div.main div.hero div(tg-profile-tabs) div.content-wrapper div.content div(tg-profile-tab="activity", tab-title="Activity Tab", tab-icon="icon-timeline", tab-active) - include ../includes/modules/profile/profile-timeline + include includes/profile-timeline div(tg-profile-tab="projects", tab-title="Projects Tab", tab-icon="icon-project") - include ../includes/modules/profile/profile-projects + include includes/profile-projects div(tg-profile-tab="contacts", tab-title="Contacts Tab", tab-icon="icon-team") - include ../includes/modules/profile/profile-contacts + include includes/profile-contacts div(tg-profile-tab="favorities", tab-title="Favorites Tab", tab-icon="icon-star-fill") - include ../includes/modules/profile/profile-favorites + include includes/profile-favorites - include ../includes/modules/profile/profile-sidebar + include includes/profile-sidebar diff --git a/app/modules/profile/profile.module.coffee b/app/modules/profile/profile.module.coffee new file mode 100644 index 00000000..8c55b9f8 --- /dev/null +++ b/app/modules/profile/profile.module.coffee @@ -0,0 +1 @@ +module = angular.module("taigaProfile", []) diff --git a/app/styles/layout/profile.scss b/app/modules/profile/profile.scss similarity index 100% rename from app/styles/layout/profile.scss rename to app/modules/profile/profile.scss diff --git a/app/styles/modules/profile/profile-bar.scss b/app/modules/profile/styles/profile-bar.scss similarity index 100% rename from app/styles/modules/profile/profile-bar.scss rename to app/modules/profile/styles/profile-bar.scss diff --git a/app/styles/modules/profile/profile-contacts.scss b/app/modules/profile/styles/profile-contacts.scss similarity index 100% rename from app/styles/modules/profile/profile-contacts.scss rename to app/modules/profile/styles/profile-contacts.scss diff --git a/app/styles/modules/profile/profile-content-tabs.scss b/app/modules/profile/styles/profile-content-tabs.scss similarity index 100% rename from app/styles/modules/profile/profile-content-tabs.scss rename to app/modules/profile/styles/profile-content-tabs.scss diff --git a/app/styles/modules/profile/profile-favorites.scss b/app/modules/profile/styles/profile-favorites.scss similarity index 100% rename from app/styles/modules/profile/profile-favorites.scss rename to app/modules/profile/styles/profile-favorites.scss diff --git a/app/styles/modules/profile/profile-projects.scss b/app/modules/profile/styles/profile-projects.scss similarity index 100% rename from app/styles/modules/profile/profile-projects.scss rename to app/modules/profile/styles/profile-projects.scss diff --git a/app/styles/modules/profile/profile-sidebar.scss b/app/modules/profile/styles/profile-sidebar.scss similarity index 100% rename from app/styles/modules/profile/profile-sidebar.scss rename to app/modules/profile/styles/profile-sidebar.scss diff --git a/app/partials/profile/profile-tabs.jade b/app/partials/profile/profile-tabs.jade deleted file mode 100644 index 9a4d3674..00000000 --- a/app/partials/profile/profile-tabs.jade +++ /dev/null @@ -1,7 +0,0 @@ -div - nav.profile-content-tabs - a.tab(ng-repeat="tab in tabs", href="", title="{{::tab.title}}", ng-class="{active: tab.active}" ng-click="toggleTab(tab)") - span.icon(ng-class="::tab.icon") - span {{::tab.name}} - - ng-transclude \ No newline at end of file diff --git a/app/partials/profile/timeline/timeline-attachment.jade b/app/partials/profile/timeline/timeline-attachment.jade deleted file mode 100644 index 22edecd8..00000000 --- a/app/partials/profile/timeline/timeline-attachment.jade +++ /dev/null @@ -1,3 +0,0 @@ -p TODO: ATTACHMENT -p - a(ng-href="attachment.url"){{attachment.filename}} \ No newline at end of file diff --git a/app/partials/profile/timeline/timeline-item.jade b/app/partials/profile/timeline/timeline-item.jade deleted file mode 100644 index ebf30734..00000000 --- a/app/partials/profile/timeline/timeline-item.jade +++ /dev/null @@ -1,22 +0,0 @@ -div.activity-image - span.activity-date {{::activity.created_formated}} - div.activity-info - div.profile-contact-picture - a(tg-nav="user-profile:username=activity.user.username", title="{{::activity.user.name }}") - img(ng-src="{{::activity.user.photo}}", alt="{{::activity.user.name}}") - - p(tg-compile-html="activity.title") - - .activity-comment-quote(ng-if="::activity.description") - p(ng-bind-html="activity.description") - - .activity-member-view(ng-if="::activity.member") - .profile-member-picture - img(ng-src="{{::activity.member.user.photo}}", alt="{{::activity.member.user.name}}") - .activity-member-info - a(tg-nav="user-profile:username=activity.member.user.username", title="{{::activity.member.user.name }}") - span {{::activity.member.user.name}} - p {{::activity.member.role.name}} - -div(ng-repeat="attachment in activity.attachments") - div(tg-timeline-attachment="attachment") \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index 3838ea8a..9a315e9b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -42,7 +42,8 @@ paths.htmlPartials = [ paths.tmp + "partials/**/*.html", paths.tmp + "plugins/**/*.html", paths.tmp + "modules/**/*.html", - "!" + paths.tmp + "partials/includes/**/*.html" + "!" + paths.tmp + "partials/includes/**/*.html", + "!" + paths.tmp + "/modules/**/includes/**/*.html" ]; paths.images = paths.app + "images/**/*";