From 770772a4e688a23233e507d297da07fd11d42d36 Mon Sep 17 00:00:00 2001 From: Chrysweel Date: Fri, 17 Apr 2015 11:51:51 +0200 Subject: [PATCH] include translations to page re-send email confirmation --- CHANGELOG-0.1.md | 5 ++++- Resources/public/js/resend-confirmation-email.js | 14 +++++++++++++- Resources/translations/UserRegistration.en.yml | 3 ++- Resources/translations/UserRegistration.es.yml | 5 +++-- Resources/views/User/confirmEmail.html.twig | 8 +++++++- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/CHANGELOG-0.1.md b/CHANGELOG-0.1.md index 2311328..6764d4b 100644 --- a/CHANGELOG-0.1.md +++ b/CHANGELOG-0.1.md @@ -52,4 +52,7 @@ To get the diff between two versions, go to https://github.com/antwebes/ChateaCl * 0.1.11 (2015-04-15) * Include repeat form email to register and settings users - * Include check that two inputs of email are same with jquery \ No newline at end of file + * Include check that two inputs of email are same with jquery + +* 0.1.12(2015-04-17) + * Include translations to page re-send email confirmation & disable button when success this action \ No newline at end of file diff --git a/Resources/public/js/resend-confirmation-email.js b/Resources/public/js/resend-confirmation-email.js index d9bdbd4..4a461b3 100644 --- a/Resources/public/js/resend-confirmation-email.js +++ b/Resources/public/js/resend-confirmation-email.js @@ -2,6 +2,16 @@ var api_endpoint = window.api_endpoint; $("#btn-resend-confirmation-email").on('click',function(event){ $("#div-resend-confirmation-email").removeClass('hide'); }); + +// if in template there are messages to translate, it translate otherwise show the error original +function transServerError(error){ + if(typeof messages != 'undefined' && typeof messages.server_errors[error] != 'undefined'){ + return messages.server_errors[error]; + } + return error; +} + + $("#form-resend-confirmation-email" ).submit(function( event ) { event.preventDefault(); var userEmail = $("#inputEmailResend").val(); @@ -10,10 +20,12 @@ $("#form-resend-confirmation-email" ).submit(function( event ) { type: 'get', dataType:'json', success: function (response) { - $("#succes-resend-confirmation-email").html('
'+response+'
'); + $("#succes-resend-confirmation-email").html('
'+messages.success+'
'); + $("[data-id=submit-confirm-email]").prop('disabled', true); }, error: function(error){ var apiError = JSON.parse(error.responseText); + apiError.errors = transServerError(apiError.errors); $("#succes-resend-confirmation-email").html('
'+apiError.errors+'
'); } }); diff --git a/Resources/translations/UserRegistration.en.yml b/Resources/translations/UserRegistration.en.yml index 90ed1bf..a9a5747 100644 --- a/Resources/translations/UserRegistration.en.yml +++ b/Resources/translations/UserRegistration.en.yml @@ -45,4 +45,5 @@ user.register.confirm.submit: "Submit" user.register.i_need_help: "I need help" user.register.confirmed.title: "Congratulations %username% !! Your account is activated successfully" user.register.confirmed.message: "User %username% registered correctly . You can now start chatting." -user.register.invalid_client: "Due to tecnichal problems, it is impsible to register users now. Please contacto with the webmaster of this site." \ No newline at end of file +user.register.invalid_client: "Due to tecnichal problems, it is impsible to register users now. Please contacto with the webmaster of this site." +user.confirm_email.not_owner_of_email: "This email is not associated with your User" \ No newline at end of file diff --git a/Resources/translations/UserRegistration.es.yml b/Resources/translations/UserRegistration.es.yml index 35e33a3..06023c0 100644 --- a/Resources/translations/UserRegistration.es.yml +++ b/Resources/translations/UserRegistration.es.yml @@ -38,11 +38,12 @@ user.register.click_to_confirm: "Haz click en el enlace enviado al correo para v user.register.if_you_dont_confirm: "Si no verificas tu cuenta, no tendrás acceso a ciertas características o productos." user.register.where_is_my_email: "¿Donde está mi correo de confirmación?" user.register.we_sent_you_verification_mail: "Te hemos enviado un enlace de verificación a tu correo" -user.register.mail_not_in_inbox: "Si no tienes un mensaje en to bandeja de entrada, rellena tu cuenta de correo, rellena tu cuenta de correo para reenviarte un correo de confirmación!" +user.register.mail_not_in_inbox: "Si no tienes un mensaje en la bandeja de entrada de tu correo, revisa la bandeja de spam por si acaso te ha llegado allí. Si no es así, rellena aquí tu cuenta de correo con el que te has registrado para reenviarte otro correo de confirmación!" user.register.your_mail: "Tu cuenta de correo" user.register.write_your_mail: "Escribe to cuenta de correo para enviarte un correo para verificar la cuenta." user.register.confirm.submit: "Enviar" user.register.i_need_help: "Necesito ayuda" user.register.confirmed.title: "Felicidadesa %username% !! Tu cuenta ha sido activada con éxiito" user.register.confirmed.message: "Usuario %username% registrado correctament. Puedes empezar a chatear ahora." -user.register.invalid_client: "Debido a problemas técnicos en este momento nos es imposible realizar registros. Por favor pongase en contacto con el administrador de la web." \ No newline at end of file +user.register.invalid_client: "Debido a problemas técnicos en este momento nos es imposible realizar registros. Por favor pongase en contacto con el administrador de la web." +user.confirm_email.not_owner_of_email: "El email introducido no está asociado a tu usuario" \ No newline at end of file diff --git a/Resources/views/User/confirmEmail.html.twig b/Resources/views/User/confirmEmail.html.twig index 2b54671..1c72c19 100644 --- a/Resources/views/User/confirmEmail.html.twig +++ b/Resources/views/User/confirmEmail.html.twig @@ -80,7 +80,7 @@ - + @@ -132,6 +132,12 @@ {% javascripts '@ChateaClientBundle/Resources/public/js/resend-confirmation-email.js'