Fix userstory custom attributes values

stable
David Barragán Merino 2015-02-26 12:34:48 +01:00
parent c8ad480846
commit 08f0a2262a
5 changed files with 22 additions and 12 deletions

View File

@ -47,7 +47,7 @@ class CustomAttributesValuesController extends taiga.Controller
loadCustomAttributesValues: -> loadCustomAttributesValues: ->
return @.customAttributesValues if not @.objectId 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"] @.customAttributes = @.project["#{@.type}_custom_attributes"]
@.customAttributesValues = customAttributesValues @.customAttributesValues = customAttributesValues
return customAttributesValues return customAttributesValues
@ -70,6 +70,7 @@ class CustomAttributesValuesController extends taiga.Controller
@.customAttributesValues.id = @.objectId @.customAttributesValues.id = @.objectId
return @repo.save(@.customAttributesValues).then(onSuccess, onError) return @repo.save(@.customAttributesValues).then(onSuccess, onError)
CustomAttributesValuesDirective = ($templates, $storage) -> CustomAttributesValuesDirective = ($templates, $storage) ->
template = $templates.get("custom-attributes/custom-attributes-values.html", true) template = $templates.get("custom-attributes/custom-attributes-values.html", true)
collapsedHash = (type) -> collapsedHash = (type) ->

View File

@ -103,12 +103,12 @@ urls = {
"attachments/wiki_page": "/wiki/attachments" "attachments/wiki_page": "/wiki/attachments"
# Custom Attributess # Custom Attributess
"custom-attributes/us": "/userstory-custom-attributes" "custom-attributes/userstory": "/userstory-custom-attributes"
"custom-attributes/issue": "/issue-custom-attributes" "custom-attributes/issue": "/issue-custom-attributes"
"custom-attributes/task": "/task-custom-attributes" "custom-attributes/task": "/task-custom-attributes"
# Custom field values # 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/issue": "/issues/custom-attributes-values"
"custom-attributes-values/task": "/tasks/custom-attributes-values" "custom-attributes-values/task": "/tasks/custom-attributes-values"

View File

@ -21,15 +21,24 @@
taiga = @.taiga taiga = @.taiga
resourceProvider = ($rootScope, $config, $urls, $model, $repo, $auth, $q) -> resourceProvider = ($repo) ->
service = {} _get = (objectId, resource) ->
return $repo.queryOne(resource, objectId)
service.get = (type, objectId) -> service = {
return $repo.queryOne("custom-attributes-values/#{type}", objectId) 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) -> return (instance) ->
instance.customAttributesValues = service instance.customAttributesValues = service
module = angular.module("taigaResources") module = angular.module("taigaResources")
module.factory("$tgCustomAttributesValuesResourcesProvider", ["$rootScope", "$tgConfig", "$tgUrls", "$tgModel", "$tgRepo", module.factory("$tgCustomAttributesValuesResourcesProvider", ["$tgRepo", resourceProvider])
"$tgAuth", "$q", resourceProvider])

View File

@ -29,8 +29,8 @@ resourceProvider = ($repo) ->
return $repo.queryMany(resource, {project: projectId}) return $repo.queryMany(resource, {project: projectId})
service = { service = {
us:{ userstory:{
list: (projectId) -> _list(projectId, "custom-attributes/us") list: (projectId) -> _list(projectId, "custom-attributes/userstory")
} }
task:{ task:{
list: (projectId) -> _list(projectId, "custom-attributes/task") list: (projectId) -> _list(projectId, "custom-attributes/task")

View File

@ -1,5 +1,5 @@
div.wrapper(tg-project-custom-attributes, ng-controller="ProjectCustomAttributesController as ctrl", 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") sidebar.menu-secondary.sidebar(tg-admin-navigation="project-values")
include ../includes/modules/admin-menu include ../includes/modules/admin-menu