pasosdeJesus/heb412_gen

View on GitHub
app/views/msip/modelos/_index_post_tabla.html.erb

Summary

Maintainability
Test Coverage
<div class="row">

  <div class="col-sm-4">
    <% begin %>
      <%= will_paginate @registros, { 
        param_name: :pagina,
        class: "page-link"}  %>
    <% rescue => e %>
      t("Problemas presentando paginador") (<%= e %>)
    <% end %>
  </div>

  <div class="col-sm-2">
    <% if can?(:new, clase.constantize) %>
      <% rutaf = clase.pluralize.underscore + "/index_boton_nuevo" %>
      <% if lookup_context.find_all(rutaf, [], true).any? %>
        <%= render partial: rutaf, locals: {f: f} %>
      <% else %>
        <%= render partial: "index_boton_nuevo", locals: {f: f} %>
      <% end %>
    <% end %>
    <%= render partial: 'index_post_mas_botones', locals: {f: f} %>
  </div>

  <div class="offset-sm-1 col-sm-3">
    <% if @plantillas && @plantillas.count > 0 %>
      <% oppres = [["", ""]] %>  
      <% oppres += @plantillas if @plantillas %>
      <%= f.input :disgenera, collection: oppres, 
        label: false, include_blank: false %>
    <% end %>
  </div>

  <div class="col-sm-2">
    <% if @plantillas && @plantillas.count > 0 && @plantillas[0]  %>
      <% pl = Heb412Gen::Plantillahcm.find(@plantillas[0][1]) %>
      <%  if Ability::CAMPOS_PLANTILLAS_PROPIAS[pl.vista] %>
        <% Rails.logger.info "** OJO ** pl=#{pl}" %>
        <% ruta = Ability::CAMPOS_PLANTILLAS_PROPIAS[pl.vista][:ruta] ||
          "/#{clase.demodulize.pluralize.downcase}" %>
        <% Rails.logger.info "** OJO ** ruta=#{ruta}" %>
        <%= link_to t("Generar ODS"), 
          "#", class: "btn",
          onclick: "heb412_gen_completa_generarp(this, '#filtro_disgenera', "\
          "'#{ruta}', "\
          "'#{ruta}')",
          target: "_blank" %>
        <%= link_to t("Generar XLSX"), "#", class: "btn",
          onclick: "heb412_gen_completa_generarp(this, '#filtro_disgenera', "\
          "'#{ruta}', "\
          "'#{ruta}', 'xlsx')",
          target: "_blank" %>
        <%= link_to t("Generar PDF"), "#", class: "btn", 
          onclick: "heb412_gen_completa_generarp(this, '#filtro_disgenera', "\
          "'#{ruta}', "\
          "'#{ruta}', 'pdf')",
          target: "_blank" %>


        <!--%= link_to t('.imprimir', :default => 'Generar documemto'),  
          '#', class: 'btn', 
          onclick: "heb412_gen_completa_generarp(this, " +
          "\'#genera_plantilla_id\', null, \'#
          <!-- %= link_to t('.pdf', :default => 'Generar PDF'),
            '#', class: 'btn', 
            onclick: "heb412_gen_completa_generarp(this, " +
            "\'#genera_plantilla_id\', null, \'#{modelo_path(@registro)}/fichapdf\')" %-->
        <% end %>
      <% end %>

  </div>
</div>