pasosdeJesus/heb412_gen

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

Summary

Maintainability
Test Coverage
<%= simple_form_for :genera, 
      { url: modelo_path(@registro) , method: 'get' } do |f| %>
  <div class="row">
    <div class="col-sm-3">

      <% rutareg = clase.pluralize.underscore + '/show_boton_regresar' %>
      <% if lookup_context.find_all( rutareg, [], true).any? %>
        <%= render partial: rutareg %>
      <% else %>
        <%= link_to t('.back', :default => t("helpers.links.back")),
          modelos_path(@registro), :class => 'btn'  %>
      <% end %>

      <% if can?(:edit, @registro) %>
         <%= link_to t('.edit', :default => t("helpers.links.edit")),
           edit_modelo_path(@registro),
           "data-turbo": false,
           :class => 'btn' %>
      <% end %>
    </div>

    <% rutamas = clase.pluralize.underscore + '/show_mas_acciones' %>
    <% if lookup_context.find_all( rutamas, [], true).any? %>
      <% # Hay un parcial %>
      <%= render partial: rutamas %>
    <% else %>
      <%= render 'show_mas_acciones' %>
    <% end %>

    <div class="col-sm-3">
      <% if can?(:read, @registro) && @plantillas && @plantillas.count > 0 %>
         <% oppres = @plantillas ? @plantillas : [['','']] %>
         <%= f.input :plantilla_id, collection: oppres, 
           label: false, include_blank: false %>
      <% end %>
    </div>

    <div class="col-sm-3">
      <% if can?(:read, @registro) && @plantillas && @plantillas.count > 0 %>
        <%= link_to t('Generar ODS'),  
          '#', class: 'btn', 
          onclick: "heb412_gen_completa_generarp(this, "\
          "\'#genera_plantilla_id\', null, "\
          "\'#{modelo_path(@registro)}/fichaimp\', 'ods')" %>
        <%= link_to t('Generar XLSX'),  
          '#', class: 'btn', 
          onclick: "heb412_gen_completa_generarp(this, "\
          "\'#genera_plantilla_id\', null, "\
          "\'#{modelo_path(@registro)}/fichaimp\', 'xlsx')" %>
        <%= link_to t('Generar PDF'),
          '#', class: 'btn', 
          onclick: "heb412_gen_completa_generarp(this, " +
          "\'#genera_plantilla_id\', null, \'#{modelo_path(@registro)}/fichapdf\')" %>
  
          <!-- %= link_to t('.pdf', :default => 'Ficha en PDF'),
            proyectofinanciero_path(@registro) + "/fichapdf", 
            {class: 'btn', "data-turbo" => false } %-->
      <% end %>
    </div>
    <div class="col-sm-3">
      <% if can?(:destroy, @registro) %>
        <%= link_to t('.destroy', :default => t("helpers.links.destroy")),
          modelo_path(@registro),
          :method => 'delete',
          :data => { 
            :confirm => 
            t('.confirm', :default => 
              t("helpers.links.confirm", 
                :default => 'Are you sure?'
               )
             )
          },
          :class => 'btn btn-danger' %>
      <% end %>
    </div>
  </div> <!-- row -->

<% end %>