<commit_before>- if questionnaires.empty?
  .alert.alert-info
    %p Aún no hay ningun cuestionario
- else
  %table.questionnaires.table.table-striped
    %thead
      %tr
        %th Nombre
        %th Estado
        %th Preguntas
        - if policy(PeerReview::Challenge).monitor?
          %th
            %i.fa.fa-eye{title: "Publicado"}
        %th.no-sort
    %tbody
      - questionnaires.each do |questionnaire|
        %tr.fork
          %td
            = questionnaire.name
          %td
            = questionnaire.enabled? ? "Vigente" : "Finalizado"
          %td
            = questionnaire.questions.visible.count
            visibles
            - if policy(MultipleChoices::Questionnaire).manage?
              %br/
              = questionnaire.questions.hidden.count
              ocultas
          - if policy(MultipleChoices::Questionnaire).monitor?
            %td
              = yes_no questionnaire.published?
          %td
            - if questionnaire.enabled?
              = link_to "Practicar", practice_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-primary btn-sm'
            - if questionnaire.solved_by? current_user
              = link_to "Revisar", last_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-secondary btn-sm'
            - if policy(MultipleChoices::Questionnaire).monitor?
              .btn-group
                = link_to "Panorama", overview_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-primary btn-sm', role: "button"
                - if policy(MultipleChoices::Questionnaire).manage?
                  = link_to "Editar", edit_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-outline-primary btn-sm', role: "button"
                  %button.btn.btn-outline-primary.dropdown-toggle.btn-sm{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button"}
                    %span.caret
                  .dropdown-menu.dropdown-menu-end
                    = link_to questionnaire.enabled? ? "Finalizar" : "Reabrir", toggle_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post
                    - if questionnaire.published?
                      = link_to unpublish_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post do
                        Despublicar
                    - else
                      = link_to publish_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post do
                        Publicar
                    = link_to "Exportar", export_multiple_choices_questionnaire_path(questionnaire, format: :json), class: "dropdown-item", method: :get

= content_for :head do
  %link{href: "https://cdn.datatables.net/v/bs4/dt-1.10.21/datatables.min.css", rel: "stylesheet", type: "text/css"}/
= content_for :javascript do
  %script{src: "https://cdn.datatables.net/v/bs4/dt-1.10.21/datatables.min.js", type: "text/javascript"}
  :javascript
    var init = false;
    $(function () {
      if (!init) {
        $('.questionnaires').DataTable({
            order: [[0, "asc"]],
            paging: false,
            language: {
                url: "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json"
            },
            columnDefs: [{
                targets: 'no-sort',
                orderable: false
            }]
        });
        init = true;
      }
    });<commit_msg>Ability to delete Questionnaires<commit_after>- if questionnaires.empty?
  .alert.alert-info
    %p Aún no hay ningun cuestionario
- else
  %table.questionnaires.table.table-striped
    %thead
      %tr
        %th Nombre
        %th Estado
        %th Preguntas
        - if policy(PeerReview::Challenge).monitor?
          %th
            %i.fa.fa-eye{title: "Publicado"}
        %th.no-sort
    %tbody
      - questionnaires.each do |questionnaire|
        %tr.fork
          %td
            = questionnaire.name
          %td
            = questionnaire.enabled? ? "Vigente" : "Finalizado"
          %td
            = questionnaire.questions.visible.count
            visibles
            - if policy(MultipleChoices::Questionnaire).manage?
              %br/
              = questionnaire.questions.hidden.count
              ocultas
          - if policy(MultipleChoices::Questionnaire).monitor?
            %td
              = yes_no questionnaire.published?
          %td
            - if questionnaire.enabled?
              = link_to "Practicar", practice_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-primary btn-sm'
            - if questionnaire.solved_by? current_user
              = link_to "Revisar", last_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-secondary btn-sm'
            - if policy(MultipleChoices::Questionnaire).monitor?
              .btn-group
                = link_to "Panorama", overview_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-primary btn-sm', role: "button"
                - if policy(MultipleChoices::Questionnaire).manage?
                  = link_to "Editar", edit_multiple_choices_questionnaire_path(questionnaire), class: 'btn btn-outline-primary btn-sm', role: "button"
                  %button.btn.btn-outline-primary.dropdown-toggle.btn-sm{"aria-expanded" => "false", "aria-haspopup" => "true", "data-bs-toggle" => "dropdown", type: "button"}
                    %span.caret
                  .dropdown-menu.dropdown-menu-end
                    = link_to questionnaire.enabled? ? "Finalizar" : "Reabrir", toggle_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post
                    - if questionnaire.published?
                      = link_to unpublish_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post do
                        Despublicar
                    - else
                      = link_to publish_multiple_choices_questionnaire_path(questionnaire), class: "dropdown-item", method: :post do
                        Publicar
                    = link_to "Exportar", export_multiple_choices_questionnaire_path(questionnaire, format: :json), class: "dropdown-item", method: :get
                    = link_to "Eliminar", multiple_choices_questionnaire_path(questionnaire), class: 'dropdown-item text-danger', method: :delete

= content_for :head do
  %link{href: "https://cdn.datatables.net/v/bs4/dt-1.10.21/datatables.min.css", rel: "stylesheet", type: "text/css"}/
= content_for :javascript do
  %script{src: "https://cdn.datatables.net/v/bs4/dt-1.10.21/datatables.min.js", type: "text/javascript"}
  :javascript
    var init = false;
    $(function () {
      if (!init) {
        $('.questionnaires').DataTable({
            order: [[0, "asc"]],
            paging: false,
            language: {
                url: "https://cdn.datatables.net/plug-ins/1.10.19/i18n/Spanish.json"
            },
            columnDefs: [{
                targets: 'no-sort',
                orderable: false
            }]
        });
        init = true;
      }
    });
{'fraction_non_alphanumeric': 0.1163438762714226, 'fraction_numerical': 0.005573359342343598, 'mean_word_length': 2.066211020931226, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 6, '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': '2273139', 'n_tokens_mistral': 2123, 'n_tokens_neox': 2010, 'n_words': 369}