-
title t(‘.title’)
<% if options -%>
-
if can? :new, <%= class_name %> %p.nav= link_to t(‘.new_<%= singular_table_name %>’), new_<%= singular_table_name %>_path, class: ‘new’
<% else -%> %p.nav= link_to t(‘.new_<%= singular_table_name %>’), new_<%= singular_table_name %>_path, class: ‘new’ <% end -%> <% turbo = defined? Turbo -%>
-
if @<%= plural_table_name %>.limit(1).size > 0
<% if defined? Wice::WiceGrid -%>
- if @grid = grid @grid do |g|
<% for attribute in attributes.reject(&:password_digest?) -%> <% if attribute.reference? -%>
- g.column name: <%= class_name %>.human_attribute_name(:<%= attribute.name %>), class: '<%= attribute.name %>', attribute: '<%= attribute.name %>_id' do |<%= singular_table_name %>| - <%= singular_table_name %>.<%= attribute.name %>.try :name
<% else -%>
- g.column name: <%= class_name %>.human_attribute_name(:<%= attribute.name %>), class: '<%= attribute.name %>', attribute: '<%= attribute.name %>' do |<%= singular_table_name %>| - <%= singular_table_name %>.<%= attribute.name %>
<% end -%> <% end -%> <% if options -%>
- g.column do |<%= singular_table_name %>| - if can? :show, <%= singular_table_name %> - link_to t('show'), <%= singular_table_name %>, class: 'show' - g.column do |<%= singular_table_name %>| - if can? :edit, <%= singular_table_name %> - link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit' - g.column do |<%= singular_table_name %>| - if can? :destroy, <%= singular_table_name %>
<% if turbo -%>
- link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
- link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% else -%>
- g.column do |<%= singular_table_name %>| - link_to t('show'), <%= singular_table_name %>, class: 'show' - g.column do |<%= singular_table_name %>| - link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit' - g.column do |<%= singular_table_name %>|
<% if turbo -%>
- link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
- link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% end -%>
-else %table %thead %tr
<% for attribute in attributes.reject(&:password_digest?) -%>
%th= <%= class_name %>.human_attribute_name :<%= attribute.name %>
<% end -%>
%th{colspan: 3}= t 'actions' %tbody - @<%= plural_table_name %>.each do |<%= singular_table_name %>| %tr{class: cycle(:odd, :even)}
<% for attribute in attributes.reject(&:password_digest?) -%> <% if attribute.reference? -%>
%td.<%= attribute.name %>= <%= singular_table_name %>.<%= attribute.name %>.try :name
<% else -%>
%td.<%= attribute.name %>= <%= singular_table_name %>.<%= attribute.name %>
<% end -%> <% end -%> <% if options -%>
%td.action - if can? :show, <%= singular_table_name %> = link_to t('show'), <%= singular_table_name %>, class: 'show' %td.action - if can? :edit, <%= singular_table_name %> = link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit' %td.action - if can? :destroy, <%= singular_table_name %>
<% if turbo -%>
= link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
= link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% else -%>
%td.action= link_to t('show'), <%= singular_table_name %>, class: 'show' %td.action= link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit'
<% if turbo -%>
%td.action= link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
%td.action= link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% end -%> <% else -%>
%table %thead %tr
<% for attribute in attributes.reject(&:password_digest?) -%>
%th= <%= class_name %>.human_attribute_name :<%= attribute.name %>
<% end -%>
%th{colspan: 3}= t 'actions' %tbody - @<%= plural_table_name %>.each do |<%= singular_table_name %>| %tr{class: cycle(:odd, :even)}
<% for attribute in attributes.reject(&:password_digest?) -%> <% if attribute.reference? -%>
%td= <%= singular_table_name %>.<%= attribute.name %>.try :name
<% else -%>
%td= <%= singular_table_name %>.<%= attribute.name %>
<% end -%> <% end -%> <% if options -%>
%td.action - if can? :show, <%= singular_table_name %> = link_to t('show'), <%= singular_table_name %>, class: 'show' %td.action - if can? :edit, <%= singular_table_name %> = link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit' %td.action - if can? :destroy, <%= singular_table_name %>
<% if turbo -%>
= link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
= link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% else -%>
%td.action= link_to t('show'), <%= singular_table_name %>, class: 'show' %td.action= link_to t('edit'), edit_<%= singular_table_name %>_path(<%= singular_table_name %>), class: 'edit'
<% if turbo -%>
%td.action= link_to t('destroy'), <%= singular_table_name %>, class: 'destroy', data: {turbo_confirm: t('.confirm', default: 'Are you sure?'), turbo_method: :delete}
<% else -%>
%td.action= link_to t('destroy'), <%= singular_table_name %>, data: {confirm: t('.confirm', default: 'Are you sure?')}, method: :delete, class: 'destroy'
<% end -%> <% end -%> <% end -%>
-
else .empty
= t '.empty'