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

View File

@ -18,7 +18,29 @@
taiga = @.taiga taiga = @.taiga
class BacklogController extends taiga.TaigaController 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 # Resolve project slug
promise = @repo.resolve({pslug: @params.pslug}).then (data) => promise = @repo.resolve({pslug: @params.pslug}).then (data) =>
console.log "resolve", data.project console.log "resolve", data.project
@ -28,36 +50,43 @@ class BacklogController extends taiga.TaigaController
# Load project # Load project
promise = promise.then (project) => promise = promise.then (project) =>
@scope.project = project @scope.project = project
console.log project return @.loadBacklog()
return @rs.getMilestones(@scope.projectId)
# Load milestones return promise
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"
BacklogDirective = ($compile) -> BacklogDirective = ($compile, $templateCache) ->
controller: ["$scope", "$tgRepo", "$routeParams", "$tgResources", BacklogController] backlogLink = ($scope, $element, $attrs, $ctrl) ->
link: (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) -> if scope != null
require: "^tgBacklog" scope.$destroy()
link: (scope, element, attrs, ctrl) ->
content = $templateCache.get("backlog-row.html") scope = $scope.$new()
scope.$watch "userstories", (userstories) => dom = $compile(dom)(scope)
console.log "ready to render", userstories $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 = angular.module("taigaBacklog", [])
module.directive("tgBacklog", ["$compile", BacklogDirective]) module.directive("tgBacklog", ["$compile", "$templateCache", BacklogDirective])
module.directive("tgBacklogTable", ["$compile", "$templateCache", BacklogTableDirective])

View File

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

View File

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

View File

@ -31,7 +31,3 @@ block content
div.lightbox.lightbox_add-sprint div.lightbox.lightbox_add-sprint
include views/modules/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-stories
div.user-story-name div.user-story-name
input(type="checkbox", name="") input(type="checkbox", name="")
a(href="") Crear el perfil de usuario Senior en el admin a(href="") {{ us.subject }}
span.us-settings span.us-settings
a.icon.icon-edit(href="", title="Edit") a.icon.icon-edit(href="", title="Edit")
a.icon.icon-delete(href="", title="Delete") a.icon.icon-delete(href="", title="Delete")
div.user-story-tags div.user-story-tags
- for(var y = 0; y < 3; y++) span.tag Tag name
include ../components/tag span.tag Tag name
div.status Status div.status Status
div.points 12 div.points 12
div.points 54 div.points 54

View File

@ -1,4 +1,4 @@
section.backlog-table(tg-backlog-table) section.backlog-table
div.row.backlog-table-header div.row.backlog-table-header
div.user-stories User Stories div.user-stories User Stories
div.status Status div.status Status
@ -9,61 +9,52 @@ section.backlog-table(tg-backlog-table)
div.status.width-2 div.status.width-2
div.points.width-1 Front div.points.width-1 Front
div.points.width-1 Total div.points.width-1 Total
div.row.table-main.blocked section.backlog-table
div.user-stories // div.row.table-main.blocked
div.user-story-name // div.user-stories
input(type="checkbox", name="") // div.user-story-name
a(href="") Crear el perfil de usuario Senior en el admin // input(type="checkbox", name="")
span.us-settings // a(href="") Crear el perfil de usuario Senior en el admin
a.icon.icon-edit(href="", title="Edit") // span.us-settings
a.icon.icon-delete(href="", title="Delete") // a.icon.icon-edit(href="", title="Edit")
div.user-story-tags // a.icon.icon-delete(href="", title="Delete")
- for(var y = 0; y < 3; y++) // div.user-story-tags
include ../components/tag // - for(var y = 0; y < 3; y++)
div.status.width-2 // include ../components/tag
a(href="", title="Status Name") Status Name // div.status.width-2
ul.popover.pop-status // a(href="", title="Status Name") Status Name
li // ul.popover.pop-status
a(href="", title="Status 1") Status 1 // li
li // a(href="", title="Status 1") Status 1
a(href="", title="Status 2") Status 2 // li
li // a(href="", title="Status 2") Status 2
a(href="", title="Status 3") Status 3 // li
div.points // a(href="", title="Status 3") Status 3
a(href="", title="Front") 24 // div.points
ul.popover.pop-points-open // a(href="", title="Front") 24
li // ul.popover.pop-points-open
a(href="", title="0") 0 // li: a(href="", title="0") 0
li // li: a(href="", title="1/2") 1/2
a(href="", title="1/2") 1/2 // li: a(href="", title="1") 1
li // li: a(href="", title="2") 2
a(href="", title="1") 1 // li: a(href="", title="3") 3
li // li: a(href="", title="4") 4
a(href="", title="2") 2 // li: a(href="", title="8") 8
li // li: a(href="", title="13") 13
a(href="", title="3") 3 // li: a(href="", title="20") 20
li // li: a(href="", title="40") 40
a(href="", title="4") 4 // li: a(href="", title="100") 100
li // li: a(href="", title="?") ?
a(href="", title="8") 8 // div.points
li // a(href="", title="Total Points") 43
a(href="", title="13") 13 // ul.popover.pop-status
li // li
a(href="", title="20") 20 // a(href="", title="Status 1") Status 1
li // li
a(href="", title="40") 40 // a(href="", title="Status 2") Status 2
li // li
a(href="", title="100") 100 // a(href="", title="Status 3") Status 3
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 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") a.button-green(href="", title="Add New US")
span.text + New sprint span.text + New sprint
// If is current sprint section.sprint(ng-repeat="sprint in sprints track by sprint.id", tg-backlog-sprint)
section.sprint.sprint-current
header header
div.sprint-summary div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint") a.icon.icon-arrow-up(href="", title="compact Sprint")
@ -35,48 +34,73 @@ section.sprints
a.button.button-gray(href="", title="Current Sprint Taksboard") a.button.button-gray(href="", title="Current Sprint Taksboard")
span Sprint Taskboard span Sprint Taskboard
// If Sprint is open but date is old // If is current sprint
section.sprint.sprint-old-open // section.sprint.sprint-current
header // header
div.sprint-summary // div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint") // a.icon.icon-arrow-up(href="", title="compact Sprint")
span.sprint-name old open sprint // span.sprint-name current sprint
span.sprint-date 04/05/14-03/06/14 // span.sprint-date 04/06/14-20/06/14
ul // ul
li // li
span.number 20 // span.number 12
span.description closed<br />points // span.description closed<br />points
li // li
span.number 24 // span.number 24
span.description total<br />points // span.description total<br />points
div.sprint-progress-bar // div.sprint-progress-bar
div.current-progress // div.current-progress
div.sprint-table // div.sprint-table
- for (var x = 0; x < 10; x++) // - for (var x = 0; x < 10; x++)
div.row // div.row
div.column-us.width-8 // div.column-us.width-8
a(href="", title="") #125 Crear el perfil de usuario Senior en el admin // a.us-name(href="", title="") #125 Crear el perfil de usuario Senior en el admin
div.column-points.width-1 45 // 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 // // If Sprint is open but date is old
section.sprint.sprint-closed // section.sprint.sprint-old-open
header // header
div.sprint-summary // div.sprint-summary
a.icon.icon-arrow-up(href="", title="compact Sprint") // a.icon.icon-arrow-up(href="", title="compact Sprint")
span.sprint-name old sprint // span.sprint-name old open sprint
span.sprint-date 04/04/14-03/05/14 // span.sprint-date 04/05/14-03/06/14
ul // ul
li // li
span.number 24 // span.number 20
span.description closed<br />points // span.description closed<br />points
li // li
span.number 24 // span.number 24
span.description total<br />points // span.description total<br />points
div.sprint-progress-bar // div.sprint-progress-bar
div.current-progress // div.current-progress
div.sprint-table // div.sprint-table
- for (var x = 0; x < 10; x++) // - for (var x = 0; x < 10; x++)
div.row // div.row
div.column-us.width-8 // div.column-us.width-8
a(href="", title="") #125 Crear el perfil de usuario Senior en el admin // a(href="", title="") #125 Crear el perfil de usuario Senior en el admin
div.column-points.width-1 45 // 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": { "dependencies": {
"lodash": "~2.4.1", "lodash": "~2.4.1",
"jade": "~1.3.1",
"emoticons": "~0.1.7", "emoticons": "~0.1.7",
"jquery-flot": "~0.8.2", "jquery-flot": "~0.8.2",
"angular": "1.2.17", "angular": "1.2.17",
@ -48,6 +49,7 @@
"i18next": "~1.7.1", "i18next": "~1.7.1",
"jquery": "~2.1.1", "jquery": "~2.1.1",
"select2": "~3.4.5", "select2": "~3.4.5",
"angular-bindonce": "~0.3.1",
"angular-ui-select2": "~0.0.5", "angular-ui-select2": "~0.0.5",
"google-diff-match-patch-js": "~1.0.0", "google-diff-match-patch-js": "~1.0.0",
"underscore.string": "~2.3.3", "underscore.string": "~2.3.3",

View File

@ -51,7 +51,8 @@ vendorJsLibs = [
"app/vendor/angular/angular.js", "app/vendor/angular/angular.js",
"app/vendor/angular-route/angular-route.js", "app/vendor/angular-route/angular-route.js",
"app/vendor/angular-sanitize/angular-sanitize.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"
] ]