Skip to content
Browse files

mensajes y opciones ya corregidas

  • Loading branch information...
1 parent 7220c38 commit b7c474d41d2ce3e9637b07163661bb5d2cc41ead Yonsy Solis committed Sep 11, 2011
View
2 apps/main/urls.py
@@ -7,6 +7,8 @@
url('^$', 'main_homepage', name='main_homepage'),
url('validate_form1$', 'validate_form1', name='validate_form1'),
url('validate_form2$', 'validate_form2', name='validate_form2'),
+ url('validate_generic$', 'validate_generic', name='validate_generic'),
url('validate_form_captcha$', 'validate_form_captcha', name='validate_form_captcha'),
+ url('get_profile_name$', 'get_profile_name', name='get_profile_name'),
url('captcha$', 'captcha', name='captcha'),
)
View
48 apps/main/views.py
@@ -138,9 +138,57 @@ def validate_form_captcha(request):
return HttpResponse('success')
else:
raise Exception
+
except Exception, e:
return HttpResponse('error')
+def validate_generic(request):
+ code = request.GET.get('code')
+ generic = code[0:2]
+ generic_codes = {
+ 'MC': 1,
+ 'ME': 2,
+ 'LP': 2,
+ 'MF': 2,
+ 'MR': 1,
+ 'TR': 1,
+ 'UE': 2,
+ 'MJ': 1,
+ 'MK': 1,
+ 'ZE': 2,
+ 'UF': 2,
+ 'SL': 1,
+ 'RN': 2,
+ 'PA': 1,
+ 'PC': 1,
+ 'NW': 1,
+ 'PT': 1,
+ 'PZ': 1,
+ 'PK': 1,
+ 'YY': 1,
+ 'RA': 1,
+ 'PN': 1,
+ 'C4': 1,
+ 'C3': 1,
+ 'PM': 1,
+ 'YZ': 1,
+ 'MZ': 1,
+ 'NE': 1,
+ 'MW': 1,
+ 'MY': 1,
+ }
+ if generic in generic_codes:
+ return HttpResponse(generic_codes[generic])
+ else:
+ return HttpResponse('notvalid')
+
+
+def get_profile_name(request):
+ profile = Profile.objects.get(pk=request.session['profile_id'])
+ profile_name = profile.first_name + ' ' + profile.first_surname
+ return HttpResponse(profile_name)
+
+
def facebook_send(request):
return HttpResponse('pass')
View
12 static/js/registro.js
@@ -88,6 +88,18 @@ function validate_form_captcha() {
clave = new clavePersonal(codigo); //<-- clave nueva
clave.validar();
if(clave.esValida()) {
+ $('.profile_name').load('/get_profile_name');
+ $.get('/validate_generic', {'code': clave.getGenerico()}, function(data) {
+ if(data==='notvalid') {
+ transicion('.form-captcha', '.form-clave-no-valida');
+ } else {
+ if(data==='1') {
+ $('.profile_options').html('1 opción');
+ } else {
+ $('.profile_options').html('2 opciones');
+ }
+ };
+ });
random = $('#random').val();
password = $('#password').val();
$.get(
View
6 templates/main/_form_clave_correcta.html
@@ -1,7 +1,7 @@
<div class="form-clave-correcta" style="display:none;">
- <p class="title"><span>Suerte,</span> Catherin Rivera</p>
+ <p class="title"><span>Suerte, </span><span class="profile_name"></span></p>
<p class="message">Tu clave ha sido procesada satisfactoriamente.</p>
- <p class="message"><span>Tienes</span> 2 opciones <span>para el sorteo del iPod de hoy</span></p>
- <p class="message"><span>Tienes</span> 2 opciones <span>para el sorteo final de 1 Grand Vitara</span></p>
+ <p class="message"><span>Tienes</span> <span class='profile_options'></span> <span>para el sorteo de los iPods de esta semana</span></p>
+ <p class="message"><span>Tienes</span> <span class='profile_options'></span> <span>para el sorteo final de 1 Grand Vitara</span></p>
<p class="message"><a href="javascript:void(0)" class="btn-ingresa-otra-clave" onclick="transicion('.form-clave-correcta', '.form-captcha')"></a></p>
</div>
View
2 templates/main/_form_clave_no_valida.html
@@ -1,5 +1,5 @@
<div class="form-clave-no-valida" style="display:none;">
- <p class="title"><span>Lo sentimos</span> Catherin Rivera</p>
+ <p class="title"><span>Lo sentimos</span> <span class="profile_name"></span></p>
<p class="message">La clave ingresada no es válida.</p>
<p class="message"><span>Revisa si las has ingresado correctamente o <br />si el producto participa de la promoción</span></p>
<p class="message"><a href="javascript:void(0)" class="btn-intentar-nuevamente-aqui" onclick="transicion('.form-clave-no-valida', '.form-captcha')"></a></p>
View
2 templates/main/_form_clave_ya_registrada.html
@@ -1,5 +1,5 @@
<div class="form-clave-ya-registrada" style="display:none;">
- <p class="title"><span>Lo sentimos</span> Catherin Rivera</p>
+ <p class="title"><span>Lo sentimos </span><span class="profile_name"></span></p>
<p class="message">Esta clave ya ha sido ingresada.</p>
<p class="message"><span>Con anterioridad o en promociones anteriores.</span></p>
<p>&nbsp;</p>

0 comments on commit b7c474d

Please sign in to comment.
Something went wrong with that request. Please try again.