comments in timelines
parent
80fa5b7db3
commit
2c1de83d85
|
@ -58,6 +58,7 @@ urls = {
|
||||||
"create-project": "/create-project"
|
"create-project": "/create-project"
|
||||||
|
|
||||||
"profile": "/:user"
|
"profile": "/:user"
|
||||||
|
"user-profile": "profile/:username"
|
||||||
|
|
||||||
"project": "/project/:project"
|
"project": "/project/:project"
|
||||||
"project-backlog": "/project/:project/backlog"
|
"project-backlog": "/project/:project/backlog"
|
||||||
|
|
|
@ -194,6 +194,21 @@ class RepositoryService extends taiga.Service
|
||||||
result.paginatedBy = parseInt(headers["x-paginated-by"], 10)
|
result.paginatedBy = parseInt(headers["x-paginated-by"], 10)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
queryOnePaginatedRaw: (name, id, params, options={}) ->
|
||||||
|
url = @urls.resolve(name)
|
||||||
|
url = "#{url}/#{id}" if id
|
||||||
|
httpOptions = _.merge({headers: {}}, options)
|
||||||
|
|
||||||
|
return @http.get(url, params, httpOptions).then (data) =>
|
||||||
|
headers = data.headers()
|
||||||
|
result = {}
|
||||||
|
result.data = data.data
|
||||||
|
result.count = parseInt(headers["x-pagination-count"], 10)
|
||||||
|
result.current = parseInt(headers["x-pagination-current"] or 1, 10)
|
||||||
|
result.paginatedBy = parseInt(headers["x-paginated-by"], 10)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
resolve: (options) ->
|
resolve: (options) ->
|
||||||
params = {}
|
params = {}
|
||||||
params.project = options.pslug if options.pslug?
|
params.project = options.pslug if options.pslug?
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
###
|
||||||
|
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||||
|
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
|
||||||
|
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# File: modules/backlog/main.coffee
|
||||||
|
###
|
||||||
|
|
||||||
|
taiga = @.taiga
|
||||||
|
|
||||||
|
mixOf = @.taiga.mixOf
|
||||||
|
|
||||||
|
class ProfileTimelineController extends mixOf(taiga.Controller, taiga.PageMixin, taiga.FiltersMixin)
|
||||||
|
@.$inject = [
|
||||||
|
"$scope",
|
||||||
|
"$tgResources",
|
||||||
|
"$tgAuth"
|
||||||
|
]
|
||||||
|
|
||||||
|
constructor: (@scope, @rs, @auth) ->
|
||||||
|
promise = @.loadTimeline()
|
||||||
|
promise.then null, @.onInitialDataError.bind(@)
|
||||||
|
|
||||||
|
loadTimeline: () ->
|
||||||
|
user = @auth.getUser()
|
||||||
|
|
||||||
|
return @rs.timeline.profile(user.id).then (result) =>
|
||||||
|
@scope.result = result
|
||||||
|
console.log @scope.result.data
|
||||||
|
|
||||||
|
angular.module("taigaProfile")
|
||||||
|
.controller("ProfileTimeline", ProfileTimelineController)
|
|
@ -0,0 +1,58 @@
|
||||||
|
TimelineItemDirective = ($tgTemplate, $compile, $navUrls) ->
|
||||||
|
parseEventType = (event_type) ->
|
||||||
|
event_type = event_type.split(".")
|
||||||
|
|
||||||
|
return {
|
||||||
|
section: event_type[0],
|
||||||
|
obj: event_type[1],
|
||||||
|
type: event_type[2]
|
||||||
|
}
|
||||||
|
|
||||||
|
getUrl = (timeline, event) ->
|
||||||
|
url = {
|
||||||
|
"issue": "project-issues-detail",
|
||||||
|
"wiki": "project-wiki-page",
|
||||||
|
"task": "project-tasks-detail",
|
||||||
|
"userstories": "project-userstories-detail"
|
||||||
|
}
|
||||||
|
|
||||||
|
params = {project: timeline.data.project.slug, ref: timeline.data[event.obj].ref}
|
||||||
|
|
||||||
|
return $navUrls.resolve(url[event.obj], params)
|
||||||
|
|
||||||
|
getTemplate = (timeline, event) ->
|
||||||
|
template = ""
|
||||||
|
|
||||||
|
if event.type == 'change'
|
||||||
|
if timeline.data.comment.length
|
||||||
|
template = "profile/timeline/comment-timeline.html"
|
||||||
|
|
||||||
|
return $tgTemplate.get(template)
|
||||||
|
|
||||||
|
link = ($scope, $el, $attrs) ->
|
||||||
|
event = parseEventType($scope.timeline.event_type)
|
||||||
|
template = getTemplate($scope.timeline, event)
|
||||||
|
|
||||||
|
if !template
|
||||||
|
return ""
|
||||||
|
|
||||||
|
obj = $scope.timeline.data[event.obj]
|
||||||
|
|
||||||
|
$scope.timeline.subject = obj.subject
|
||||||
|
$scope.timeline.ref = obj.ref
|
||||||
|
$scope.timeline.type = event.obj
|
||||||
|
$scope.timeline.created_formated = moment($scope.timeline.created).fromNow()
|
||||||
|
$scope.timeline.detail_url = getUrl($scope.timeline, event)
|
||||||
|
|
||||||
|
$el.html(template)
|
||||||
|
$compile($el.contents())($scope)
|
||||||
|
|
||||||
|
return {
|
||||||
|
link: link
|
||||||
|
scope: {
|
||||||
|
timeline: "=tgTimelineItem"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
angular.module("taigaProfile")
|
||||||
|
.directive("tgTimelineItem", ["$tgTemplate", "$compile", "$tgNavUrls", TimelineItemDirective])
|
|
@ -36,6 +36,8 @@ urls = {
|
||||||
"users-change-password": "/users/change_password"
|
"users-change-password": "/users/change_password"
|
||||||
"users-change-email": "/users/change_email"
|
"users-change-email": "/users/change_email"
|
||||||
"users-cancel-account": "/users/cancel"
|
"users-cancel-account": "/users/cancel"
|
||||||
|
"contacts": "/users/%s/contacts"
|
||||||
|
"stats": "/users/%s/stats"
|
||||||
|
|
||||||
# User - Notification
|
# User - Notification
|
||||||
"notify-policies": "/notify-policies"
|
"notify-policies": "/notify-policies"
|
||||||
|
@ -58,6 +60,7 @@ urls = {
|
||||||
"projects": "/projects"
|
"projects": "/projects"
|
||||||
"project-templates": "/project-templates"
|
"project-templates": "/project-templates"
|
||||||
"project-modules": "/projects/%s/modules"
|
"project-modules": "/projects/%s/modules"
|
||||||
|
"bulk-update-projects-order": "/projects/bulk_update_order"
|
||||||
|
|
||||||
# Project Values - Choises
|
# Project Values - Choises
|
||||||
"userstory-statuses": "/userstory-statuses"
|
"userstory-statuses": "/userstory-statuses"
|
||||||
|
@ -125,6 +128,10 @@ urls = {
|
||||||
"tasks-csv": "/tasks/csv?uuid=%s"
|
"tasks-csv": "/tasks/csv?uuid=%s"
|
||||||
"issues-csv": "/issues/csv?uuid=%s"
|
"issues-csv": "/issues/csv?uuid=%s"
|
||||||
|
|
||||||
|
# Timeline
|
||||||
|
"timeline-profile": "/timeline/profile"
|
||||||
|
"timeline-project": "/timeline/project"
|
||||||
|
|
||||||
# Search
|
# Search
|
||||||
"search": "/search"
|
"search": "/search"
|
||||||
|
|
||||||
|
@ -183,5 +190,6 @@ module.run([
|
||||||
"$tgWebhooksResourcesProvider",
|
"$tgWebhooksResourcesProvider",
|
||||||
"$tgWebhookLogsResourcesProvider",
|
"$tgWebhookLogsResourcesProvider",
|
||||||
"$tgLocalesResourcesProvider",
|
"$tgLocalesResourcesProvider",
|
||||||
|
"$tgTimelineResourcesProvider",
|
||||||
initResources
|
initResources
|
||||||
])
|
])
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
###
|
||||||
|
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be>
|
||||||
|
# Copyright (C) 2014 Jesús Espino Garcia <jespinog@gmail.com>
|
||||||
|
# Copyright (C) 2014 David Barragán Merino <bameda@dbarragan.com>
|
||||||
|
#
|
||||||
|
# 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 <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# File: modules/resources/timeline.coffee
|
||||||
|
###
|
||||||
|
|
||||||
|
taiga = @.taiga
|
||||||
|
|
||||||
|
resourceProvider = ($repo) ->
|
||||||
|
service = {}
|
||||||
|
|
||||||
|
service.profile = (userId) ->
|
||||||
|
return $repo.queryOnePaginatedRaw("timeline-profile", userId)
|
||||||
|
|
||||||
|
return (instance) ->
|
||||||
|
instance.timeline = service
|
||||||
|
|
||||||
|
|
||||||
|
module = angular.module("taigaResources")
|
||||||
|
module.factory("$tgTimelineResourcesProvider", ["$tgRepo", resourceProvider])
|
|
@ -1,94 +1,95 @@
|
||||||
section.profile-timeline
|
section.profile-timeline(ng-controller="ProfileTimeline as ctrl")
|
||||||
- for (var x = 0; x < 3; x++)
|
div(ng-repeat="timeline in result.data", tg-timeline-item="timeline")
|
||||||
// Simple message for favorites, updates, etc.
|
// - for (var x = 0; x < 3; x++)
|
||||||
div.activity-simple
|
// // Simple message for favorites, updates, etc.
|
||||||
span.activity-date Yesterday 12.30h
|
// div.activity-simple)
|
||||||
div.activity-info
|
// span.activity-date Yesterday 12.30h
|
||||||
div.profile-contact-picture
|
// div.activity-info
|
||||||
a(href="", title="{{ user.nickname }}")
|
// div.profile-contact-picture
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/gerrenlamson/128.jpg", alt="{{ user.nickname }}")
|
// a(href="", title="{{ user.nickname }}")
|
||||||
p
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/gerrenlamson/128.jpg", alt="{{ user.nickname }}")
|
||||||
a(href="", title="See {{ user.nickname }} profile") Jesús Espino
|
// p
|
||||||
span has updated the status of the US
|
// a(href="", title="See {{ user.nickname }} profile") Jesús Espino
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") #23 Web comercial/Ayuda from "UX" to "UX Done"
|
// span has updated the status of the US
|
||||||
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") #23 Web comercial/Ayuda from "UX" to "UX Done"
|
||||||
|
|
||||||
// Added comment in us, task or issue.
|
// // Added comment in us, task or issue.
|
||||||
div.activity-comment
|
// div.activity-comment
|
||||||
span.activity-date 3 days ago
|
// span.activity-date 3 days ago
|
||||||
div.activity-info
|
// div.activity-info
|
||||||
div.profile-contact-picture
|
// div.profile-contact-picture
|
||||||
a(href="", title="{{ user.nickname }}")
|
// a(href="", title="{{ user.nickname }}")
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/tonystubblebine/128.jpg", alt="{{ user.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/tonystubblebine/128.jpg", alt="{{ user.nickname }}")
|
||||||
p
|
// p
|
||||||
a(href="", title="See {{ user.nickname }} profile") JuanFrancisco Alcántara
|
// a(href="", title="See {{ user.nickname }} profile") JuanFrancisco Alcántara
|
||||||
span has commented in the task
|
// span has commented in the task
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") #15 Revisar el contraste de los grises
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") #15 Revisar el contraste de los grises
|
||||||
div.activity-comment-quote
|
// div.activity-comment-quote
|
||||||
p "He subido a GitLab unos wireframes. Echadle un vistazo por favor, a ver si falta algo o tenéis al"
|
// p "He subido a GitLab unos wireframes. Echadle un vistazo por favor, a ver si falta algo o tenéis al"
|
||||||
|
|
||||||
// Added attachment type image in us, task or issue.
|
// // Added attachment type image in us, task or issue.
|
||||||
div.activity-image
|
// div.activity-image
|
||||||
span.activity-date 5 days ago
|
// span.activity-date 5 days ago
|
||||||
div.activity-info
|
// div.activity-info
|
||||||
div.profile-contact-picture
|
// div.profile-contact-picture
|
||||||
a(href="", title="{{ user.nickname }}")
|
// a(href="", title="{{ user.nickname }}")
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/jina/128.jpg", alt="{{ user.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/jina/128.jpg", alt="{{ user.nickname }}")
|
||||||
p
|
// p
|
||||||
a(href="", title="See {{ user.nickname }} profile") Alejandro Alonso
|
// a(href="", title="See {{ user.nickname }} profile") Alejandro Alonso
|
||||||
span has uploaded an image in the US
|
// span has uploaded an image in the US
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") US #23 Web comercial/Ayuda
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") US #23 Web comercial/Ayuda
|
||||||
div.activity-comment-attachment
|
// div.activity-comment-attachment
|
||||||
p "Eh! Look at this amazing Taiga picture!"
|
// p "Eh! Look at this amazing Taiga picture!"
|
||||||
img(src="https://ununsplash.imgix.net/photo-1423753623104-718aaace6772?q=75&fm=jpg&w=1080&fit=max&s=f655534aa0fe8bae35c687e80a2ed399", alt="{{ attachment.name }}")
|
// img(src="https://ununsplash.imgix.net/photo-1423753623104-718aaace6772?q=75&fm=jpg&w=1080&fit=max&s=f655534aa0fe8bae35c687e80a2ed399", alt="{{ attachment.name }}")
|
||||||
|
|
||||||
// Multiple update message, etc.
|
// // Multiple update message, etc.
|
||||||
div.activity-notification
|
// div.activity-notification
|
||||||
span.activity-date 6 days ago
|
// span.activity-date 6 days ago
|
||||||
div.activity-info
|
// div.activity-info
|
||||||
div.profile-contact-picture
|
// div.profile-contact-picture
|
||||||
a(href="", title="{{ user.nickname }}")
|
// a(href="", title="{{ user.nickname }}")
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/idiot/128.jpg", alt="{{ user.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/idiot/128.jpg", alt="{{ user.nickname }}")
|
||||||
p
|
// p
|
||||||
a(href="", title="See {{ user.nickname }} profile") Jesús Espino
|
// a(href="", title="See {{ user.nickname }} profile") Jesús Espino
|
||||||
span closed
|
// span closed
|
||||||
ul.activity-notification-list
|
// ul.activity-notification-list
|
||||||
li
|
// li
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") US #23 Web comercial/Ayuda
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") US #23 Web comercial/Ayuda
|
||||||
li
|
// li
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") #2156 Search Page UX is hardly understandable
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") #2156 Search Page UX is hardly understandable
|
||||||
li
|
// li
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") #456 Search for users
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") #456 Search for users
|
||||||
li
|
// li
|
||||||
a(href="", title="See #{{ us.id }}{{ us.title }}") #2140 Las notificaciones de cambios están fallando
|
// a(href="", title="See #{{ us.id }}{{ us.title }}") #2140 Las notificaciones de cambios están fallando
|
||||||
|
|
||||||
// Added attachment type image in us, task or issue.
|
// // Added attachment type image in us, task or issue.
|
||||||
div.activity-member
|
// div.activity-member
|
||||||
span.activity-date a week ago
|
// span.activity-date a week ago
|
||||||
div.activity-info
|
// div.activity-info
|
||||||
div.profile-contact-picture
|
// div.profile-contact-picture
|
||||||
a(href="", title="{{ organization.nickname }}")
|
// a(href="", title="{{ organization.nickname }}")
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/tofslie/128.jpg", alt="{{ organization.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/tofslie/128.jpg", alt="{{ organization.nickname }}")
|
||||||
p
|
// p
|
||||||
a(href="", title="See {{ organization.nickname }} profile") Mozilla
|
// a(href="", title="See {{ organization.nickname }} profile") Mozilla
|
||||||
span has a new member
|
// span has a new member
|
||||||
div.activity-member-view
|
// div.activity-member-view
|
||||||
div.profile-member-picture
|
// div.profile-member-picture
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/BillSKenney/128.jpg", alt="{{ organization.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/BillSKenney/128.jpg", alt="{{ organization.nickname }}")
|
||||||
div.activity-member-info
|
// div.activity-member-info
|
||||||
a(href="", title="See {{ user.nickname }} profile")
|
// a(href="", title="See {{ user.nickname }} profile")
|
||||||
span Andrés González
|
// span Andrés González
|
||||||
p Back-end developer & Stake
|
// p Back-end developer & Stake
|
||||||
|
|
||||||
// Added comment in us, task or issue.
|
// // Added comment in us, task or issue.
|
||||||
div.activity-project
|
// div.activity-project
|
||||||
span.activity-date a week ago
|
// span.activity-date a week ago
|
||||||
div.activity-info
|
// div.activity-info
|
||||||
div.profile-contact-picture
|
// div.profile-contact-picture
|
||||||
a(href="", title="{{ organization.nickname }}")
|
// a(href="", title="{{ organization.nickname }}")
|
||||||
img(src="https://s3.amazonaws.com/uifaces/faces/twitter/ekvium/128.jpg", alt="{{ organization.nickname }}")
|
// img(src="https://s3.amazonaws.com/uifaces/faces/twitter/ekvium/128.jpg", alt="{{ organization.nickname }}")
|
||||||
p
|
// p
|
||||||
a(href="", title="See {{ user.nickname }} profile") Redhat
|
// a(href="", title="See {{ user.nickname }} profile") Redhat
|
||||||
span has a new project
|
// span has a new project
|
||||||
a(href="", title="See {{ project.name }}") Nanatubos
|
// a(href="", title="See {{ project.name }}") Nanatubos
|
||||||
div.activity-comment-quote
|
// div.activity-comment-quote
|
||||||
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.
|
// 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.
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
div.activity-comment
|
||||||
|
span.activity-date {{::timeline.created_formated}}
|
||||||
|
div.activity-info
|
||||||
|
div.profile-contact-picture
|
||||||
|
a(tg-nav="user-profile:username=timeline.data.user.username", title="{{::timeline.data.user.name }}")
|
||||||
|
img(ng-src="{{::timeline.data.user.photo}}", alt="{{::timeline.data.user.name}}")
|
||||||
|
p
|
||||||
|
a(tg-nav="user-profile:username=timeline.data.user.username", title="See {{::timeline.data.user.name }} profile") {{::timeline.data.user.name}}
|
||||||
|
span has commented in the {{::timeline.type }}
|
||||||
|
a(href="{{::timeline.detail_url}}", title="See #{{::timeline.ref}} {{::timeline.subject}}") \#{{::timeline.ref}} {{::timeline.subject}}
|
||||||
|
div.activity-comment-quote
|
||||||
|
p "{{::timeline.data.comment}}"
|
Loading…
Reference in New Issue