%- model_class = clase.constantize -%> <%- titulo = model_class.human_attribute_name( model_class.model_name.to_s.demodulize.pluralize) -%>
<%= model_class.human_attribute_name(atr) %> | <% end %><%=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 %> |
<% 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 %> |