<commit_before><div class="container">
  <ol class="breadcrumb">
    <li > <%= link_to t(:groups).humanize, groups_path %> </li>
    <li class="active"> <%= t(:list).humanize %></li>
  </ol>

  <div class="row">
    <div class="col-lg-12">
      <div class="panel panel-default">
        <div class="panel-heading clearfix">
          <h4><%= t(:groups).humanize %></h4>
          <div class="pull-right">
            <% if can? :new, Group %>
              <%= link_to t(:new_group).humanize, new_group_path, class: "pull-right btn btn-primary btn-sm" %>
            <% end %>
          </div>
        </div>
        <div class="panel-body">
          <table id="datatable" class="table table-bordered responsive no-wrap">
            <thead>
              <tr>
                <th><%= t(:id) %>
                <th><%= t(:name).humanize %></th>
                <th><%= t(:type).titleize %></th>
                <th><%= t(:members).humanize %></th>
                <th><%= t(:meetings).humanize %></th>
                <th width="90px">Acciones</th>
              </tr>
            </thead>

            <tbody>
              <% @groups.each do |group| %>
                <tr>
                  <td><%= group.id %></td>
                  <td><%= group.name %></td>
                  <td><%= t(group.type.downcase.to_sym).titleize %></td>
                  <td class="text-center"><%= group.members.count %></td>
                  <td class="text-center"><%= group.meetings.count %></td>
                  <td>

                    <%= link_to group_path(group), class: "btn btn-default btn-sm" do %> <span class="glyphicon glyphicon-zoom-in"></span> <% end %>
                    <% if can?(:edit, group) %>
                      <%= link_to edit_group_path(group), class: "btn btn-default btn-sm" do %> <span class="glyphicon glyphicon-edit"></span> <% end %>
                      <%= link_to group_path(group.id), method: :delete, class: "btn btn-default btn-sm", data: { confirm: t(:are_you_sure).humanize }, title: t(:destroy_group).humanize do %> <span class="glyphicon glyphicon-trash"></span> <% end %>
                    <% end %>
                  </td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="modal fade" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><span class="glyphicon glyphicon-warning-sign"></span> Lista de Correos</h4>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<script>
  $(function() {
    var dt = $('#datatable').DataTable({
      "autoWidth": true,
      "responsive": true,
      "sDom": '<"pull-left"T>frt<"widget-foot" <"info_table pull-left"i><"pagination pull-right"p><"clearfix">>',
      "tableTools": {
        "sSwfPath": "swf/copy_csv_xls.swf",
        "aButtons": [{
          "sExtends": "csv",
          "sButtonText": "Exportar Todo CSV",
        },{
          "sExtends": "ajax",
          "mColumns": [0],
          "bHeader": false,
          "sNewLine": ",",
          "sButtonText": "Ver lista de correos (grupos seleccionados)",
          "oSelectorOpts": { filter: 'applied', order: 'current' },
          "sAjaxUrl": "/mails_user_groups.json",
          "fnClick": function( nButton, oConfig) {
            var sData = this.fnGetTableData(oConfig);
            $.when(
              $.ajax({
              "url": oConfig.sAjaxUrl,
              "data": [ { "name": "data", "value": sData }],
              "dataType": "json",
              "type": "GET",
              "cache": false
            })).then(function(data) {
              var modal = $('#myModal');
              modal.find(".modal-body").text(data)
              modal.modal('show');
            });
          }
        }
        ]},
        "oLanguage": {
          "sSearch": "Filtrar: ",
          "sZeroRecords": "No se encontraron espacios",
          "sInfo": "Mostrando _START_ a _END_ espacios de un total de _TOTAL_ ",
          "sInfoEmpty": "Mostrando 0 a 0 espacios de un total de 0",
          "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
          "oPaginate": {
            "sNext": "Siguiente <span class='glyphicon glyphicon-chevron-right'></span>",
            "sPrevious": "<span class='glyphicon glyphicon-chevron-left'></span> Anterior",
          }
        }<commit_msg>Added checkbox to groups table in order to choose which groups will be chosen at the moment to 'export' or view the emails from the users<commit_after><div class="container">
  <ol class="breadcrumb">
    <li > <%= link_to t(:groups).humanize, groups_path %> </li>
    <li class="active"> <%= t(:list).humanize %></li>
  </ol>

  <div class="row">
    <div class="col-lg-12">
      <div class="panel panel-default">
        <div class="panel-heading clearfix">
          <h4><%= t(:groups).humanize %></h4>
          <div class="pull-right">
            <% if can? :new, Group %>
              <%= link_to t(:new_group).humanize, new_group_path, class: "pull-right btn btn-primary btn-sm" %>
            <% end %>
          </div>
        </div>
        <div class="panel-body">
          <table id="datatable" class="table table-bordered responsive no-wrap">
            <thead>
              <tr>
                <th width="10px"></th>
                <th><%= t(:name).humanize %></th>
                <th><%= t(:type).titleize %></th>
                <th><%= t(:members).humanize %></th>
                <th><%= t(:meetings).humanize %></th>
                <th width="90px">Acciones</th>
              </tr>
            </thead>

            <tbody>
              <% @groups.each do |group| %>
                <tr>
                  <td>
                    <input type="checkbox" name="selected" class="check" value="<%= group.id %>">
                  </td>
                  <td><%= group.name %></td>
                  <td><%= t(group.type.downcase.to_sym).titleize %></td>
                  <td class="text-center"><%= group.members.count  %></td>
                  <td class="text-center"><%= group.meetings.count %></td>
                  <td>

                    <%= link_to group_path(group), class: "btn btn-default btn-sm" do %> <span class="glyphicon glyphicon-zoom-in"></span> <% end %>
                    <% if can?(:edit, group) %>
                      <%= link_to edit_group_path(group), class: "btn btn-default btn-sm" do %> <span class="glyphicon glyphicon-edit"></span> <% end %>
                      <%= link_to group_path(group.id), method: :delete, class: "btn btn-default btn-sm", data: { confirm: t(:are_you_sure).humanize }, title: t(:destroy_group).humanize do %> <span class="glyphicon glyphicon-trash"></span> <% end %>
                    <% end %>
                  </td>
                </tr>
              <% end %>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
</div>


<div class="modal fade" id="myModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title"><span class="glyphicon glyphicon-warning-sign"></span> Lista de Correos</h4>
      </div>
      <div class="modal-body">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary" data-dismiss="modal">Cerrar</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->


<script>
  $(function() {
    var dt = $('#datatable').DataTable({
      "autoWidth": true,
      "responsive": true,
      "sDom": '<"pull-left"T>frt<"widget-foot" <"info_table pull-left"i><"pagination pull-right"p><"clearfix">>',
      "tableTools": {
        "sSwfPath": "swf/copy_csv_xls.swf",
        "aButtons": [{
          "sExtends": "csv",
          "sButtonText": "Exportar Todo CSV",
        },{
          "sExtends": "ajax",
          "mColumns": [0],
          "bHeader": false,
          "sNewLine": ",",
          "sButtonText": "Ver lista de correos (grupos seleccionados)",
          "oSelectorOpts": { filter: 'applied', order: 'current' },
          "sAjaxUrl": "/mails_user_groups.json",
          "fnClick": function( nButton, oConfig) {
            var sData = [];
            $( "input:checkbox:checked" ).each(function(i,item){
              sData.push($(item).val());
            });
            $.when(
              $.ajax({
              "url": oConfig.sAjaxUrl,
              "data": [ { "name": "data", "value": sData }],
              "dataType": "json",
              "type": "GET",
              "cache": false
            })).then(function(data) {
              var modal = $('#myModal');
              if (data.length == 0) {
                data = "No hay correos por mostrar. Asegurese de seleccionar los grupos";
              }
              modal.find(".modal-body").text(data)
              modal.modal('show');
            });
          }
        }
        ]},
        "oLanguage": {
          "sSearch": "Filtrar: ",
          "sZeroRecords": "No se encontraron espacios",
          "sInfo": "Mostrando _START_ a _END_ espacios de un total de _TOTAL_ ",
          "sInfoEmpty": "Mostrando 0 a 0 espacios de un total de 0",
          "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
          "oPaginate": {
            "sNext": "Siguiente <span class='glyphicon glyphicon-chevron-right'></span>",
            "sPrevious": "<span class='glyphicon glyphicon-chevron-left'></span> Anterior",
          }
        }
{'fraction_non_alphanumeric': 0.18525538707102954, 'fraction_numerical': 0.002693535514764565, 'mean_word_length': 1.8415532879818595, 'pattern_counts': {'":': 64, '<': 244, '<?xml version=': 0, '>': 244, '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': '644032', 'n_tokens_mistral': 3253, 'n_tokens_neox': 3065, 'n_words': 668}