Basic history implementation

stable
Alejandro Alonso 2014-07-04 13:28:17 +02:00
parent 3dc98bbd3b
commit 41c9689b7b
6 changed files with 32 additions and 34 deletions

View File

@ -69,7 +69,13 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
loadIssue: -> loadIssue: ->
return @rs.issues.get(@scope.projectId, @scope.issueId).then (issue) => return @rs.issues.get(@scope.projectId, @scope.issueId).then (issue) =>
@scope.issue = issue @scope.issue = issue
return issue @scope.previousUrl = "/project/#{@scope.project.slug}/issues/#{@scope.issue.neighbors.previous.ref}" if @scope.issue.neighbors.previous.id?
@scope.nextUrl = "/project/#{@scope.project.slug}/issues/#{@scope.issue.neighbors.next.ref}" if @scope.issue.neighbors.next.id?
loadHistory: ->
return @rs.issues.history(@scope.issueId).then (history) =>
@scope.history = history.results
@scope.comments = _.filter(history.results, (historyEntry) -> historyEntry.comment != "")
loadInitialData: -> loadInitialData: ->
params = { params = {
@ -85,6 +91,7 @@ class IssueDetailController extends mixOf(taiga.Controller, taiga.PageMixin)
return promise.then(=> @.loadProject()) return promise.then(=> @.loadProject())
.then(=> @.loadUsersAndRoles()) .then(=> @.loadUsersAndRoles())
.then(=> @.loadIssue()) .then(=> @.loadIssue())
.then(=> @.loadHistory())
block: -> block: ->
@rootscope.$broadcast("block", @scope.issue) @rootscope.$broadcast("block", @scope.issue)
@ -117,11 +124,10 @@ IssueDirective = ($tgrepo, $log, $location) ->
$el.on "click", ".save-issue", (event) -> $el.on "click", ".save-issue", (event) ->
$tgrepo.save($scope.issue).then -> $tgrepo.save($scope.issue).then ->
console.log "TODO" $location.path("/project/#{$scope.project.slug}/issues/#{$scope.issue.ref}")
return {link:link} return {link:link}
module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective]) module.directive("tgIssueDetail", ["$tgRepo", "$log", "$tgLocation", IssueDirective])

View File

@ -39,6 +39,9 @@ resourceProvider = ($repo) ->
service.filtersData = (projectId) -> service.filtersData = (projectId) ->
return $repo.queryOneRaw("projects", "#{projectId}/issue_filters_data") return $repo.queryOneRaw("projects", "#{projectId}/issue_filters_data")
service.history = (issueId) ->
return $repo.queryOneRaw("history/issue", issueId)
return (instance) -> return (instance) ->
instance.issues = service instance.issues = service

View File

@ -28,19 +28,8 @@ block content
textarea(placeholder="Write a description of your issue", ng-model="issue.description") textarea(placeholder="Write a description of your issue", ng-model="issue.description")
// include views/modules/attachments // include views/modules/attachments
section.us-activity textarea(ng-model="issue.comment", placeholder="Write here a new commet")
ul.us-activity-tabs
li
a.active(href="#")
span.icon.icon-bulk
span.tab-title Comments
li
a(href="#")
span.icon.icon-issues
span.tab-title Activity
include views/modules/comments
// include views/modules/activity
sidebar.menu-secondary.sidebar sidebar.menu-secondary.sidebar
section.us-status(tg-issue-status, ng-model="issue", editable="true") section.us-status(tg-issue-status, ng-model="issue", editable="true")
section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to", editable="true") section.us-assigned-to(tg-assigned-to, ng-model="issue.assigned_to", editable="true")

View File

@ -17,8 +17,8 @@ block content
span.us-number(tg-bo-html="issue.ref") span.us-number(tg-bo-html="issue.ref")
span.us-name(ng-bind="issue.subject") span.us-name(ng-bind="issue.subject")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(href="", title="next issue") a.icon.icon-arrow-left(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue")
a.icon.icon-arrow-right(href="", title="previous issue") a.icon.icon-arrow-right(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue")
div.blocked-warning(ng-show="issue.is_blocked") div.blocked-warning(ng-show="issue.is_blocked")
span.icon.icon-warning span.icon.icon-warning

View File

@ -1,6 +1,6 @@
div.us-activity div.us-activity
a.activity-title(href="", title="Show activity") a.activity-title(href="", title="Show activity")
span made 3 changes span made {{ comment.diff }} changes
span.icon.icon-arrow-up span.icon.icon-arrow-up
- for(var y = 0; y < 2; y++) - for(var y = 0; y < 2; y++)
div.activity-inner div.activity-inner

View File

@ -3,19 +3,19 @@ section.us-comments
textarea(placeholder="Write here a new commet") textarea(placeholder="Write here a new commet")
a.button.button-green(href="", title="Comment") Comment a.button.button-green(href="", title="Comment") Comment
div.comment-list div.comment-list
- for(var x = 0; x < 6; x++) div.comment-single(ng-repeat="comment in comments")
div.comment-single div.comment-user
div.comment-user a.avatar(href="", title="User preferences")
a.avatar(href="", title="User preferences") img(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="username")
img(src="http://thecodeplayer.com/u/uifaces/12.jpg", alt="username") div.comment-content
div.comment-content a.username(href="", title="User name") User Name
a.username(href="", title="User name") User Name //- includes module activity
//- includes module activity include comment-activity
include comment-activity p.comment
p.comment {{ comment.comment }}
Para un escenario en el cual ya están cargados en la DB la lista de usuarios para un Grupo o varios, tenemos que tener la posibilidad de lanzar a todos los miembros de un grupo y/o a un individuo en concreto, un mail. El mail lleva un bloque de texto (pendiende de que os lo pasemos) y también llevará un link que llevará a una pantalla donde ponga la pw que usará a partir de ese momento. Si elige su PW dentro de las reglas de PW establecidas (pendientes de decidir), el sistema le logará automáticamente. p.date 15 junio 2014 15:30h
p.date 15 junio 2014 15:30h a.delete-comment.icon.icon-delete(href="", title="delete comment")
a.delete-comment.icon.icon-delete(href="", title="delete comment")
a.more-comments(href="", title="show more comments") //a.more-comments(href="", title="show more comments")
span show previous comments //span show previous comments
span.prev-comments-num (3 more) //span.prev-comments-num (3 more)