move normalizeString to utils

stable
Álex Hermida 2018-07-19 10:05:12 +02:00 committed by Alex Hermida
parent bf2ead8839
commit 2339bb8c4b
3 changed files with 12 additions and 36 deletions

View File

@ -24,6 +24,7 @@
taiga = @.taiga taiga = @.taiga
bindOnce = @.taiga.bindOnce bindOnce = @.taiga.bindOnce
normalizeString = @.taiga.normalizeString
module = angular.module("taigaCommon") module = angular.module("taigaCommon")
@ -536,15 +537,6 @@ $translate, $compile, $currentUserService, avatarService) ->
isEditable = -> isEditable = ->
return $scope.project?.my_permissions?.indexOf($attrs.requiredPerm) != -1 return $scope.project?.my_permissions?.indexOf($attrs.requiredPerm) != -1
normalizeString = (string) ->
normalizedString = string
normalizedString = normalizedString.replace("Á", "A").replace("Ä", "A").replace("À", "A")
normalizedString = normalizedString.replace("É", "E").replace("Ë", "E").replace("È", "E")
normalizedString = normalizedString.replace("Í", "I").replace("Ï", "I").replace("Ì", "I")
normalizedString = normalizedString.replace("Ó", "O").replace("Ö", "O").replace("Ò", "O")
normalizedString = normalizedString.replace("Ú", "U").replace("Ü", "U").replace("Ù", "U")
return normalizedString
filterUsers = (text, user) -> filterUsers = (text, user) ->
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
username = normalizeString(username) username = normalizeString(username)
@ -652,15 +644,6 @@ $translate, $compile, $currentUserService, avatarService) ->
isAssigned = -> isAssigned = ->
return currentAssignedIds.length > 0 return currentAssignedIds.length > 0
normalizeString = (string) ->
normalizedString = string
normalizedString = normalizedString.replace("Á", "A").replace("Ä", "A").replace("À", "A")
normalizedString = normalizedString.replace("É", "E").replace("Ë", "E").replace("È", "E")
normalizedString = normalizedString.replace("Í", "I").replace("Ï", "I").replace("Ì", "I")
normalizedString = normalizedString.replace("Ó", "O").replace("Ö", "O").replace("Ò", "O")
normalizedString = normalizedString.replace("Ú", "U").replace("Ü", "U").replace("Ù", "U")
return normalizedString
filterUsers = (text, user) -> filterUsers = (text, user) ->
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
username = normalizeString(username) username = normalizeString(username)

View File

@ -29,6 +29,7 @@ timeout = @.taiga.timeout
debounce = @.taiga.debounce debounce = @.taiga.debounce
sizeFormat = @.taiga.sizeFormat sizeFormat = @.taiga.sizeFormat
trim = @.taiga.trim trim = @.taiga.trim
normalizeString = @.taiga.normalizeString
############################################################################# #############################################################################
## Common Lightbox Services ## Common Lightbox Services
@ -366,15 +367,6 @@ AssignedToLightboxDirective = (lightboxService, lightboxKeyboardNavigationServic
selectedItem = null selectedItem = null
usersTemplate = $template.get("common/lightbox/lightbox-assigned-to-users.html", true) usersTemplate = $template.get("common/lightbox/lightbox-assigned-to-users.html", true)
normalizeString = (string) ->
normalizedString = string
normalizedString = normalizedString.replace("Á", "A").replace("Ä", "A").replace("À", "A")
normalizedString = normalizedString.replace("É", "E").replace("Ë", "E").replace("È", "E")
normalizedString = normalizedString.replace("Í", "I").replace("Ï", "I").replace("Ì", "I")
normalizedString = normalizedString.replace("Ó", "O").replace("Ö", "O").replace("Ò", "O")
normalizedString = normalizedString.replace("Ú", "U").replace("Ü", "U").replace("Ù", "U")
return normalizedString
filterUsers = (text, user) -> filterUsers = (text, user) ->
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
username = normalizeString(username) username = normalizeString(username)
@ -474,15 +466,6 @@ AssignedUsersLightboxDirective = ($repo, lightboxService, lightboxKeyboardNaviga
selectedItem = null selectedItem = null
usersTemplate = $template.get("common/lightbox/lightbox-assigned-users-users.html", true) usersTemplate = $template.get("common/lightbox/lightbox-assigned-users-users.html", true)
normalizeString = (string) ->
normalizedString = string
normalizedString = normalizedString.replace("Á", "A").replace("Ä", "A").replace("À", "A")
normalizedString = normalizedString.replace("É", "E").replace("Ë", "E").replace("È", "E")
normalizedString = normalizedString.replace("Í", "I").replace("Ï", "I").replace("Ì", "I")
normalizedString = normalizedString.replace("Ó", "O").replace("Ö", "O").replace("Ò", "O")
normalizedString = normalizedString.replace("Ú", "U").replace("Ü", "U").replace("Ù", "U")
return normalizedString
filterUsers = (text, user) -> filterUsers = (text, user) ->
username = user.full_name_display.toUpperCase() username = user.full_name_display.toUpperCase()
username = normalizeString(username) username = normalizeString(username)

View File

@ -270,6 +270,15 @@ randomInt = (start, end) ->
interval = end - start interval = end - start
return start + Math.floor(Math.random()*(interval+1)) return start + Math.floor(Math.random()*(interval+1))
normalizeString = (string) ->
normalizedString = string
normalizedString = normalizedString.replace("Á", "A").replace("Ä", "A").replace("À", "A")
normalizedString = normalizedString.replace("É", "E").replace("Ë", "E").replace("È", "E")
normalizedString = normalizedString.replace("Í", "I").replace("Ï", "I").replace("Ì", "I")
normalizedString = normalizedString.replace("Ó", "O").replace("Ö", "O").replace("Ò", "O")
normalizedString = normalizedString.replace("Ú", "U").replace("Ü", "U").replace("Ù", "U")
return normalizedString
taiga = @.taiga taiga = @.taiga
taiga.addClass = addClass taiga.addClass = addClass
taiga.nl2br = nl2br taiga.nl2br = nl2br
@ -302,3 +311,4 @@ taiga.getRandomDefaultColor = getRandomDefaultColor
taiga.getDefaulColorList = getDefaulColorList taiga.getDefaulColorList = getDefaulColorList
taiga.getMatches = getMatches taiga.getMatches = getMatches
taiga.randomInt = randomInt taiga.randomInt = randomInt
taiga.normalizeString = normalizeString