<commit_before>{% extends "elections/election_base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load markdown_deux_tags %}
{% block extrajs %}
$(document).ready(function(){
	$('[data-toggle="tooltip"]').tooltip();
	$('#btn-find-soulmate').on('click', function(){
		var csrftoken = $.cookie('csrftoken');
		var questions = $('#form-soulmate :input[name^="question"]');
		var importances = $('#form-soulmate :checked[name^="importance"]');
		var answers = $('#form-soulmate :checked[name^="answer"]');
		var final_data = {}
		var counter = 0;
		questions.each(function(index, element){
			var question_id = $(element).val()
			var answer = $('#form-soulmate :checked[name="answer-'+question_id+'"]').val();
			var importance = $('#form-soulmate :checked[name="importance-'+question_id+'"]').val();
			final_data["question-id-"+counter] = question_id
			if(answer!=undefined){
				final_data["question-"+counter] = answer	
			}
			final_data["importance-"+counter] = importance

			counter++
		})
		final_data["csrfmiddlewaretoken"] = csrftoken

		if( questions.length == answers.length ) {
			$('#btn-find-soulmate').prop('disabled',true);
			$('#btn-find-soulmate').html('<i class="icon-cogs"></i> {% trans "calculando" %}');

			$.post("{% url 'soul_mate_detail_view' slug=election.slug %}",final_data, function(final_data){
				$('#question-soulmate').remove();
				$('#election').append(final_data);
				$('html, body').animate({
					scrollTop: $("#election").offset().top
				})
			})
		} else {
			$('#msj-alerta').attr('style', 'display:block');
			$('html, body').animate({
				scrollTop: $("#election").offset().top
			})
		}
		
		return false;
	})
})
{% endblock extrajs %}

{% block title %} - {{election}} - {% trans "1/2 Naranja"%}{% endblock title%}

{% block last_breadcrumb %}{% trans "1/2 Naranja"%}{% endblock last_breadcrumb %}

{% block tab_soulmate %}class="active"{% endblock %}

{% block mainelection %}
<!-- soulmate -->
<div id="question-soulmate">
	<div id="msj-alerta" class="alert alert-warning" style="display:none">
		<strong>{% trans "Atención!" %}</strong> {% trans "Para brindar una mejor respuesta es necesario que respondas todas las preguntas."%}
	</div>
	<div id="msj-alerta" class="alert alert-info">
		Llena el cuestionario contestando cada respuesta para encontrar al candidato más afín a tus intereses.
	</div>
	<div class="row">
		<form id="form-soulmate" role="form">
		{% for category in election.categories.all %}
		<div class="panel panel-default">
			<div class="panel-heading">
				<span class="panel-title">{{category.name}}</span>
				

			</div>
			<div class="panel-body">
				{% for topic in category.topics.all %}
				<div class="row fondo-gris">
					<div class="col-md-8">
					<p class="question">{{topic.label}} 
					{% if topic.description %}
					<span class="fa-stack fa-md"  data-toggle="tooltip" title="{{ topic.description|markdown }}" data-html="true" data-placement="top">
					  <i class="fa fa-circle fa-stack-2x"></i>
					  <i class="fa fa-info fa-stack-1x fa-inverse"></i>
					</span>
					{% endif %}
					</p>

					
						<ul class="list-unstyled">
							{% for position in topic.positions.all %}
							<li>
								<label for="answer-{{topic.id}}-{{position.id}}"><input name="answer-{{topic.id}}" value="{{position.id}}" id="answer-{{topic.id}}-{{position.id}}" type="radio"> {{position.label}}</label>
							</li>
							{% endfor %}
							<li>
								<label for="answer-{{topic.id}}-{{position.id}}"><input checked="checked" name="answer-{{topic.id}}" value="0" id="answer-{{topic.id}}-{{position.id}}" type="radio"> Ninguna de las anteriores</label>
							</li>
						</ul>
					</div>
				</div>
				<input type="hidden" name="question-{{topic.id}}" value="{{topic.id}}">
				{% endfor %}
			</div>
		</div>
		{% endfor %}

		<div>
			<button type="submit" id="btn-find-soulmate" class="btn btn-success" onClick="ga('send', 'event', 'find-soulmate', 'click');"><i class="icon-heart"></i> {% trans "Encontrar mi 1/2 naranja" %}</button>
		</div>
		{% csrf_token %}
		</form>
	</div>
</div>

<!-- EOF soulmate -->
{% endblock mainelection  %}

{% block extrafooter %}
  <div class="extra-footer">
        <div class="container">
          <div class="row">
              <div class="col-md-4">
                <a href="{% url 'election_view' slug=election.slug %}"><img src="{% static 'img/perfiles.jpg' %}"></a>
              </div>
              <div class="col-md-4">
                <a href="{% url 'questionary_detail_view' slug=election.slug %}"><img src="{% static 'img/cuestionario.jpg' %}"></a>
              </div>
              <div class="col-md-4">
                <a href="{% url 'face_to_face_two_candidates_detail_view' slug=election.slug slug_candidate_one='jimmy-morales' slug_candidate_two='sandra-torres-casanova' %}"><img src="{% static 'img/frente_a_frente.jpg' %}"></a>
              </div>
          </div>
      </div>
  </div>
{% endblock extrafooter %}<commit_msg>Cambio "Encontrar mi 1/2 Naranja" por "Encontrar candidato mas afín"<commit_after>{% extends "elections/election_base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load markdown_deux_tags %}
{% block extrajs %}
$(document).ready(function(){
	$('[data-toggle="tooltip"]').tooltip();
	$('#btn-find-soulmate').on('click', function(){
		var csrftoken = $.cookie('csrftoken');
		var questions = $('#form-soulmate :input[name^="question"]');
		var importances = $('#form-soulmate :checked[name^="importance"]');
		var answers = $('#form-soulmate :checked[name^="answer"]');
		var final_data = {}
		var counter = 0;
		questions.each(function(index, element){
			var question_id = $(element).val()
			var answer = $('#form-soulmate :checked[name="answer-'+question_id+'"]').val();
			var importance = $('#form-soulmate :checked[name="importance-'+question_id+'"]').val();
			final_data["question-id-"+counter] = question_id
			if(answer!=undefined){
				final_data["question-"+counter] = answer	
			}
			final_data["importance-"+counter] = importance

			counter++
		})
		final_data["csrfmiddlewaretoken"] = csrftoken

		if( questions.length == answers.length ) {
			$('#btn-find-soulmate').prop('disabled',true);
			$('#btn-find-soulmate').html('<i class="icon-cogs"></i> {% trans "calculando" %}');

			$.post("{% url 'soul_mate_detail_view' slug=election.slug %}",final_data, function(final_data){
				$('#question-soulmate').remove();
				$('#election').append(final_data);
				$('html, body').animate({
					scrollTop: $("#election").offset().top
				})
			})
		} else {
			$('#msj-alerta').attr('style', 'display:block');
			$('html, body').animate({
				scrollTop: $("#election").offset().top
			})
		}
		
		return false;
	})
})
{% endblock extrajs %}

{% block title %} - {{election}} - {% trans "1/2 Naranja"%}{% endblock title%}

{% block last_breadcrumb %}{% trans "1/2 Naranja"%}{% endblock last_breadcrumb %}

{% block tab_soulmate %}class="active"{% endblock %}

{% block mainelection %}
<!-- soulmate -->
<div id="question-soulmate">
	<div id="msj-alerta" class="alert alert-warning" style="display:none">
		<strong>{% trans "Atención!" %}</strong> {% trans "Para brindar una mejor respuesta es necesario que respondas todas las preguntas."%}
	</div>
	<div id="msj-alerta" class="alert alert-info">
		Llena el cuestionario contestando cada respuesta para encontrar al candidato más afín a tus intereses. Para brindar una mejor respuesta es necesario que respondas todas las preguntas.
	</div>
	<div class="row">
		<form id="form-soulmate" role="form">
		{% for category in election.categories.all %}
		<div class="panel panel-default">
			<div class="panel-heading">
				<span class="panel-title">{{category.name}}</span>
				

			</div>
			<div class="panel-body">
				{% for topic in category.topics.all %}
				<div class="row fondo-gris">
					<div class="col-md-8">
					<p class="question">{{topic.label}} 
					{% if topic.description %}
					<span class="fa-stack fa-md"  data-toggle="tooltip" title="{{ topic.description|markdown }}" data-html="true" data-placement="top">
					  <i class="fa fa-circle fa-stack-2x"></i>
					  <i class="fa fa-info fa-stack-1x fa-inverse"></i>
					</span>
					{% endif %}
					</p>

					
						<ul class="list-unstyled">
							{% for position in topic.positions.all %}
							<li>
								<label for="answer-{{topic.id}}-{{position.id}}"><input name="answer-{{topic.id}}" value="{{position.id}}" id="answer-{{topic.id}}-{{position.id}}" type="radio"> {{position.label}}</label>
							</li>
							{% endfor %}
							<li>
								<label for="answer-{{topic.id}}-{{position.id}}"><input checked="checked" name="answer-{{topic.id}}" value="0" id="answer-{{topic.id}}-{{position.id}}" type="radio"> Ninguna de las anteriores</label>
							</li>
						</ul>
					</div>
				</div>
				<input type="hidden" name="question-{{topic.id}}" value="{{topic.id}}">
				{% endfor %}
			</div>
		</div>
		{% endfor %}

		<div>
			<button type="submit" id="btn-find-soulmate" class="btn btn-success" onClick="ga('send', 'event', 'find-soulmate', 'click');"><i class="icon-heart"></i> {% trans "Encontrar CandiDato más afín" %}</button>
		</div>
		{% csrf_token %}
		</form>
	</div>
</div>

<!-- EOF soulmate -->
{% endblock mainelection  %}

{% block extrafooter %}
  <div class="extra-footer">
        <div class="container">
          <div class="row">
              <div class="col-md-4">
                <a href="{% url 'election_view' slug=election.slug %}"><img src="{% static 'img/perfiles.jpg' %}"></a>
              </div>
              <div class="col-md-4">
                <a href="{% url 'questionary_detail_view' slug=election.slug %}"><img src="{% static 'img/cuestionario.jpg' %}"></a>
              </div>
              <div class="col-md-4">
                <a href="{% url 'face_to_face_two_candidates_detail_view' slug=election.slug slug_candidate_one='jimmy-morales' slug_candidate_two='sandra-torres-casanova' %}"><img src="{% static 'img/frente_a_frente.jpg' %}"></a>
              </div>
          </div>
      </div>
  </div>
{% endblock extrafooter %}

{'fraction_non_alphanumeric': 0.2140524492825334, 'fraction_numerical': 0.0031667491340920334, 'mean_word_length': 3.6104014598540144, 'pattern_counts': {'":': 0, '<': 155, '<?xml version=': 0, '>': 155, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3311415', 'n_tokens_mistral': 4004, 'n_tokens_neox': 3394, 'n_words': 677}