GuillermoParedes
2/14/2018 - 8:16 PM

preguntas

preguntas

= form_tag guardar_seleccion_preguntas_path(:tematica => @tematica) do
  .sticky-top.bg-white.border-bottom.text-dark 
    %br/
    %table{:class => "table"}
      %h3 Preguntas seleccionadas: #{@cantidad_seleccionados}
      %tr
        %td{class: "col-lg-2"}
          - if !@tematica.anterior.nil?
            = link_to '<i class="fas fa-arrow-circle-left"></i> Anterior'.html_safe,seleccion_preguntas_preguntas_path(:tematica_id => @tematica.anterior), {class: "btn btn-success float-right mb-auto redondeo-20"}
        %td{class: "col-lg-2"}
          - if !@tematica.siguiente.nil?
            = link_to '<i class="fas fa-arrow-circle-right"></i> Siguiente'.html_safe,seleccion_preguntas_preguntas_path(:tematica_id => @tematica.siguiente), {class: "btn btn-success float-left mb-auto redondeo-20"}
    .actions
      %button.btn.btn-success.float-right.redondeo-20{:type => "submit"}
        %i.fas.fa-save
        Guardar
    %h4 Temática: #{@tematica.descripcion}
    %br/
 
    -# = submit_tag 'Guardar', class: 'btn btn-success float-right redondeo-20'
  %table{:class => "table"}
    %thead
      %tr.sticky-top
        %th Número
        %th Pregunta
        %th Opciones de Respuesta
        %th Seleccionar
    %tbody
      - @tematica.preguntas.each_with_index do |pregunta, index|
        %tr{:id => "pregunta_#{pregunta.id}" }
          %td= index + 1
          %td#pregunta= pregunta.descripcion
          %td
            - pregunta.opciones.each do |opcion|
              %li= opcion.descripcion
          %td
            - if pregunta.seleccionado == true
              = check_box_tag "seleccion[]", pregunta.id, true 
            - else
              = check_box_tag "seleccion[]", pregunta.id


-# :javascript

-#     $('#pregunta').on('click', function () {
-#       alertify
-#       .alert("This is an alert dialog.", function(){
-#         alertify.message('OK');
-#       });
-#     })


-#     seleccionado = function (PreguntaId) {
-#       console.log("Seleccionado", PreguntaId); 
-#     }