From a33ecb9570519fbb61e19571d219e68c04b2c388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Barrag=C3=A1n=20Merino?= Date: Mon, 27 Apr 2015 18:43:28 +0200 Subject: [PATCH] [i18n] Translate the team page and fix the filter --- app/coffee/modules/team/main.coffee | 27 ++++++++++++++----- app/locales/locale-en.json | 2 +- app/locales/locale-es.json | 4 +-- app/locales/locale-fr.json | 2 +- app/partials/team/leave-project.jade | 4 +-- app/partials/team/team-filter.jade | 10 +++---- .../team/team-member-current-user.jade | 16 ++++++----- app/partials/team/team-member-stats.jade | 27 +++++++++++-------- app/partials/team/team-members.jade | 16 ++++++----- 9 files changed, 67 insertions(+), 41 deletions(-) diff --git a/app/coffee/modules/team/main.coffee b/app/coffee/modules/team/main.coffee index edfc9e5d..6cfe21b7 100644 --- a/app/coffee/modules/team/main.coffee +++ b/app/coffee/modules/team/main.coffee @@ -45,7 +45,8 @@ class TeamController extends mixOf(taiga.Controller, taiga.PageMixin) "$translate" ] - constructor: (@scope, @rootscope, @repo, @rs, @params, @q, @location, @navUrls, @appTitle, @auth, tgLoader, @translate) -> + constructor: (@scope, @rootscope, @repo, @rs, @params, @q, @location, @navUrls, @appTitle, @auth, tgLoader, + @translate) -> @scope.sectionName = "TEAM.SECTION_NAME" promise = @.loadInitialData() @@ -138,6 +139,7 @@ class TeamController extends mixOf(taiga.Controller, taiga.PageMixin) module.controller("TeamController", TeamController) + ############################################################################# ## Team Filters Directive ############################################################################# @@ -149,6 +151,7 @@ TeamFiltersDirective = () -> module.directive("tgTeamFilters", [TeamFiltersDirective]) + ############################################################################# ## Team Member Stats Directive ############################################################################# @@ -167,6 +170,7 @@ TeamMemberStatsDirective = () -> module.directive("tgTeamMemberStats", TeamMemberStatsDirective) + ############################################################################# ## Team Current User Directive ############################################################################# @@ -186,6 +190,7 @@ TeamMemberCurrentUserDirective = () -> module.directive("tgTeamCurrentUser", TeamMemberCurrentUserDirective) + ############################################################################# ## Team Members Directive ############################################################################# @@ -208,6 +213,7 @@ TeamMembersDirective = () -> module.directive("tgTeamMembers", TeamMembersDirective) + ############################################################################# ## Leave project Directive ############################################################################# @@ -236,10 +242,17 @@ LeaveProjectDirective = ($repo, $confirm, $location, $rs, $navurls, $translate) link: link } -module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", LeaveProjectDirective]) +module.directive("tgLeaveProject", ["$tgRepo", "$tgConfirm", "$tgLocation", "$tgResources", "$tgNavUrls", + LeaveProjectDirective]) -module.filter 'membersRoleFilter', () -> - (input, filtersRole) -> - if filtersRole? - return _.filter(input, {role: filtersRole.id}) - return input + +############################################################################# +## Team Filters +############################################################################# + +membersFilter = -> + return (members, filtersQ, filtersRole) -> + return _.filter members, (m) -> (not filtersRole or m.role == filtersRole.id) and + (not filtersQ or m.full_name.search(new RegExp(filtersQ, "i")) >= 0) + +module.filter('membersFilter', membersFilter) diff --git a/app/locales/locale-en.json b/app/locales/locale-en.json index 739350ec..c028ffab 100644 --- a/app/locales/locale-en.json +++ b/app/locales/locale-en.json @@ -818,7 +818,7 @@ "TEAM": { "SECTION_NAME": "Team", "APP_TITLE": "TEAM - {{projectName}}", - "PLACEHOLDER_INPUT_SEARCH": "Search by username or role...", + "PLACEHOLDER_INPUT_SEARCH": "Search by full name...", "COLUMN_MR_WOLF": "Mr. Wolf", "EXPLANATION_COLUMN_MR_WOLF": "Closed issues", "COLUMN_IOCAINE": "Iocaine Drinker", diff --git a/app/locales/locale-es.json b/app/locales/locale-es.json index 41d234ba..9ee1b99c 100644 --- a/app/locales/locale-es.json +++ b/app/locales/locale-es.json @@ -815,7 +815,7 @@ "TEAM": { "SECTION_NAME": "Equipo", "APP_TITLE": "EQUIPO - {{projectName}}", - "PLACEHOLDER_INPUT_SEARCH": "Buscar por nombre de usuario o rol", + "PLACEHOLDER_INPUT_SEARCH": "Buscar por nombre completo...", "COLUMN_MR_WOLF": "Sr. Lobo", "EXPLANATION_COLUMN_MR_WOLF": "Peticiones cerradas", "COLUMN_IOCAINE": "Bebedor de Iocaína", @@ -831,7 +831,7 @@ "SECTION_TITLE_TEAM": "Equipo >", "SECTION_FILTER_ALL": "Todo", "CONFIRM_LEAVE_PROJECT": "¿Esta seguro que desea dejar el proyecto?", - "ACTION_LEAVE_PROJECT": "Abandonar esté proyecto" + "ACTION_LEAVE_PROJECT": "Abandonar este proyecto" }, "CHANGE_PASSWORD": { "SECTION_NAME": "Cambiar contraseña", diff --git a/app/locales/locale-fr.json b/app/locales/locale-fr.json index 43b510aa..c365966e 100644 --- a/app/locales/locale-fr.json +++ b/app/locales/locale-fr.json @@ -815,7 +815,7 @@ "TEAM": { "SECTION_NAME": "Equipe", "APP_TITLE": "EQUIPE - {{projectName}}", - "PLACEHOLDER_INPUT_SEARCH": "Rechercher par nom ou par rôle...", + "PLACEHOLDER_INPUT_SEARCH": "Rechercher par nom...", "COLUMN_MR_WOLF": "Mr. Wolf", "EXPLANATION_COLUMN_MR_WOLF": "Bugs fermés", "COLUMN_IOCAINE": "Buveur de iocaine", diff --git a/app/partials/team/leave-project.jade b/app/partials/team/leave-project.jade index 16b599f0..b9d52ae0 100644 --- a/app/partials/team/leave-project.jade +++ b/app/partials/team/leave-project.jade @@ -1,3 +1,3 @@ -a.leave-project(ng-click='leave()', href='') +a.leave-project(ng-click="leave()", href="") span.icon.icon-delete - | {{"TEAM.ACTION_LEAVE_PROJECT" | translate}} + | {{ 'TEAM.ACTION_LEAVE_PROJECT' | translate }} diff --git a/app/partials/team/team-filter.jade b/app/partials/team/team-filter.jade index 26ae1828..d23c8644 100644 --- a/app/partials/team/team-filter.jade +++ b/app/partials/team/team-filter.jade @@ -1,10 +1,10 @@ ul li - a(ng-class='{active: !filtersRole.id}', ng-click='ctrl.setRole()', href='') + a(ng-class="{active: !filtersRole.id}", ng-click="ctrl.setRole()", href="") span.title(translate="TEAM.SECTION_FILTER_ALL") span.icon.icon-arrow-right - li(ng-repeat='role in roles') - a(ng-class='{active: role.id == filtersRole.id}', ng-click='ctrl.setRole(role)', href='') - span.title(tg-bo-bind='role.name') - span.icon.icon-arrow-right + li(ng-repeat="role in roles") + a(ng-class="{active: role.id == filtersRole.id}", ng-click="ctrl.setRole(role)", href="") + span.title(tg-bo-bind="role.name") + span.icon.icon-arrow-right diff --git a/app/partials/team/team-member-current-user.jade b/app/partials/team/team-member-current-user.jade index d25c2a16..698c2f7f 100644 --- a/app/partials/team/team-member-current-user.jade +++ b/app/partials/team/team-member-current-user.jade @@ -1,13 +1,17 @@ .row .username figure.avatar - img(tg-bo-src='currentUser.photo', tg-bo-alt='currentUser.full_name') + img(tg-bo-src="currentUser.photo", tg-bo-alt="currentUser.full_name") - figcaption - span.name(tg-bo-bind='currentUser.full_name') + figcaption + span.name(tg-bo-bind="currentUser.full_name") - span.position(tg-bo-bind='currentUser.role_name') + span.position(tg-bo-bind="currentUser.role_name") - div(tg-leave-project='', projectid='{{projectId}}') + div(tg-leave-project="", projectid="{{projectId}}") - .member-stats(tg-team-member-stats, stats="stats", user="currentUser.user", issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled") + .member-stats(tg-team-member-stats, stats="stats", + user="currentUser.user", + issuesEnabled="issuesEnabled", + tasksenabled="tasksEnabled", + wikienabled="wikiEnabled") diff --git a/app/partials/team/team-member-stats.jade b/app/partials/team/team-member-stats.jade index e611ef0c..c271ffe0 100644 --- a/app/partials/team/team-member-stats.jade +++ b/app/partials/team/team-member-stats.jade @@ -1,17 +1,22 @@ -.attribute(ng-if='issuesEnabled') - span.icon.icon-briefcase(ng-style="{'opacity': stats.closed_bugs[userId]}", ng-class="{'top': stats.closed_bugs[userId] == 1}") +.attribute(ng-if="issuesEnabled") + span.icon.icon-briefcase(ng-style="{'opacity': stats.closed_bugs[userId]}", + ng-class="{'top': stats.closed_bugs[userId] == 1}") -.attribute(ng-if='tasksEnabled') - span.icon.icon-iocaine(ng-style="{'opacity': stats.iocaine_tasks[userId]}", ng-class="{'top': stats.iocaine_tasks[userId] == 1}") +.attribute(ng-if="tasksEnabled") + span.icon.icon-iocaine(ng-style="{'opacity': stats.iocaine_tasks[userId]}", + ng-class="{'top': stats.iocaine_tasks[userId] == 1}") -.attribute(ng-if='wikiEnabled') - span.icon.icon-writer(ng-style="{'opacity': stats.wiki_changes[userId]}", ng-class="{'top': stats.wiki_changes[userId] == 1}") +.attribute(ng-if="wikiEnabled") + span.icon.icon-writer(ng-style="{'opacity': stats.wiki_changes[userId]}", + ng-class="{'top': stats.wiki_changes[userId] == 1}") -.attribute(ng-if='issuesEnabled') - span.icon.icon-bug(ng-style="{'opacity': stats.created_bugs[userId]}", ng-class="{'top': stats.created_bugs[userId] == 1}") +.attribute(ng-if="issuesEnabled") + span.icon.icon-bug(ng-style="{'opacity': stats.created_bugs[userId]}", + ng-class="{'top': stats.created_bugs[userId] == 1}") -.attribute(ng-if='tasksEnabled') - span.icon.icon-tasks(ng-style="{'opacity': stats.closed_tasks[userId]}", ng-class="{'top': stats.closed_tasks[userId] == 1}") +.attribute(ng-if="tasksEnabled") + span.icon.icon-tasks(ng-style="{'opacity': stats.closed_tasks[userId]}", + ng-class="{'top': stats.closed_tasks[userId] == 1}") .attribute - span.points(ng-bind='stats.totals[userId]') + span.points(ng-bind="stats.totals[userId]") diff --git a/app/partials/team/team-members.jade b/app/partials/team/team-members.jade index ed77d85d..7cc07391 100644 --- a/app/partials/team/team-members.jade +++ b/app/partials/team/team-members.jade @@ -1,11 +1,15 @@ -.row.member(ng-repeat='user in memberships | filter:filtersQ | membersRoleFilter:filtersRole') +.row.member(ng-repeat="user in memberships | membersFilter:filtersQ:filtersRole") .username figure.avatar - img(tg-bo-src='user.photo', tg-bo-alt='user.full_name') + img(tg-bo-src="user.photo", tg-bo-alt="user.full_name") - figcaption - span.name(tg-bo-bind='user.full_name') + figcaption + span.name(tg-bo-bind="user.full_name") - span.position(tg-bo-bind='user.role_name') + span.position(tg-bo-bind="user.role_name") - .member-stats(tg-team-member-stats, stats="stats", user="user.user", issuesEnabled="issuesEnabled", tasksenabled="tasksEnabled", wikienabled="wikiEnabled") + .member-stats(tg-team-member-stats, stats="stats", + user="user.user", + issuesEnabled="issuesEnabled", + tasksenabled="tasksEnabled", + wikienabled="wikiEnabled")