From 867ddb5fd0172dda31fb2db6b38cd672b1422247 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Hermida?= Date: Thu, 14 Jun 2018 16:58:24 +0200 Subject: [PATCH 1/2] Add assigned users filter --- app/coffee/modules/controllerMixins.coffee | 20 ++++++++++++++++--- .../modules/kanban/kanban-usertories.coffee | 12 +++++------ app/locales/taiga/locale-en.json | 1 + 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/coffee/modules/controllerMixins.coffee b/app/coffee/modules/controllerMixins.coffee index a21d0d2b..4c8df028 100644 --- a/app/coffee/modules/controllerMixins.coffee +++ b/app/coffee/modules/controllerMixins.coffee @@ -223,6 +223,7 @@ class UsFiltersMixin loadFilters.project = @scope.projectId loadFilters.tags = urlfilters.tags loadFilters.status = urlfilters.status + loadFilters.assigned_users = urlfilters.assigned_users loadFilters.assigned_to = urlfilters.assigned_to loadFilters.owner = urlfilters.owner loadFilters.epic = urlfilters.epic @@ -249,6 +250,15 @@ class UsFiltersMixin return it tagsWithAtLeastOneElement = _.filter tags, (tag) -> return tag.count > 0 + assignedUsers = _.map data.assigned_users, (it) -> + if it.id + it.id = it.id.toString() + else + it.id = "null" + + it.name = it.full_name || "Unassigned" + + return it assignedTo = _.map data.assigned_to, (it) -> if it.id it.id = it.id.toString() @@ -292,6 +302,10 @@ class UsFiltersMixin selected = @.formatSelectedFilters("tags", tags, loadFilters.tags) @.selectedFilters = @.selectedFilters.concat(selected) + if loadFilters.assigned_users + selected = @.formatSelectedFilters("assigned_users", assignedUsers, loadFilters.assigned_users) + @.selectedFilters = @.selectedFilters.concat(selected) + if loadFilters.assigned_to selected = @.formatSelectedFilters("assigned_to", assignedTo, loadFilters.assigned_to) @.selectedFilters = @.selectedFilters.concat(selected) @@ -324,9 +338,9 @@ class UsFiltersMixin totalTaggedElements: tagsWithAtLeastOneElement.length }, { - title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_TO"), - dataType: "assigned_to", - content: assignedTo + title: @translate.instant("COMMON.FILTERS.CATEGORIES.ASSIGNED_USERS"), + dataType: "assigned_users", + content: assignedUsers }, { title: @translate.instant("COMMON.FILTERS.CATEGORIES.ROLE"), diff --git a/app/coffee/modules/kanban/kanban-usertories.coffee b/app/coffee/modules/kanban/kanban-usertories.coffee index 477bc92b..5f89f29a 100644 --- a/app/coffee/modules/kanban/kanban-usertories.coffee +++ b/app/coffee/modules/kanban/kanban-usertories.coffee @@ -95,7 +95,7 @@ class KanbanUserstoriesService extends taiga.Service move: (usList, statusId, index) -> initialLength = usList.length - + usByStatus = _.filter @.userstoriesRaw, (it) => return it.status == statusId @@ -130,19 +130,19 @@ class KanbanUserstoriesService extends taiga.Service previousWithTheSameOrder = _.filter(beforeDestination, (it) => it.kanban_order == @.order[previous.id] - ) + ) for it, key in afterDestination # increase position of the us after the dragged us's @.order[it.id] = @.order[previous.id] + key + initialLength + 1 - it.kanban_order = @.order[it.id] + it.kanban_order = @.order[it.id] setNextOrders = _.map(afterDestination, (it) => {us_id: it.id, order: @.order[it.id]} - ) + ) # we must send the USs previous to the dropped USs to tell the backend # which USs are before the dropped USs, if they have the same value to # order, the backend doens't know after which one do you want to drop - # the USs + # the USs if previousWithTheSameOrder.length > 1 setPreviousOrders = _.map(previousWithTheSameOrder, (it) => {us_id: it.id, order: @.order[it.id]} @@ -153,7 +153,7 @@ class KanbanUserstoriesService extends taiga.Service us.kanban_order = startIndex + key @.order[us.id] = us.kanban_order - modifiedUs.push({us_id: us.id, order: us.kanban_order}) + modifiedUs.push({us_id: us.id, order: us.kanban_order}) @.refresh() diff --git a/app/locales/taiga/locale-en.json b/app/locales/taiga/locale-en.json index 6af3550e..82c97e4a 100644 --- a/app/locales/taiga/locale-en.json +++ b/app/locales/taiga/locale-en.json @@ -221,6 +221,7 @@ "PRIORITIES": "Priorities", "TAGS": "Tags", "ASSIGNED_TO": "Assigned to", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Role", "CREATED_BY": "Created by", "CUSTOM_FILTERS": "Custom filters", From 67af7383951894c447f28ad004114803fb75dff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lex=20Hermida?= Date: Wed, 27 Jun 2018 13:21:17 +0200 Subject: [PATCH 2/2] Update languages --- app/locales/taiga/locale-ca.json | 1 + app/locales/taiga/locale-de.json | 1 + app/locales/taiga/locale-es.json | 1 + app/locales/taiga/locale-fa.json | 1 + app/locales/taiga/locale-fi.json | 1 + app/locales/taiga/locale-fr.json | 1 + app/locales/taiga/locale-it.json | 1 + app/locales/taiga/locale-ja.json | 1 + app/locales/taiga/locale-ko.json | 1 + app/locales/taiga/locale-nb.json | 1 + app/locales/taiga/locale-nl.json | 1 + app/locales/taiga/locale-pl.json | 1 + app/locales/taiga/locale-pt-br.json | 1 + app/locales/taiga/locale-ru.json | 1 + app/locales/taiga/locale-sv.json | 1 + app/locales/taiga/locale-tr.json | 1 + app/locales/taiga/locale-zh-hans.json | 1 + app/locales/taiga/locale-zh-hant.json | 1 + 18 files changed, 18 insertions(+) diff --git a/app/locales/taiga/locale-ca.json b/app/locales/taiga/locale-ca.json index a52e5a26..205be19a 100644 --- a/app/locales/taiga/locale-ca.json +++ b/app/locales/taiga/locale-ca.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioritats", "TAGS": "Etiquetes", "ASSIGNED_TO": "Assignat a", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rol", "CREATED_BY": "Creat per", "CUSTOM_FILTERS": "Filtres personalitzats", diff --git a/app/locales/taiga/locale-de.json b/app/locales/taiga/locale-de.json index 2501c98e..4f286b47 100644 --- a/app/locales/taiga/locale-de.json +++ b/app/locales/taiga/locale-de.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioritäten", "TAGS": "Schlagwörter", "ASSIGNED_TO": "Zugeordnet zu", + "ASSIGNED_USERS": "Zugewiesene Benutzer", "ROLE": "Rolle", "CREATED_BY": "Erstellt durch", "CUSTOM_FILTERS": "Benutzerfilter", diff --git a/app/locales/taiga/locale-es.json b/app/locales/taiga/locale-es.json index 1e806fbe..4d759095 100644 --- a/app/locales/taiga/locale-es.json +++ b/app/locales/taiga/locale-es.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioridades", "TAGS": "Etiquetas", "ASSIGNED_TO": "Asignado a", + "ASSIGNED_USERS": "Usuarios asignados", "ROLE": "Rol", "CREATED_BY": "Creada por", "CUSTOM_FILTERS": "Filtros personalizados", diff --git a/app/locales/taiga/locale-fa.json b/app/locales/taiga/locale-fa.json index 081b6f72..ac4efd4b 100644 --- a/app/locales/taiga/locale-fa.json +++ b/app/locales/taiga/locale-fa.json @@ -222,6 +222,7 @@ "PRIORITIES": "اولویت‌ها", "TAGS": "برچسب‌ها", "ASSIGNED_TO": "اختصاص یافته به", + "ASSIGNED_USERS": "کاربران اختصاص یافته", "ROLE": "قش", "CREATED_BY": "ایجاد توسط", "CUSTOM_FILTERS": "فیلترهای سفارشی", diff --git a/app/locales/taiga/locale-fi.json b/app/locales/taiga/locale-fi.json index 72d5ac0e..e80187cf 100644 --- a/app/locales/taiga/locale-fi.json +++ b/app/locales/taiga/locale-fi.json @@ -222,6 +222,7 @@ "PRIORITIES": "Kiireellisyydet", "TAGS": "Avainsanat", "ASSIGNED_TO": "Tekijä", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rooli", "CREATED_BY": "Luoja", "CUSTOM_FILTERS": "Omat suodattimet", diff --git a/app/locales/taiga/locale-fr.json b/app/locales/taiga/locale-fr.json index d97d468d..d623a17b 100644 --- a/app/locales/taiga/locale-fr.json +++ b/app/locales/taiga/locale-fr.json @@ -222,6 +222,7 @@ "PRIORITIES": "Priorités", "TAGS": "Mots-clés", "ASSIGNED_TO": "Affecté à", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rôle", "CREATED_BY": "Créé par", "CUSTOM_FILTERS": "Filtres personnalisés", diff --git a/app/locales/taiga/locale-it.json b/app/locales/taiga/locale-it.json index 526410a7..923eb7b1 100644 --- a/app/locales/taiga/locale-it.json +++ b/app/locales/taiga/locale-it.json @@ -222,6 +222,7 @@ "PRIORITIES": "Priorità", "TAGS": "Tag", "ASSIGNED_TO": "Assegnato a", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Ruolo", "CREATED_BY": "Creato da", "CUSTOM_FILTERS": "Filtri personalizzati", diff --git a/app/locales/taiga/locale-ja.json b/app/locales/taiga/locale-ja.json index 1d7cdfd7..8748eab8 100644 --- a/app/locales/taiga/locale-ja.json +++ b/app/locales/taiga/locale-ja.json @@ -222,6 +222,7 @@ "PRIORITIES": "優先度", "TAGS": "タグ", "ASSIGNED_TO": "割当", + "ASSIGNED_USERS": "割当ユーザー", "ROLE": "役割", "CREATED_BY": "作成者", "CUSTOM_FILTERS": "カスタムフィルター", diff --git a/app/locales/taiga/locale-ko.json b/app/locales/taiga/locale-ko.json index c42e3d5b..75a229b6 100644 --- a/app/locales/taiga/locale-ko.json +++ b/app/locales/taiga/locale-ko.json @@ -222,6 +222,7 @@ "PRIORITIES": "우선순위", "TAGS": "태그", "ASSIGNED_TO": "할당됨", + "ASSIGNED_USERS": "Assigned users", "ROLE": "역할", "CREATED_BY": "생성함", "CUSTOM_FILTERS": "사용자 정의 필터", diff --git a/app/locales/taiga/locale-nb.json b/app/locales/taiga/locale-nb.json index 30060005..9412121e 100644 --- a/app/locales/taiga/locale-nb.json +++ b/app/locales/taiga/locale-nb.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioriteter", "TAGS": "Etiketter", "ASSIGNED_TO": "Tildelt til", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rolle", "CREATED_BY": "Laget av", "CUSTOM_FILTERS": "Egendefinert filtre", diff --git a/app/locales/taiga/locale-nl.json b/app/locales/taiga/locale-nl.json index d8d03e29..cf6cd801 100644 --- a/app/locales/taiga/locale-nl.json +++ b/app/locales/taiga/locale-nl.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioriteit", "TAGS": "Tags", "ASSIGNED_TO": "Toegewezen aan", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rol", "CREATED_BY": "Aangemaakt door", "CUSTOM_FILTERS": "Eigen filters", diff --git a/app/locales/taiga/locale-pl.json b/app/locales/taiga/locale-pl.json index 359c0fae..fb82d101 100644 --- a/app/locales/taiga/locale-pl.json +++ b/app/locales/taiga/locale-pl.json @@ -222,6 +222,7 @@ "PRIORITIES": "Priorytety", "TAGS": "Tagi", "ASSIGNED_TO": "Przypisane do", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rola", "CREATED_BY": "Stworzona przez", "CUSTOM_FILTERS": "Filtry niestandardowe", diff --git a/app/locales/taiga/locale-pt-br.json b/app/locales/taiga/locale-pt-br.json index 50c99ea4..2b0154d3 100644 --- a/app/locales/taiga/locale-pt-br.json +++ b/app/locales/taiga/locale-pt-br.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioridades", "TAGS": "Tags", "ASSIGNED_TO": "Atribuído a", + "ASSIGNED_USERS": "Usuários atribuídos", "ROLE": "Função", "CREATED_BY": "Criado por", "CUSTOM_FILTERS": "Filtros personalizados", diff --git a/app/locales/taiga/locale-ru.json b/app/locales/taiga/locale-ru.json index 7bee1cbc..55142dc8 100644 --- a/app/locales/taiga/locale-ru.json +++ b/app/locales/taiga/locale-ru.json @@ -222,6 +222,7 @@ "PRIORITIES": "Приоритеты", "TAGS": "Тэги", "ASSIGNED_TO": "Назначено", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Роль", "CREATED_BY": "Создано", "CUSTOM_FILTERS": "Собственные фильтры", diff --git a/app/locales/taiga/locale-sv.json b/app/locales/taiga/locale-sv.json index af87a200..3d1ea1a0 100644 --- a/app/locales/taiga/locale-sv.json +++ b/app/locales/taiga/locale-sv.json @@ -222,6 +222,7 @@ "PRIORITIES": "Prioritet", "TAGS": "Etiketter", "ASSIGNED_TO": "Tilldelad till", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Roll", "CREATED_BY": "Skapad av", "CUSTOM_FILTERS": "Anpassad filter", diff --git a/app/locales/taiga/locale-tr.json b/app/locales/taiga/locale-tr.json index 3cc52b4e..1a8e6b12 100644 --- a/app/locales/taiga/locale-tr.json +++ b/app/locales/taiga/locale-tr.json @@ -222,6 +222,7 @@ "PRIORITIES": "Öncelikler", "TAGS": "Etiketler ", "ASSIGNED_TO": "Atanmış", + "ASSIGNED_USERS": "Assigned users", "ROLE": "Rol", "CREATED_BY": "Oluşturan", "CUSTOM_FILTERS": "Özel filtreler", diff --git a/app/locales/taiga/locale-zh-hans.json b/app/locales/taiga/locale-zh-hans.json index 0e7426ab..a8a901e3 100644 --- a/app/locales/taiga/locale-zh-hans.json +++ b/app/locales/taiga/locale-zh-hans.json @@ -222,6 +222,7 @@ "PRIORITIES": "优先级", "TAGS": "标签", "ASSIGNED_TO": "指派给", + "ASSIGNED_USERS": "被指派人列表", "ROLE": "角色", "CREATED_BY": "由创建", "CUSTOM_FILTERS": "定制过滤器", diff --git a/app/locales/taiga/locale-zh-hant.json b/app/locales/taiga/locale-zh-hant.json index bf89fb0d..fc83e3d3 100644 --- a/app/locales/taiga/locale-zh-hant.json +++ b/app/locales/taiga/locale-zh-hant.json @@ -222,6 +222,7 @@ "PRIORITIES": "優先性", "TAGS": "標籤", "ASSIGNED_TO": "指派給 ", + "ASSIGNED_USERS": "Assigned users", "ROLE": "角色", "CREATED_BY": "由創建", "CUSTOM_FILTERS": "客製過濾器 ",