Conjunto 1731833 en consulta_publica
- Fecha y hora:
- 21/03/2017 11:33:08 (hace 7 años)
- Branches:
- master, base, constituyente, estudiantes, general, plan_patria, sala
- Children:
- 95b08c1, bae8490
- Parents:
- a1ac8b8
- Ficheros:
-
- 4 editados
Leyenda
- No modificado
- Añadido
- Eliminado
-
participacion/templates/participacion.create.html
rcdd72e5 r1731833 7 7 <div class="row text-center"> 8 8 <h1>Consulta</h1><hr> 9 <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false" style="height:350px;"> 9 <div class="row"> 10 <div class="progress non-null" role="progressbar" id="status" > 11 <div class="progress-bar progress-bar active" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"> 12 <div class="bar" style="width:100%"><span style="color:black;">Progreso</span></div> 13 </div> 14 </div> 15 </div> 16 <div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="false"> 10 17 <!-- Indicators --> 11 18 <ol class="carousel-indicators"> 12 19 {% for key, value in preguntas.items %} 13 <li data-target="#myCarousel" data-slide-to="{{ forloop.counter0 }}"class="{% if forloop.counter0 == 0 %}active{%endif%}"></li>20 <li data-target="#myCarousel" class="{% if forloop.counter0 == 0 %}active{%endif%}"></li> 14 21 {% endfor %} 22 <li data-target="#myCarousel"></li> 15 23 </ol> 16 24 … … 29 37 </div> 30 38 {% endfor %} 39 <div class="col-md-6 col-sm-6 col-xs-6 col-xs-offset-3 col-md-offset-3 col-sm-offset-3 item"> 40 <div class="row"> 41 <button type="submit" onclick="validate_poll(event);" class="btn btn-success"> 42 Registrar Participación 43 </button> 44 </div> 45 </div> 31 46 </div> 32 47 33 48 34 49 <!-- Left and right controls --> 35 <a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">50 <a class="left carousel-control" href="#myCarousel" role="button" onclick="go_back();"> 36 51 <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> 37 52 <span class="sr-only">Anterior</span> 38 53 </a> 39 <a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">54 <a class="right carousel-control" href="#myCarousel" role="button" onclick="control_progress();"> 40 55 <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> 41 56 <span class="sr-only">Siguiente</span> … … 44 59 <div class="col-md-12 col-sm-12 col-xs-12"> 45 60 <a type="button" class="btn btn-info pull-left" href="{% url 'participacion_index' %}">Regresar</a> 46 <button type="submit" class="btn btn-success pull-right">Participar</button>47 61 </div> 48 62 </div> -
participacion/views.py
ra1ac8b8 r1731833 102 102 campo = '' 103 103 for opcion in Opcion.objects.filter(pregunta_id=pregunta.id).all(): 104 campo += '<label for="'+kwargs['pk']+'">'+opcion.texto_opcion+'</label><input type="radio" name="consulta_respuesta_radio_'+ str(opcion.id)+'" id="'+kwargs['pk']+'"value="'+str(opcion.id)+'" class="icheck">'104 campo += '<label for="'+kwargs['pk']+'">'+opcion.texto_opcion+'</label><input type="radio" name="consulta_respuesta_radio_'+kwargs['pk']+'" id="'+kwargs['pk']+'"value="'+str(opcion.id)+'" class="icheck">' 105 105 elif pregunta.tipo_pregunta.id == 2: 106 106 campo = '' -
static/css/style.css
r99ac420 r1731833 96 96 .carousel-control .glyphicon-chevron-left, 97 97 .carousel-control .icon-prev { 98 left: 0;98 left: 10px; 99 99 } 100 100 101 101 .carousel-control .glyphicon-chevron-right, 102 102 .carousel-control .icon-next { 103 right: 0;103 right: 10px; 104 104 } 105 105 … … 108 108 background-color: #000; 109 109 }*/ 110 111 .carousel-indicators .active { 112 background-color: gray; 113 } 114 115 .carousel-indicators li { 116 border: 1px solid gray; 117 } 110 118 111 119 .carousel-control.left span:hover, … … 157 165 width:100%; 158 166 position:absolute; 159 bottom: ;160 left: ;167 bottom:0; 168 left:0; 161 169 } 170 171 #myCarousel{ 172 height:350px; 173 background-color: white; 174 color: gray; 175 padding: 10px 10px 10px 10px; 176 border: solid 5px #deddde; 177 } -
static/js/funciones.js
r99ac420 r1731833 489 489 }); 490 490 } 491 492 /** 493 * Función para validar la encuesta 494 * @param event Recibe el evento 495 **/ 496 function validate_poll(event) { 497 event.preventDefault(); 498 } 499 500 /** 501 * Función para retroceder en el carrusel y bajar el valor de la 502 * barra de progreso 503 **/ 504 function go_back() { 505 var first_element = $('.carousel-indicators li')[0]; 506 if($(first_element).attr('class')!=='active') 507 { 508 $('#myCarousel').carousel('prev'); 509 var elements = $('.carousel-indicators li').length-1; 510 var current_value = ($('#status .progress-bar').width()/$('#status').width())*100; 511 var final_value = current_value-(100/elements); 512 $('#status .progress-bar').width(final_value+"%"); 513 if (final_value!=100) { 514 $('#status .bar span').text() == "Finalizado" ? $('#status .bar span').text('Progreso'):''; 515 $('#status .progress-bar').removeClass('progress-bar-success'); 516 } 517 if (final_value==0) { 518 $('#status .bar span').css({'color':'black'}); 519 } 520 } 521 } 522 523 /** 524 * Función para aumentar la barra de progreso si se responde la encuesta 525 **/ 526 function control_progress() { 527 var content = $('.carousel-inner .active'); 528 var not_empty = 0; 529 var elements = $('.carousel-indicators li').length-1; 530 $.each(content.find('input'),function(index,value){ 531 var name = $(value).attr('name'); 532 if(name.search('radio')!=-1 || name.search('check')!=-1 || name.search('sino')!=-1) 533 { 534 not_empty = $(value).parent().attr('class').search('checked') !== -1 ? 1:not_empty; 535 } 536 }); 537 $.each(content.find('textarea'),function(index,value){ 538 var name = $(value).attr('name'); 539 if (name.search('abierta')!==-1) { 540 not_empty = $(value).val().trim() !== '' ? 1:not_empty; 541 } 542 }); 543 if (not_empty) { 544 $('#status .bar span').css({'color':'white'}); 545 $('#myCarousel').carousel('next'); 546 var current_value = ($('#status .progress-bar').width()/$('#status').width())*100; 547 var final_value = current_value+(100/elements); 548 $('#status .progress-bar').width(final_value+"%"); 549 550 if (final_value==100) { 551 $('#status .bar span').text("Finalizado"); 552 $('#status .progress-bar').addClass('progress-bar-success'); 553 } 554 } 555 }
Nota: Vea TracChangeset
para ayuda en el uso del visor de conjuntos de cambios.