[i18n] Attachments
parent
e1e89ad48f
commit
fdc6b83f64
|
@ -28,9 +28,9 @@ module = angular.module("taigaCommon")
|
|||
|
||||
|
||||
class AttachmentsController extends taiga.Controller
|
||||
@.$inject = ["$scope", "$rootScope", "$tgRepo", "$tgResources", "$tgConfirm", "$q"]
|
||||
@.$inject = ["$scope", "$rootScope", "$tgRepo", "$tgResources", "$tgConfirm", "$q", "$translate"]
|
||||
|
||||
constructor: (@scope, @rootscope, @repo, @rs, @confirm, @q) ->
|
||||
constructor: (@scope, @rootscope, @repo, @rs, @confirm, @q, @translate) ->
|
||||
bindMethods(@)
|
||||
@.type = null
|
||||
@.objectId = null
|
||||
|
@ -75,10 +75,13 @@ class AttachmentsController extends taiga.Controller
|
|||
|
||||
promise = promise.then null, (data) =>
|
||||
@scope.$emit("attachments:size-error") if data.status == 413
|
||||
|
||||
index = @.uploadingAttachments.indexOf(attachment)
|
||||
@.uploadingAttachments.splice(index, 1)
|
||||
@confirm.notify("error", "We have not been able to upload '#{attachment.name}'.
|
||||
#{data.data._error_message}")
|
||||
|
||||
message = @translate.instant("ATTACHMENT.ERROR_UPLOAD_ATTACHMENT", {
|
||||
fileName: attachment.name, errorMessage: data.data._error_message})
|
||||
@confirm.notify("error", message)
|
||||
return @q.reject(data)
|
||||
|
||||
return promise
|
||||
|
@ -130,8 +133,8 @@ class AttachmentsController extends taiga.Controller
|
|||
|
||||
# Remove one concrete attachment.
|
||||
removeAttachment: (attachment) ->
|
||||
title = "Delete attachment" #TODO: i18in
|
||||
message = "the attachment '#{attachment.name}'" #TODO: i18in
|
||||
title = @translate.instant("ATTACHMENT.TITLE_LIGHTBOX_DELETE_ATTACHMENT")
|
||||
message = @translate.instant("ATTACHMENT.MSG_LIGHTBOX_DELETE_ATTACHMENT", {fileName: attachment.name})
|
||||
|
||||
return @confirm.askOnDelete(title, message).then (finish) =>
|
||||
onSuccess = =>
|
||||
|
@ -143,7 +146,8 @@ class AttachmentsController extends taiga.Controller
|
|||
|
||||
onError = =>
|
||||
finish(false)
|
||||
@confirm.notify("error", null, "We have not been able to delete #{message}.")
|
||||
message = @translate.instant("ATTACHMENT.ERROR_DELETE_ATTACHMENT", {errorMessage: message})
|
||||
@confirm.notify("error", null, message)
|
||||
return @q.reject()
|
||||
|
||||
return @repo.remove(attachment).then(onSuccess, onError)
|
||||
|
@ -242,7 +246,7 @@ AttachmentsDirective = ($config, $confirm, $templates) ->
|
|||
module.directive("tgAttachments", ["$tgConfig", "$tgConfirm", "$tgTemplate", AttachmentsDirective])
|
||||
|
||||
|
||||
AttachmentDirective = ($template, $compile) ->
|
||||
AttachmentDirective = ($template, $compile, $translate) ->
|
||||
template = $template.get("attachment/attachment.html", true)
|
||||
templateEdit = $template.get("attachment/attachment-edit.html", true)
|
||||
|
||||
|
@ -254,14 +258,16 @@ AttachmentDirective = ($template, $compile) ->
|
|||
ctx = {
|
||||
id: attachment.id
|
||||
name: attachment.name
|
||||
created_date: moment(attachment.created_date).format("ATTACHMENT.DATE")
|
||||
title : $translate.instant("ATTACHMENT.TITLE", {
|
||||
fileName: attachment.name,
|
||||
date: moment(attachment.created_date).format($translate.instant("ATTACHMENT.DATE"))})
|
||||
url: attachment.url
|
||||
size: sizeFormat(attachment.size)
|
||||
description: attachment.description
|
||||
isDeprecated: attachment.is_deprecated
|
||||
modifyPermission: modifyPermission
|
||||
}
|
||||
|
||||
console.log ctx.title
|
||||
if edit
|
||||
html = $compile(templateEdit(ctx))($scope)
|
||||
else
|
||||
|
@ -322,4 +328,4 @@ AttachmentDirective = ($template, $compile) ->
|
|||
restrict: "AE"
|
||||
}
|
||||
|
||||
module.directive("tgAttachment", ["$tgTemplate", "$compile", AttachmentDirective])
|
||||
module.directive("tgAttachment", ["$tgTemplate", "$compile", "$translate", AttachmentDirective])
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
},
|
||||
"ATTACHMENT": {
|
||||
"SECTION_NAME": "attachments",
|
||||
"TITLE": "<%- name %> uploaded on <%- created_date %>",
|
||||
"TITLE": "{{ fileName }} uploaded on {{ date }}",
|
||||
"DESCIPTION": "Type a short description",
|
||||
"DEPRECATED_FILE": "Deprecated?",
|
||||
"ADD": "Add new attachment. <%- maxFileSizeMsg %>",
|
||||
|
@ -183,6 +183,10 @@
|
|||
"COUNT_DEPRECATED": "({{ctrl.deprecatedAttachmentsCount }} deprecated)",
|
||||
"MAX_UPLOAD_SIZE": "Maximum upload size is {{maxFileSize}}",
|
||||
"DATE": "DD MMM YYYY [at] hh:mm",
|
||||
"ERROR_UPLOAD_ATTACHMENT": "We have not been able to upload '{{fileName}}'. {{errorMessage}}",
|
||||
"TITLE_LIGHTBOX_DELETE_ATTACHMENT": "Delete attachment...",
|
||||
"MSG_LIGHTBOX_DELETE_ATTACHMENT": "the attachment '{{fileName}}'",
|
||||
"ERROR_DELETE_ATTACHMENT": "We have not been able to delete: {{errorMessage}}",
|
||||
"FIELDS": {
|
||||
"IS_DEPRECATED": "is deprecated"
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
},
|
||||
"ATTACHMENT": {
|
||||
"SECTION_NAME": "adjuntos",
|
||||
"TITLE": "<%- name %> Subido en <%- created_date %>",
|
||||
"TITLE": "{{ fileName }} subido el {{ date }}",
|
||||
"DESCIPTION": "Escribe una descripción corta",
|
||||
"DEPRECATED_FILE": "¿Desactualizado?",
|
||||
"ADD": "Agrega nuevos adjunto",
|
||||
|
@ -181,6 +181,10 @@
|
|||
"COUNT_DEPRECATED": "({{ctrl.deprecatedAttachmentsCount }} obsoleto)",
|
||||
"MAX_UPLOAD_SIZE": "El tamaño máximo de subida es de {{maxFileSize}}",
|
||||
"DATE": "DD MMM YYYY [a las] hh:mm\n",
|
||||
"ERROR_UPLOAD_ATTACHMENT": "No hemos podido subir el fichero '{{fileName}}'. {{errorMessage}}",
|
||||
"TITLE_LIGHTBOX_DELETE_ATTACHMENT": "Borrar adjunto...",
|
||||
"MSG_LIGHTBOX_DELETE_ATTACHMENT": "el adjunto '{{fileName}}'",
|
||||
"ERROR_DELETE_ATTACHMENT": "No hemos podido borrarlo: {{errorMessage}}",
|
||||
"FIELDS": {
|
||||
"IS_DEPRECATED": "Está desactualizado"
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
},
|
||||
"ATTACHMENT": {
|
||||
"SECTION_NAME": "liitteet",
|
||||
"TITLE": "<%- name %> ladattu <%- created_date %>",
|
||||
"TITLE": "{{ fileName }} ladattu {{ date }}\n",
|
||||
"DESCIPTION": "Kirjoita lyhyt kuvaus",
|
||||
"DEPRECATED_FILE": "Vanhentunut?",
|
||||
"ADD": "Lisää liite. <%- maxFileSizeMsg %>",
|
||||
|
@ -181,6 +181,10 @@
|
|||
"COUNT_DEPRECATED": "({{ctrl.deprecatedAttachmentsCount }} vanhentunutta)",
|
||||
"MAX_UPLOAD_SIZE": "Maksimi tiedoston koko {{maxFileSize}}",
|
||||
"DATE": "DD MMM YYYY - hh:mm",
|
||||
"ERROR_UPLOAD_ATTACHMENT": "We have not been able to upload '{{fileName}}'. {{errorMessage}}",
|
||||
"TITLE_LIGHTBOX_DELETE_ATTACHMENT": "Delete attachment...",
|
||||
"MSG_LIGHTBOX_DELETE_ATTACHMENT": "the attachment '{{fileName}}'",
|
||||
"ERROR_DELETE_ATTACHMENT": "We have not been able to delete: {{errorMessage}}",
|
||||
"FIELDS": {
|
||||
"IS_DEPRECATED": "on vanhentunut"
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@
|
|||
},
|
||||
"ATTACHMENT": {
|
||||
"SECTION_NAME": "pièces jointes",
|
||||
"TITLE": "<%- name %> transmis le <%- created_date %>",
|
||||
"TITLE": "{{ fileName }} transmis le {{ date }}\n",
|
||||
"DESCIPTION": "Entrez une courte description",
|
||||
"DEPRECATED_FILE": "Obsolète?",
|
||||
"ADD": "Ajouter une pièce jointe. <%- maxFileSizeMsg %>",
|
||||
|
@ -181,6 +181,10 @@
|
|||
"COUNT_DEPRECATED": "({{ctrl.deprecatedAttachmentsCount }} obsolète)",
|
||||
"MAX_UPLOAD_SIZE": "La taille maximum d'upload est {{maxFileSize}}",
|
||||
"DATE": "DD MMM YYYY [at] hh:mm",
|
||||
"ERROR_UPLOAD_ATTACHMENT": "We have not been able to upload '{{fileName}}'. {{errorMessage}}",
|
||||
"TITLE_LIGHTBOX_DELETE_ATTACHMENT": "Delete attachment...",
|
||||
"MSG_LIGHTBOX_DELETE_ATTACHMENT": "the attachment '{{fileName}}'",
|
||||
"ERROR_DELETE_ATTACHMENT": "We have not been able to delete: {{errorMessage}}",
|
||||
"FIELDS": {
|
||||
"IS_DEPRECATED": "est obsolète"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
.attachment-name
|
||||
span.icon.icon-document
|
||||
a(href!="<%- url %>", title!="{{ 'ATTACHMENT.TITLE' | translate}}", target="_blank")
|
||||
a(href!="<%- url %>", title!="<%- title %>", target="_blank")
|
||||
| <%- name %>
|
||||
.attachment-size
|
||||
span <%- size %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
.attachment-name
|
||||
a(href!="<%- url %>", title!="{{ 'ATTACHMENT.TITLE' | translate}}", target="_blank")
|
||||
a(href!="<%- url %>", title!="<%- title %>", target="_blank")
|
||||
span.icon.icon-documents
|
||||
span <%- name %>
|
||||
.attachment-size
|
||||
|
|
Loading…
Reference in New Issue