Fixing next and prev in issue task and us detail

stable
Alejandro Alonso 2014-08-13 14:28:56 +02:00
parent e7adab89cc
commit 7fae55f742
5 changed files with 27 additions and 11 deletions

View File

@ -22,16 +22,22 @@
taiga = @.taiga taiga = @.taiga
resourceProvider = ($repo, $http, $urls) -> generateHash = taiga.generateHash
resourceProvider = ($repo, $http, $urls, $storage) ->
service = {} service = {}
hashSuffix = "tasks-queryparams"
service.get = (projectId, taskId) -> service.get = (projectId, taskId) ->
return $repo.queryOne("tasks", taskId) params = service.getQueryParams(projectId)
params.project = projectId
return $repo.queryOne("tasks", taskId, params)
service.list = (projectId, sprintId=null, userStoryId=null) -> service.list = (projectId, sprintId=null, userStoryId=null) ->
params = {project: projectId} params = {project: projectId}
params.milestone = sprintId if sprintId params.milestone = sprintId if sprintId
params.user_story = userStoryId if userStoryId params.user_story = userStoryId if userStoryId
service.storeQueryParams(projectId, params)
return $repo.queryMany("tasks", params) return $repo.queryMany("tasks", params)
service.bulkCreate = (projectId, sprintId, usId, data) -> service.bulkCreate = (projectId, sprintId, usId, data) ->
@ -47,9 +53,19 @@ resourceProvider = ($repo, $http, $urls) ->
params = {"project": projectId} params = {"project": projectId}
return $repo.queryMany(type, params) return $repo.queryMany(type, params)
service.storeQueryParams = (projectId, params) ->
ns = "#{projectId}:#{hashSuffix}"
hash = generateHash([projectId, ns])
$storage.set(hash, params)
service.getQueryParams = (projectId) ->
ns = "#{projectId}:#{hashSuffix}"
hash = generateHash([projectId, ns])
return $storage.get(hash) or {}
return (instance) -> return (instance) ->
instance.tasks = service instance.tasks = service
module = angular.module("taigaResources") module = angular.module("taigaResources")
module.factory("$tgTasksResourcesProvider", ["$tgRepo", "$tgHttp", "$tgUrls", resourceProvider]) module.factory("$tgTasksResourcesProvider", ["$tgRepo", "$tgHttp", "$tgUrls", "$tgStorage", resourceProvider])

View File

@ -71,8 +71,8 @@ class TaskDetailController extends mixOf(taiga.Controller, taiga.PageMixin, taig
return @rs.tasks.get(@scope.projectId, @scope.taskId).then (task) => return @rs.tasks.get(@scope.projectId, @scope.taskId).then (task) =>
@scope.task = task @scope.task = task
@scope.commentModel = task @scope.commentModel = task
# @scope.previousUrl = "/project/#{@scope.project.slug}/tasks/#{@scope.task.neighbors.previous.ref}" if @scope.task.neighbors.previous.id? @scope.previousUrl = "/project/#{@scope.project.slug}/tasks/#{@scope.task.neighbors.previous.ref}" if @scope.task.neighbors.previous.id?
# @scope.nextUrl = "/project/#{@scope.project.slug}/tasks/#{@scope.task.neighbors.next.ref}" if @scope.task.neighbors.next.id? @scope.nextUrl = "/project/#{@scope.project.slug}/tasks/#{@scope.task.neighbors.next.ref}" if @scope.task.neighbors.next.id?
loadHistory: -> loadHistory: ->
return @rs.tasks.history(@scope.taskId).then (history) => return @rs.tasks.history(@scope.taskId).then (history) =>

View File

@ -20,8 +20,8 @@ block content
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'") span.block-description(tg-bind-html="issue.blocked_note || 'This issue is blocked'")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue") a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue")
a.icon.icon-arrow-right(ng-show="previousUrl",href="{{ previousUrl }}", title="previous issue") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next issue")
div.user-story-tags(tg-tag-line, ng-model="issue.tags", ng-show="issue.tags") div.user-story-tags(tg-tag-line, ng-model="issue.tags", ng-show="issue.tags")

View File

@ -20,8 +20,8 @@ block content
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'") span.block-description(tg-bind-html="task.blocked_note || 'This task is blocked'")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(ng-show="nextUrl", href="{{ nextUrl }}", title="next task") a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task")
a.icon.icon-arrow-right(ng-show="previousUrl",href="{{ previousUrl }}", title="previous task") a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next task")
div.user-story-tags(tg-tag-line, ng-model="task.tags", ng-show="task.tags") div.user-story-tags(tg-tag-line, ng-model="task.tags", ng-show="task.tags")

View File

@ -21,9 +21,9 @@ block content
span.block-description-title Blocked span.block-description-title Blocked
span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'") span.block-description(tg-bind-html="us.blocked_note || 'This user story is blocked'")
div.issue-nav div.issue-nav
a.icon.icon-arrow-left(ng-show="nextUrl", href="{{ nextUrl }}", title="next user story") a.icon.icon-arrow-left(ng-show="previousUrl",href="{{ previousUrl }}",
a.icon.icon-arrow-right(ng-show="previousUrl",href="{{ previousUrl }}",
title="previous user story") title="previous user story")
a.icon.icon-arrow-right(ng-show="nextUrl", href="{{ nextUrl }}", title="next user story")
div.user-story-tags(tg-tag-line, ng-model="us.tags", ng-show="us.tags") div.user-story-tags(tg-tag-line, ng-model="us.tags", ng-show="us.tags")