<%- model_class = clase.constantize -%> <%- titulo = model_class.human_attribute_name( model_class.model_name.to_s.demodulize.pluralize) -%>
<% ng = (!genclase.nil? && genclase == 'F') ? 'Nueva' : 'Nuevo' %> <% if @registros.size > 5 && can?(:new, clase.constantize)%> <%= link_to t('.new', default: [ng, t("helpers.links.new")]), new_modelo_path(@registros), class: 'btn btn-primary' %> <% end %>
<%= titulo %>: <%= @registros.count %>
<%= simple_form_for :filtro, { url: modelos_path(@registros), method: "get"} do |f| %> <% atributos_index.each do |atr| %> <% end %> <% rutaf = clase.pluralize.underscore + '/index_filtro' %> <% if lookup_context.find_all(rutaf, [], true).any? %> <% # Hay un parcial %> <%= render partial: rutaf, locals: {f: f} %> <% else %> <%= render partial: 'index_filtro', locals: {f: f} %> <% end %> <% @registros.try(:each) do |registro| %> <% atributos_index.each do |atr| %> <% end %> <% end %>
<%= model_class.human_attribute_name(atr) %><%=t '.actions', :default => t("helpers.actions") %>
<% #byebug %> <% vatr = atr.to_s.gsub(/[^a-z_A-Z0-9]/, '') %> <% rutavatr = clase.pluralize.underscore + "/index_campo_#{vatr}" %> <% rutashow = clase.pluralize.underscore + "/show_campo_#{vatr}" %> <% if lookup_context.find_all(rutavatr, [], true).any? %> <%= render partial: rutavatr, locals: {registro: registro} %> <% elsif lookup_context.find_all(rutashow, [], true).any? %> <% @registro = registro %> <%= render partial: rutashow, locals: {registro: registro} %> <% elsif atr == "id" then %> <%= link_to registro[atr], modelo_path(registro) %> <% else %> <% s = registro.presenta(atr) %> <% if s.include?("\n") %>
<%= s %>
<% else %> <%= s %> <% end %> <% end %>
<% rutama = clase.pluralize.underscore + '/index_acciones' %> <% if lookup_context. find_all( rutama, [], true).any? %> <% # Hay un parcial %> <%= render partial: rutama, locals: {f: f, registro: registro} %> <% else %> <% if can?(:edit, registro ) %> <%= link_to t('.edit', :default => t("helpers.links.edit")), edit_modelo_path(registro), :class => 'btn btn-sm' %> <% end %> <%= render partial: 'index_mas_acciones' %> <% 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-sm btn-danger' %> <% end %> <% end %>
<% rutaipt = clase.pluralize.underscore + '/index_post_tabla' %> <% if lookup_context.find_all(rutaipt, [], true).any? %> <% # Hay un parcial para final tabla %> <%= render partial: rutaipt, locals: {f: f} %> <% else %> <%= render partial: 'index_post_tabla', locals: {f: f} %> <% end %> <% end #simple_form_for %>