Next iteration over backlog.

stable
Andrey Antukh 2014-06-17 09:48:49 +02:00
parent 6198914908
commit d1499ad541
10 changed files with 195 additions and 148 deletions

View File

@ -46,7 +46,7 @@ configure = ($routeProvider, $locationProvider, $httpProvider, $provide, $compil
init = ($log, $rootScope) ->
$log.debug("Initialize application")
configure.$inject = ["$routeProvider", "$locationProvider","$httpProvider"]
configure.$inject = ["$routeProvider", "$locationProvider", "$httpProvider"]
init.$inject = ["$log", "$rootScope"]
modules = [
@ -55,8 +55,10 @@ modules = [
"taigaConfig",
"taigaResources",
"taigaBacklog",
# Vendor modules
"pasvaz.bindonce",
]
angular.module("taigaLocalConfig", []).value("localconfig", {})

View File

@ -18,7 +18,29 @@
taiga = @.taiga
class BacklogController extends taiga.TaigaController
constructor: (@scope, @repo, @params, @rs) ->
constructor: (@scope, @repo, @params, @rs, @q) ->
promise = @.loadInitialData()
# Obviously fail condition
promise.then null, =>
console.log "FAIL"
loadSprints: ->
return @rs.getSprints(@scope.projectId).then (sprints) =>
@scope.sprints = sprints
return sprints
loadUserstories: ->
return @rs.getUnassignedUserstories(@scope.projectId).then (userstories) =>
@scope.userstories = userstories
return userstories
loadBacklog: ->
return @q.all([
@.loadSprints(),
@.loadUserstories()
])
loadInitialData: ->
# Resolve project slug
promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
console.log "resolve", data.project
@ -28,36 +50,43 @@ class BacklogController extends taiga.TaigaController
# Load project
promise = promise.then (project) =>
@scope.project = project
console.log project
return @rs.getMilestones(@scope.projectId)
return @.loadBacklog()
# Load milestones
promise = promise.then (milestones) =>
@scope.milestones = milestones
return @rs.getBacklog(@scope.projectId)
# Load unassigned userstories
promise = promise.then (userstories) =>
@scope.userstories = userstories
# Obviously fail condition
promise.then null, =>
console.log "FAIL"
return promise
BacklogDirective = ($compile) ->
controller: ["$scope", "$tgRepo", "$routeParams", "$tgResources", BacklogController]
link: (scope, element, attrs, ctrl) ->
BacklogDirective = ($compile, $templateCache) ->
backlogLink = ($scope, $element, $attrs, $ctrl) ->
# UserStories renderin
dom = angular.element.parseHTML($templateCache.get("backlog-row.html"))
scope = null
$scope.$watch "userstories", (userstories) =>
return if not userstories
BacklogTableDirective = ($compile, $templateCache) ->
require: "^tgBacklog"
link: (scope, element, attrs, ctrl) ->
content = $templateCache.get("backlog-row.html")
scope.$watch "userstories", (userstories) =>
console.log "ready to render", userstories
if scope != null
scope.$destroy()
scope = $scope.$new()
dom = $compile(dom)(scope)
$element.append(dom)
link = ($scope, $element, $attrs, $ctrl) ->
backlogTableDom = $element.find("section.backlog-table")
backlogLink($scope, backlogTableDom, $attrs, $ctrl)
return {
controller: [
"$scope",
"$tgRepo",
"$routeParams",
"$tgResources",
"$q",
BacklogController
]
link: link
}
module = angular.module("taigaBacklog", [])
module.directive("tgBacklog", ["$compile", BacklogDirective])
module.directive("tgBacklogTable", ["$compile", "$templateCache", BacklogTableDirective])
module.directive("tgBacklog", ["$compile", "$templateCache", BacklogDirective])

View File

@ -30,19 +30,23 @@ class ResourcesService extends taiga.TaigaService
getProject: (projectId) ->
return @repo.queryOne("projects", projectId)
getProjects: ->
return @repo.queryMany("projects")
#############################################################################
# Backlog
#############################################################################
getMilestones: (projectId) ->
return @repo.queryMany("milestones", {project:projectId}).then (milestones) =>
getSprints: (projectId) ->
params = {"project": projectId}
return @repo.queryMany("milestones", params).then (milestones) =>
for m in milestones
uses = m.user_stories
uses = _.map(uses, (u) => @model.make_model("userstories", u))
m._attrs.user_stories = uses
return milestones
getBacklog: (projectId) ->
getUnassignedUserstories: (projectId) ->
params = {"project": projectId, "milestone": "null"}
return @repo.queryMany("userstories", params)

View File

@ -37,11 +37,9 @@ class HttpService extends taiga.TaigaService
return @http(options)
get: (url, params) ->
return @.request({
method: "GET",
url: url,
params: params
})
options = {method: "GET", url: url}
options.params = params if params
return @.request(options)
post: (url, data, params) ->
options = {method: "POST", url: url}

View File

@ -31,7 +31,3 @@ block content
div.lightbox.lightbox_add-sprint
include views/modules/lightbox_add-sprint
// Preloading angular templates parts
script(type="text/ng-template" id="backlog-row.html")
include views/components/backlog-row

View File

@ -1,14 +1,14 @@
div.row.table-main
div.row.table-main(ng-repeat="us in userstories")
div.user-stories
div.user-story-name
input(type="checkbox", name="")
a(href="") Crear el perfil de usuario Senior en el admin
a(href="") {{ us.subject }}
span.us-settings
a.icon.icon-edit(href="", title="Edit")
a.icon.icon-delete(href="", title="Delete")
div.user-story-tags
- for(var y = 0; y < 3; y++)
include ../components/tag
span.tag Tag name
span.tag Tag name
div.status Status
div.points 12
div.points 54

View File

@ -1,4 +1,4 @@
section.backlog-table(tg-backlog-table)
section.backlog-table
div.row.backlog-table-header
div.user-stories User Stories
div.status Status
@ -9,61 +9,52 @@ section.backlog-table(tg-backlog-table)
div.status.width-2
div.points.width-1 Front
div.points.width-1 Total
div.row.table-main.blocked
div.user-stories
div.user-story-name
input(type="checkbox", name="")
a(href="") Crear el perfil de usuario Senior en el admin
span.us-settings
a.icon.icon-edit(href="", title="Edit")
a.icon.icon-delete(href="", title="Delete")
div.user-story-tags
- for(var y = 0; y < 3; y++)
include ../components/tag
div.status.width-2
a(href="", title="Status Name") Status Name
ul.popover.pop-status
li
a(href="", title="Status 1") Status 1
li
a(href="", title="Status 2") Status 2
li
a(href="", title="Status 3") Status 3
div.points
a(href="", title="Front") 24
ul.popover.pop-points-open
li
a(href="", title="0") 0
li
a(href="", title="1/2") 1/2
li
a(href="", title="1") 1
li
a(href="", title="2") 2
li
a(href="", title="3") 3
li
a(href="", title="4") 4
li
a(href="", title="8") 8
li
a(href="", title="13") 13
li
a(href="", title="20") 20
li
a(href="", title="40") 40
li
a(href="", title="100") 100
li
a(href="", title="?") ?
div.points
a(href="", title="Total Points") 43
ul.popover.pop-status
li
a(href="", title="Status 1") Status 1
li
a(href="", title="Status 2") Status 2
li
a(href="", title="Status 3") Status 3
section.backlog-table
// div.row.table-main.blocked
// div.user-stories
// div.user-story-name
// input(type="checkbox", name="")
// a(href="") Crear el perfil de usuario Senior en el admin
// span.us-settings
// a.icon.icon-edit(href="", title="Edit")
// a.icon.icon-delete(href="", title="Delete")
// div.user-story-tags
// - for(var y = 0; y < 3; y++)
// include ../components/tag
// div.status.width-2
// a(href="", title="Status Name") Status Name
// ul.popover.pop-status
// li
// a(href="", title="Status 1") Status 1
// li
// a(href="", title="Status 2") Status 2
// li
// a(href="", title="Status 3") Status 3
// div.points
// a(href="", title="Front") 24
// ul.popover.pop-points-open
// li: a(href="", title="0") 0
// li: a(href="", title="1/2") 1/2
// li: a(href="", title="1") 1
// li: a(href="", title="2") 2
// li: a(href="", title="3") 3
// li: a(href="", title="4") 4
// li: a(href="", title="8") 8
// li: a(href="", title="13") 13
// li: a(href="", title="20") 20
// li: a(href="", title="40") 40
// li: a(href="", title="100") 100
// li: a(href="", title="?") ?
// div.points
// a(href="", title="Total Points") 43
// ul.popover.pop-status
// li
// a(href="", title="Status 1") Status 1
// li
// a(href="", title="Status 2") Status 2
// li
// a(href="", title="Status 3") Status 3
hr.doom-line
script(type="text/ng-template" id="backlog-row.html")
include ../components/backlog-row

View File

@ -10,8 +10,7 @@ section.sprints
a.button-green(href="", title="Add New US")
span.text + New sprint
// If is current sprint
section.sprint.sprint-current
section.sprint(ng-repeat="sprint in sprints track by sprint.id", tg-backlog-sprint)
header
div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint")
@ -35,48 +34,73 @@ section.sprints
a.button.button-gray(href="", title="Current Sprint Taksboard")
span Sprint Taskboard
// If Sprint is open but date is old
section.sprint.sprint-old-open
header
div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint")
span.sprint-name old open sprint
span.sprint-date 04/05/14-03/06/14
ul
li
span.number 20
span.description closed<br />points
li
span.number 24
span.description total<br />points
div.sprint-progress-bar
div.current-progress
div.sprint-table
- for (var x = 0; x < 10; x++)
div.row
div.column-us.width-8
a(href="", title="") #125 Crear el perfil de usuario Senior en el admin
div.column-points.width-1 45
// If is current sprint
// section.sprint.sprint-current
// header
// div.sprint-summary
// a.icon.icon-arrow-up(href="", title="compact Sprint")
// span.sprint-name current sprint
// span.sprint-date 04/06/14-20/06/14
// ul
// li
// span.number 12
// span.description closed<br />points
// li
// span.number 24
// span.description total<br />points
// div.sprint-progress-bar
// div.current-progress
// div.sprint-table
// - for (var x = 0; x < 10; x++)
// div.row
// div.column-us.width-8
// a.us-name(href="", title="") #125 Crear el perfil de usuario Senior en el admin
// div.column-points.width-1 45
// a.button.button-gray(href="", title="Current Sprint Taksboard")
// span Sprint Taskboard
// If Sprint is closed and date is old
section.sprint.sprint-closed
header
div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint")
span.sprint-name old sprint
span.sprint-date 04/04/14-03/05/14
ul
li
span.number 24
span.description closed<br />points
li
span.number 24
span.description total<br />points
div.sprint-progress-bar
div.current-progress
div.sprint-table
- for (var x = 0; x < 10; x++)
div.row
div.column-us.width-8
a(href="", title="") #125 Crear el perfil de usuario Senior en el admin
div.column-points.width-1 45
// // If Sprint is open but date is old
// section.sprint.sprint-old-open
// header
// div.sprint-summary
// a.icon.icon-arrow-up(href="", title="compact Sprint")
// span.sprint-name old open sprint
// span.sprint-date 04/05/14-03/06/14
// ul
// li
// span.number 20
// span.description closed<br />points
// li
// span.number 24
// span.description total<br />points
// div.sprint-progress-bar
// div.current-progress
// div.sprint-table
// - for (var x = 0; x < 10; x++)
// div.row
// div.column-us.width-8
// a(href="", title="") #125 Crear el perfil de usuario Senior en el admin
// div.column-points.width-1 45
// // If Sprint is closed and date is old
// section.sprint.sprint-closed
// header
// div.sprint-summary
// a.icon.icon-arrow-up(href="", title="compact Sprint")
// span.sprint-name old sprint
// span.sprint-date 04/04/14-03/05/14
// ul
// li
// span.number 24
// span.description closed<br />points
// li
// span.number 24
// span.description total<br />points
// div.sprint-progress-bar
// div.current-progress
// div.sprint-table
// - for (var x = 0; x < 10; x++)
// div.row
// div.column-us.width-8
// a(href="", title="") #125 Crear el perfil de usuario Senior en el admin
// div.column-points.width-1 45

View File

@ -36,6 +36,7 @@
],
"dependencies": {
"lodash": "~2.4.1",
"jade": "~1.3.1",
"emoticons": "~0.1.7",
"jquery-flot": "~0.8.2",
"angular": "1.2.17",
@ -48,6 +49,7 @@
"i18next": "~1.7.1",
"jquery": "~2.1.1",
"select2": "~3.4.5",
"angular-bindonce": "~0.3.1",
"angular-ui-select2": "~0.0.5",
"google-diff-match-patch-js": "~1.0.0",
"underscore.string": "~2.3.3",

View File

@ -51,7 +51,8 @@ vendorJsLibs = [
"app/vendor/angular/angular.js",
"app/vendor/angular-route/angular-route.js",
"app/vendor/angular-sanitize/angular-sanitize.js",
"app/vendor/angular-animate/angular-animate.js"
"app/vendor/angular-animate/angular-animate.js",
"app/vendor/angular-bindonce/bindonce.js"
]