Add commons module.
parent
988675c310
commit
1df1d972a0
|
@ -53,18 +53,20 @@ init = ($log, $i18n, $config, $rootscope) ->
|
|||
$i18n.initialize($config.get("defaultLanguage"))
|
||||
$log.debug("Initialize application")
|
||||
|
||||
# Default Value for taiga local config module.
|
||||
angular.module("taigaLocalConfig", []).value("localconfig", {})
|
||||
|
||||
configure.$inject = ["$routeProvider", "$locationProvider", "$httpProvider"]
|
||||
init.$inject = ["$log", "$tgI18n", "$tgConfig","$rootScope"]
|
||||
# Default constructor for common module
|
||||
angular.module("taigaCommon", [])
|
||||
|
||||
modules = [
|
||||
# Main Modules
|
||||
# Main Global Modules
|
||||
"taigaConfig",
|
||||
"taigaBase",
|
||||
"taigaResources",
|
||||
"taigaLocales",
|
||||
"taigaAuth",
|
||||
|
||||
"taigaCommon",
|
||||
"taigaNavigation",
|
||||
|
||||
# Specific Modules
|
||||
|
@ -75,10 +77,20 @@ modules = [
|
|||
"ngAnimate",
|
||||
]
|
||||
|
||||
# Default Value for taiga local config module.
|
||||
angular.module("taigaLocalConfig", []).value("localconfig", {})
|
||||
|
||||
# Main module definition
|
||||
module = angular.module("taiga", modules)
|
||||
module.config(configure)
|
||||
module.run(init)
|
||||
|
||||
module.config([
|
||||
"$routeProvider",
|
||||
"$locationProvider",
|
||||
"$httpProvider",
|
||||
configure
|
||||
])
|
||||
|
||||
module.run([
|
||||
"$log",
|
||||
"$tgI18n",
|
||||
"$tgConfig",
|
||||
"$rootScope",
|
||||
init
|
||||
])
|
||||
|
|
|
@ -288,12 +288,6 @@ BacklogSprintDirective = ($repo) ->
|
|||
if not $scope.$first and not sprint.closed
|
||||
$el.addClass("sprint-old-open")
|
||||
|
||||
# Atatch formatted dates
|
||||
initialDate = moment(sprint.estimated_start).format("YYYY/MM/DD")
|
||||
finishDate = moment(sprint.estimated_finish).format("YYYY/MM/DD")
|
||||
dates = "#{initialDate}-#{finishDate}"
|
||||
$el.find(".sprint-date").html(dates)
|
||||
|
||||
# Update progress bars
|
||||
progressPercentage = Math.round(100 * (sprint.closed_points / sprint.total_points))
|
||||
$el.find(".current-progress").css("width", "#{progressPercentage}%")
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
###
|
||||
# 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/>.
|
||||
#
|
||||
# File: modules/common/directives.coffee
|
||||
###
|
||||
|
||||
taiga = @.taiga
|
||||
bindOnce = @.taiga.bindOnce
|
||||
|
||||
DateRangeDirective = ->
|
||||
renderRange = ($el, first, second) ->
|
||||
initDate = moment(first).format("YYYY/MM/DD")
|
||||
endDate = moment(second).format("YYYY/MM/DD")
|
||||
$el.html("#{initDate}-#{endDate}")
|
||||
|
||||
link = ($scope, $el, $attrs) ->
|
||||
[first, second] = $attrs.tgDateRange.split(",")
|
||||
|
||||
bindOnce $scope, first, (valFirst) ->
|
||||
bindOnce $scope, second, (valSecond) ->
|
||||
renderRange($el, valFirst, valSecond)
|
||||
|
||||
return {link:link}
|
||||
|
||||
|
||||
SprintProgressBarDirective = ->
|
||||
link = ($scope, $el, $attrs) ->
|
||||
bindOnce $scope, $attrs.tgSprintProgressbar, (sprint) ->
|
||||
closedPoints = sprint.closed_points
|
||||
totalPoints = sprint.total_points
|
||||
percentage = Math.round(100 * (closedPoints/totalPoints))
|
||||
$el.css("width", "#{percentage}%")
|
||||
|
||||
return {link: link}
|
||||
|
||||
|
||||
module = angular.module("taigaCommon")
|
||||
module.directive("tgDateRange", DateRangeDirective)
|
||||
module.directive("tgSprintProgressbar", SprintProgressBarDirective)
|
|
@ -21,13 +21,8 @@
|
|||
|
||||
taiga = @.taiga
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ResourcesService extends taiga.Service
|
||||
|
||||
|
||||
urls = {
|
||||
"auth": "/api/v1/auth"
|
||||
"auth-register": "/api/v1/auth/register"
|
||||
|
|
|
@ -15,7 +15,7 @@ section.sprints
|
|||
div.sprint-summary
|
||||
a.icon.icon-arrow-up(href="", title="compact Sprint")
|
||||
span.sprint-name current sprint
|
||||
span.sprint-date
|
||||
span.sprint-date(tg-date-range="sprint.estimated_start,sprint.estimated_finish")
|
||||
ul
|
||||
li
|
||||
span.number(tg-bo-html="sprint.closed_points") --
|
||||
|
@ -24,7 +24,7 @@ section.sprints
|
|||
span.number(tg-bo-html="sprint.total_points") --
|
||||
span.description total<br />points
|
||||
div.sprint-progress-bar
|
||||
div.current-progress
|
||||
div.current-progress(tg-sprint-progressbar="sprint")
|
||||
div.sprint-table
|
||||
div.row.milestone-us-item-row(ng-repeat="us in sprint.user_stories track by us.id")
|
||||
div.column-us.width-8
|
||||
|
@ -32,6 +32,6 @@ section.sprints
|
|||
span(tg-bo-ref="us.ref")
|
||||
span(tg-bo-html="us.subject")
|
||||
div.column-points.width-1(tg-bo-html="us.total_points")
|
||||
a.button.button-gray(href="", tg-nav="project-taskboard:project=projectId,sprint=sprint.id",
|
||||
a.button.button-gray(href="", tg-nav="project-taskboard:project=project.slug,sprint=sprint.id",
|
||||
title="Current Sprint Taskboard")
|
||||
span Sprint Taskboard
|
||||
|
|
|
@ -37,6 +37,7 @@ paths = {
|
|||
"app/coffee/*.coffee",
|
||||
"app/coffee/modules/controllerMixins.coffee",
|
||||
"app/coffee/modules/*.coffee",
|
||||
"app/coffee/modules/common/*.coffee",
|
||||
"app/coffee/modules/backlog/*.coffee",
|
||||
"app/coffee/modules/locales/*.coffee",
|
||||
"app/coffee/modules/base/*.coffee",
|
||||
|
|
Loading…
Reference in New Issue