Sha256: 47da82a77dca4212c91ad769d9ac77135352a81e7e788332bd8018934485c979

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

<%%= render(Tables::TableComponent.new) do |table| %>
  <%% table.with_thead do |thead| %>
  <%- bo_model.column_names.each do |column| -%>
    <%%= thead.with_active_record_th(column_name: '<%= column %>',  ransack_object: @q) %>
  <%- end -%>
    <%%= thead.with_active_record_th %>
    <%%= thead.with_active_record_th %>
  <%% end %>

  <%% table.with_tbody do |tbody| %>
    <%% @<%= class_name.underscore.pluralize %>&.each_with_index do |<%= class_name.underscore %>, i| %>
      <%%= tbody.with_tr(index: i) do |tr| %>
        <%- bo_model.column_names.each do |column| -%>
          <%- if %i[date datetime].include?(bo_model.attribute_types[column].type)  -%>
          <%%= tr.with_td { I18n.l(<%= class_name.underscore %>.<%= column %>, format: :long) if <%= class_name.underscore %>.<%= column %> } %>
          <%- else -%>
          <%%= tr.with_td { <%= class_name.underscore %>.<%= column %>.to_s } %>
          <%- end -%>
        <%- end -%>
        <%%= tr.with_td do %>
          <%%= link_to <%="#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%>, class: "text-tybo-600 hover:text-tybo-900"  do %>
            <%%= I18n.t('bo.show') %>
          <%% end %>
        <%% end %>
        <%%= tr.with_td do %>
          <%%= link_to <%="#{options[:namespace]}_#{class_name.underscore}_path(#{class_name.underscore})"%>,
          class: "text-tybo-600 hover:text-tybo-900",
          data: { turbo_method: :delete, turbo_confirm: I18n.t('bo.confirm_delete') } do %>
            <%%= render(Icons::TrashComponent.new) %>
          <%% end %>
        <%% end %>
      <%% end %>
    <%% end %>
  <%% end %>
<%% end %>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tybo-0.4.1 lib/generators/bo/templates/_table.html.erb
tybo-0.4.0 lib/generators/bo/templates/_table.html.erb
tybo-0.3.26 lib/generators/bo/templates/_table.html.erb
tybo-0.3.24 lib/generators/bo/templates/_table.html.erb