Initial js layout for backlog.

stable
Andrey Antukh 2014-06-11 18:24:33 +02:00
parent 00b5b759ff
commit ab03bb9eff
8 changed files with 119 additions and 59 deletions

View File

@ -16,8 +16,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
class TaigaBase
class TaigaService extends TaigaBase
class TaigaController extends TaigaBase
@.taiga.TaigaBase = TaigaBase
@.taiga.TaigaService = TaigaService
@.taiga.TaigaController = TaigaController

View File

@ -0,0 +1,46 @@
# 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/>.
taiga = @.taiga
class BacklogController extends taiga.TaigaController
constructor: (@repo) ->
console.log "foo"
getMilestones: ->
projectId = 1
return @repo.queryMany("milestones", {project:projectId}).then (milestones) ->
console.log milestones
return milestones
BacklogDirective = ($compile) ->
controller: ["$tgRepo", BacklogController]
link: (scope, element, attrs, ctrl) ->
ctrl.getMilestones().then =>
console.log "kaka"
BacklogTableDirective = ($compile, $templateCache) ->
require: "^tgBacklog"
link: (scope, element, attrs, ctrl) ->
content = $templateCache.get("backlog-row.html")
module = angular.module("taiga")
module.directive("tgBacklog", ["$compile", BacklogDirective])
module.directive("tgBacklogTable", ["$compile", "$templateCache", BacklogTableDirective])

View File

@ -39,29 +39,34 @@ class HttpService extends taiga.TaigaService
get: (url, params) ->
return @.request({
method: "GET",
url: url,
params: params
})
post: (url, data, params) ->
options = {method: "POST"}
options = {method: "POST", url: url}
options.data = data if data
options.params = params if params
return @.request(options)
put: (url, data, params) ->
options = {method: "PUT"}
options = {method: "PUT", url: url}
options.data = data if data
options.params = params if params
return @.request(options)
patch: (url, data, params) ->
options = {method: "PATCH"}
options = {method: "PATCH", url: url}
options.data = data if data
options.params = params if params
return @.request(options)
delete: (url, data, params) ->
options = {method: "DELETE"}
options = {method: "DELETE", url: url}
options.data = data if data
options.params = params if params
return @.request(options)
module = angular.module("taigaResources")
module.service("$tgHttp", HttpService)

View File

@ -18,9 +18,9 @@
taiga = @.taiga
class RepositoryService extends taiga.TaigaService
@.$inject = ["$q", "$tgModel", "$tgStorage", "$tgHttp"]
@.$inject = ["$q", "$tgModel", "$tgStorage", "$tgHttp", "$tgUrls"]
constructor: (@q, @model, @storage, @http) ->
constructor: (@q, @model, @storage, @http, @urls) ->
super()
resolveUrlForModel: (model) ->
@ -98,25 +98,24 @@ class RepositoryService extends taiga.TaigaService
return defered.promise
queryMany: (name, params) ->
url = @urls.resolve(name)
return @http.get(url, params).then (data, status) ->
return _.map(data, (x) -> @model.make_model(name, x))
return @http.get(url, params).then (data) =>
return _.map(data.data, (x) => @model.make_model(name, x))
queryOne: (name, id, params) ->
url = @urls.resolve(name)
url = "#{url}/#{id}" if id
return @http.get(url, params).then (data, status) ->
return @http.get(url, params).then (data) =>
return @model.make_model(name, data)
queryPaginated: (name, params) ->
url = @urls.resolve(name)
return @http.get(url, params).then (data, status, headers) ->
headers = headers()
return @http.get(url, params).then (data) =>
headers = data.headers()
result = {}
result.models = _.map(data, (x) -> @model.make_model(name, x))
result.models = _.map(data.data, (x) => @model.make_model(name, x))
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)

View File

@ -4,30 +4,31 @@ block head
title Taiga Project management web application with scrum in mind!
block content
sidebar.menu-secondary.extrabar.filters-bar
include views/modules/filters
section.main.backlog
include views/components/mainTitle
include views/components/summary
include views/modules/burndown
div.backlog-menu
a.trans-button(href="", title="Move to Current Sprint")
span.icon.icon-move
span.text Move to current Sprint
a.trans-button(href="", title="Show Filters")
span.icon.icon-filter
span.text Show Filters
a.trans-button(href="", title="Show Tags")
span.icon.icon-tag
span.text Show Tags
include views/components/addnewus
include views/modules/backlog-table
sidebar.menu-secondary.sidebar
include views/modules/sprints
div.lightbox.lightbox_add-new-us
include views/modules/lightbox_add-new-us
div.lightbox.lightbox_add-bulk
include views/modules/lightbox_add-bulk
div.lightbox.lightbox_add-sprint
include views/modules/lightbox_add-sprint
div(tg-backlog)
sidebar.menu-secondary.extrabar.filters-bar
include views/modules/filters
section.main.backlog
include views/components/mainTitle
include views/components/summary
include views/modules/burndown
div.backlog-menu
a.trans-button(href="", title="Move to Current Sprint")
span.icon.icon-move
span.text Move to current Sprint
a.trans-button(href="", title="Show Filters")
span.icon.icon-filter
span.text Show Filters
a.trans-button(href="", title="Show Tags")
span.icon.icon-tag
span.text Show Tags
include views/components/addnewus
include views/modules/backlog-table
sidebar.menu-secondary.sidebar
include views/modules/sprints
div.lightbox.lightbox_add-new-us
include views/modules/lightbox_add-new-us
div.lightbox.lightbox_add-bulk
include views/modules/lightbox_add-bulk
div.lightbox.lightbox_add-sprint
include views/modules/lightbox_add-sprint

View File

@ -0,0 +1,15 @@
div.row.table-main
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 Status
div.points 12
div.points 54
a.icon.icon-drag-v(href="", title="Drag")

View File

@ -1,4 +1,4 @@
section.backlog-table
section.backlog-table(tg-backlog-table)
div.row.backlog-table-header
div.user-stories User Stories
div.status Status
@ -66,19 +66,7 @@ section.backlog-table
li
a(href="", title="Status 3") Status 3
hr.doom-line
- for (var x = 0; x < 50; x++)
div.row.table-main
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 Status
div.points 12
div.points 54
a.icon.icon-drag-v(href="", title="Drag")
// Preloading angular templates parts
script(type="text/ng-template" id="backlog-row.html")
include ../components/backlog-row

View File

@ -32,8 +32,13 @@ var paths = {
sassMain: "app/styles/main.scss",
css: "dist/styles/**/*.css",
images: "app/images/**/*",
coffee: ["app/coffee/**/*.coffee",
"config/main.coffee"]
coffee: ["app/coffee/app.coffee",
"config/main.coffee",
"app/coffee/*.coffee",
"app/coffee/modules/*.coffee",
"app/coffee/modules/resources/init.coffee",
"app/coffee/modules/resources/*.coffee",
"app/coffee/**/*.coffee"]
};
// Ordered list of vendor/external libraries.