Sha256: 527ca890343ac5c1af071a052902da2048c3cc2314ed1a02d586aa7d2df536c1

Contents?: true

Size: 1.56 KB

Versions: 1

Compression:

Stored size: 1.56 KB

Contents

<h1>Listado de <%= plural_table_name.humanize %></h1>

<table>
  <thead>
    <tr>
<%- attributes.each do |attribute| -%>
      <th><%= attribute.human_name %></th>
<%- end -%>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>

  <tbody>
  <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
    <tr>
<%- attributes.each do |attribute| -%>
      <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
<%- end -%>
<%- if options.cancan? -%>
      <td><%%= link_to 'Mostrar', <%= singular_table_name %> if can? :read, @<%= singular_table_name %> %></td>
      <td><%%= link_to 'Editar', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) if can? :update, @<%= singular_table_name %> %></td>
      <td><%%= link_to 'Eliminar', <%= singular_table_name %>, <%= key_value :confirm, "'¿Está usted seguro?'" %>, <%= key_value :method, ":delete" %> if can? :destroy, @<%= singular_table_name %> %></td>
<%- else -%>
      <td><%%= link_to 'Mostrar', <%= singular_table_name %> %></td>
      <td><%%= link_to 'Editar', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
      <td><%%= link_to 'Eliminar', <%= singular_table_name %>, <%= key_value :confirm, "'¿Está usted seguro?'" %>, <%= key_value :method, ":delete" %> %></td>
<%- end -%>
    </tr>
  <%% end %>
  </tbody>
</table>

<br />
<% nuevo = singular_table_name.split('_')[0].ends_with?("a") ? 'Nueva' : 'Nuevo' -%>
<%%= link_to '<%= nuevo %> <%= human_name %>', new_<%= singular_table_name %>_path if can? :create, <%= singular_table_name.camelize %> %>

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rieles-0.0.1 lib/generators/rieles/templates/index.html.erb