diff --git a/app/coffee/modules/common/custom-field-values.coffee b/app/coffee/modules/common/custom-field-values.coffee index a9aecefd..bb8c4042 100644 --- a/app/coffee/modules/common/custom-field-values.coffee +++ b/app/coffee/modules/common/custom-field-values.coffee @@ -47,7 +47,7 @@ class CustomAttributesValuesController extends taiga.Controller loadCustomAttributesValues: -> return @.customAttributesValues if not @.objectId - return @rs.customAttributesValues.get(@.type, @.objectId).then (customAttributesValues) => + return @rs.customAttributesValues[@.type].get(@.objectId).then (customAttributesValues) => @.customAttributes = @.project["#{@.type}_custom_attributes"] @.customAttributesValues = customAttributesValues return customAttributesValues @@ -70,6 +70,7 @@ class CustomAttributesValuesController extends taiga.Controller @.customAttributesValues.id = @.objectId return @repo.save(@.customAttributesValues).then(onSuccess, onError) + CustomAttributesValuesDirective = ($templates, $storage) -> template = $templates.get("custom-attributes/custom-attributes-values.html", true) collapsedHash = (type) -> diff --git a/app/coffee/modules/resources.coffee b/app/coffee/modules/resources.coffee index a519d869..1761ae39 100644 --- a/app/coffee/modules/resources.coffee +++ b/app/coffee/modules/resources.coffee @@ -103,12 +103,12 @@ urls = { "attachments/wiki_page": "/wiki/attachments" # Custom Attributess - "custom-attributes/us": "/userstory-custom-attributes" + "custom-attributes/userstory": "/userstory-custom-attributes" "custom-attributes/issue": "/issue-custom-attributes" "custom-attributes/task": "/task-custom-attributes" # Custom field values - "custom-attributes-values/us": "/userstories/custom-attributes-values" + "custom-attributes-values/userstory": "/userstories/custom-attributes-values" "custom-attributes-values/issue": "/issues/custom-attributes-values" "custom-attributes-values/task": "/tasks/custom-attributes-values" diff --git a/app/coffee/modules/resources/custom-attributes-values.coffee b/app/coffee/modules/resources/custom-attributes-values.coffee index cb0415b3..5322c639 100644 --- a/app/coffee/modules/resources/custom-attributes-values.coffee +++ b/app/coffee/modules/resources/custom-attributes-values.coffee @@ -21,15 +21,24 @@ taiga = @.taiga -resourceProvider = ($rootScope, $config, $urls, $model, $repo, $auth, $q) -> - service = {} +resourceProvider = ($repo) -> + _get = (objectId, resource) -> + return $repo.queryOne(resource, objectId) - service.get = (type, objectId) -> - return $repo.queryOne("custom-attributes-values/#{type}", objectId) + service = { + userstory: { + get: (objectId) -> _get(objectId, "custom-attributes-values/userstory") + } + task: { + get: (objectId) -> _get(objectId, "custom-attributes-values/task") + } + issue: { + get: (objectId) -> _get(objectId, "custom-attributes-values/issue") + } + } return (instance) -> instance.customAttributesValues = service module = angular.module("taigaResources") -module.factory("$tgCustomAttributesValuesResourcesProvider", ["$rootScope", "$tgConfig", "$tgUrls", "$tgModel", "$tgRepo", - "$tgAuth", "$q", resourceProvider]) +module.factory("$tgCustomAttributesValuesResourcesProvider", ["$tgRepo", resourceProvider]) diff --git a/app/coffee/modules/resources/custom-attributes.coffee b/app/coffee/modules/resources/custom-attributes.coffee index dde0e637..cf14c398 100644 --- a/app/coffee/modules/resources/custom-attributes.coffee +++ b/app/coffee/modules/resources/custom-attributes.coffee @@ -29,8 +29,8 @@ resourceProvider = ($repo) -> return $repo.queryMany(resource, {project: projectId}) service = { - us:{ - list: (projectId) -> _list(projectId, "custom-attributes/us") + userstory:{ + list: (projectId) -> _list(projectId, "custom-attributes/userstory") } task:{ list: (projectId) -> _list(projectId, "custom-attributes/task") diff --git a/app/partials/admin/admin-project-values-us-extras.jade b/app/partials/admin/admin-project-values-us-extras.jade index 55523d97..40339494 100644 --- a/app/partials/admin/admin-project-values-us-extras.jade +++ b/app/partials/admin/admin-project-values-us-extras.jade @@ -1,5 +1,5 @@ div.wrapper(tg-project-custom-attributes, ng-controller="ProjectCustomAttributesController as ctrl", - ng-init="section='admin'; type='us'; sectionName='US extra'") + ng-init="section='admin'; type='userstory'; sectionName='US extra'") sidebar.menu-secondary.sidebar(tg-admin-navigation="project-values") include ../includes/modules/admin-menu