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/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
class TaigaBase class TaigaBase
class TaigaService extends TaigaBase class TaigaService extends TaigaBase
class TaigaController extends TaigaBase
@.taiga.TaigaBase = TaigaBase @.taiga.TaigaBase = TaigaBase
@.taiga.TaigaService = TaigaService @.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) -> get: (url, params) ->
return @.request({ return @.request({
method: "GET", method: "GET",
url: url,
params: params params: params
}) })
post: (url, data, params) -> post: (url, data, params) ->
options = {method: "POST"} options = {method: "POST", url: url}
options.data = data if data options.data = data if data
options.params = params if params options.params = params if params
return @.request(options) return @.request(options)
put: (url, data, params) -> put: (url, data, params) ->
options = {method: "PUT"} options = {method: "PUT", url: url}
options.data = data if data options.data = data if data
options.params = params if params options.params = params if params
return @.request(options) return @.request(options)
patch: (url, data, params) -> patch: (url, data, params) ->
options = {method: "PATCH"} options = {method: "PATCH", url: url}
options.data = data if data options.data = data if data
options.params = params if params options.params = params if params
return @.request(options) return @.request(options)
delete: (url, data, params) -> delete: (url, data, params) ->
options = {method: "DELETE"} options = {method: "DELETE", url: url}
options.data = data if data options.data = data if data
options.params = params if params options.params = params if params
return @.request(options) return @.request(options)
module = angular.module("taigaResources")
module.service("$tgHttp", HttpService)

View File

@ -18,9 +18,9 @@
taiga = @.taiga taiga = @.taiga
class RepositoryService extends taiga.TaigaService 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() super()
resolveUrlForModel: (model) -> resolveUrlForModel: (model) ->
@ -98,25 +98,24 @@ class RepositoryService extends taiga.TaigaService
return defered.promise return defered.promise
queryMany: (name, params) -> queryMany: (name, params) ->
url = @urls.resolve(name) url = @urls.resolve(name)
return @http.get(url, params).then (data, status) -> return @http.get(url, params).then (data) =>
return _.map(data, (x) -> @model.make_model(name, x)) return _.map(data.data, (x) => @model.make_model(name, x))
queryOne: (name, id, params) -> queryOne: (name, id, params) ->
url = @urls.resolve(name) url = @urls.resolve(name)
url = "#{url}/#{id}" if id 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) return @model.make_model(name, data)
queryPaginated: (name, params) -> queryPaginated: (name, params) ->
url = @urls.resolve(name) url = @urls.resolve(name)
return @http.get(url, params).then (data, status, headers) -> return @http.get(url, params).then (data) =>
headers = headers() headers = data.headers()
result = {} 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.count = parseInt(headers["x-pagination-count"], 10)
result.current = parseInt(headers["x-pagination-current"] or 1, 10) result.current = parseInt(headers["x-pagination-current"] or 1, 10)
result.paginatedBy = parseInt(headers["x-paginated-by"], 10) result.paginatedBy = parseInt(headers["x-paginated-by"], 10)

View File

@ -4,6 +4,7 @@ block head
title Taiga Project management web application with scrum in mind! title Taiga Project management web application with scrum in mind!
block content block content
div(tg-backlog)
sidebar.menu-secondary.extrabar.filters-bar sidebar.menu-secondary.extrabar.filters-bar
include views/modules/filters include views/modules/filters
section.main.backlog section.main.backlog

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

@ -32,8 +32,13 @@ var paths = {
sassMain: "app/styles/main.scss", sassMain: "app/styles/main.scss",
css: "dist/styles/**/*.css", css: "dist/styles/**/*.css",
images: "app/images/**/*", images: "app/images/**/*",
coffee: ["app/coffee/**/*.coffee", coffee: ["app/coffee/app.coffee",
"config/main.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. // Ordered list of vendor/external libraries.