diff --git a/app/coffee/modules/resources.coffee b/app/coffee/modules/resources.coffee index afb7043d..ae917665 100644 --- a/app/coffee/modules/resources.coffee +++ b/app/coffee/modules/resources.coffee @@ -81,6 +81,7 @@ urls = { "project-transfer-start": "/projects/%s/transfer_start" # Project Values - Choises + "epic-statuses": "/epic-statuses" "userstory-statuses": "/userstory-statuses" "points": "/points" "task-statuses": "/task-statuses" @@ -223,6 +224,7 @@ module.run([ "$tgRolesResourcesProvider", "$tgUserSettingsResourcesProvider", "$tgSprintsResourcesProvider", + "$tgEpicsResourcesProvider", "$tgUserstoriesResourcesProvider", "$tgTasksResourcesProvider", "$tgIssuesResourcesProvider", diff --git a/app/coffee/modules/resources/epics.coffee b/app/coffee/modules/resources/epics.coffee new file mode 100644 index 00000000..9793f485 --- /dev/null +++ b/app/coffee/modules/resources/epics.coffee @@ -0,0 +1,55 @@ +### +# Copyright (C) 2014-2016 Andrey Antukh +# Copyright (C) 2014-2016 Jesús Espino Garcia +# Copyright (C) 2014-2016 David Barragán Merino +# Copyright (C) 2014-2016 Alejandro Alonso +# Copyright (C) 2014-2016 Juan Francisco Alcántara +# Copyright (C) 2014-2016 Xavi Julian +# +# 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 . +# +# File: modules/resources/epics.coffee +### + + +taiga = @.taiga + +generateHash = taiga.generateHash + + +resourceProvider = ($repo, $storage) -> + service = {} + hashSuffix = "epics-queryparams" + + service.listValues = (projectId, type) -> + params = {"project": projectId} + service.storeQueryParams(projectId, params) + return $repo.queryMany(type, params) + + service.storeQueryParams = (projectId, params) -> + ns = "#{projectId}:#{hashSuffix}" + hash = generateHash([projectId, ns]) + $storage.set(hash, params) + + service.getQueryParams = (projectId) -> + ns = "#{projectId}:#{hashSuffix}" + hash = generateHash([projectId, ns]) + return $storage.get(hash) or {} + + return (instance) -> + instance.epics = service + + +module = angular.module("taigaResources") +module.factory("$tgEpicsResourcesProvider", ["$tgRepo", "$tgStorage", resourceProvider]) diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index 5e8d7ed9..7fa886c2 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -609,7 +609,8 @@ "PROJECT_VALUES_STATUS": { "TITLE": "Status", "SUBTITLE": "Specify the statuses your user stories, tasks and issues will go through", - "US_TITLE": "US Statuses", + "EPIC_TITLE": "Epic Statuses", + "US_TITLE": "User Story Statuses", "TASK_TITLE": "Task Statuses", "ISSUE_TITLE": "Issue Statuses" }, diff --git a/app/partials/admin/admin-project-values-status.jade b/app/partials/admin/admin-project-values-status.jade index 8eab5f9b..64540f3a 100644 --- a/app/partials/admin/admin-project-values-status.jade +++ b/app/partials/admin/admin-project-values-status.jade @@ -15,6 +15,12 @@ div.wrapper(ng-controller="ProjectValuesSectionController", include ../includes/components/mainTitle p.admin-subtitle(translate="ADMIN.PROJECT_VALUES_STATUS.SUBTITLE") + div.admin-attributes-section(tg-project-values, type="epic-statuses", + ng-controller="ProjectValuesController as ctrl", + ng-init="section='admin'; resource='epics'; type='epic-statuses'; sectionName='ADMIN.PROJECT_VALUES_STATUS.EPIC_TITLE'" + objName="status") + include ../includes/modules/admin/project-status + div.admin-attributes-section(tg-project-values, type="userstory-statuses", ng-controller="ProjectValuesController as ctrl", ng-init="section='admin'; resource='userstories'; type='userstory-statuses'; sectionName='ADMIN.PROJECT_VALUES_STATUS.US_TITLE'",