- resource = (@_effective_resource || Effective::Resource.new(controller_path)) = render_optional_partial 'index_before' - if @datatable - content_for :datatable do = render_datatable(@datatable, charts: false, input_js: { "stripeClasses": [] }) - content_for :datatable_charts do - keys = @datatable._charts.keys - ks = keys.size - if ks.positive? %br.foo .row{ data: { controller: 'datatable-index-charts' }} - keys.each do |k| - chart = @datatable._charts[k] %div{ class: "#{col_class_num('xl', ks, 3)} #{col_class_num('lg', ks, 2)} #{col_class_num('md', ks, 6)} #{col_class_num('sm', ks, 6)}"} .card.card-primary{ data: { controller: 'datatable-expandable-chart' } } .card-header %h3.card-title= I18n.t([@datatable.class.name.underscore, 'charts', k].join('.')) .card-tools.text-right %button.btn.btn-tool{ type: :button, 'data-card-widget': :collapse } %i.fas.fa-minus %button.btn.btn-tool{ type: :button, 'data-card-widget': :maximize } %i.fas.fa-expand .card-body{ style: 'height: 220px' } = send(chart[:as].underscore, @datatable.to_json[:charts][k][:data], id: chart[:name], height: '90%', adapter: 'google') = content_for :datatable_charts .row .col-12 .card.card-primary .card-header %h3.card-title= page_title .card-tools = resource_form_actions(@context.route_builder, resource.klass, for_action: :index) .card-body - if @datatable = content_for :datatable - elsif instance_variable_get('@' + resource.plural_name).respond_to?(:to_partial_path) = render instance_variable_get('@' + resource.plural_name) - elsif instance_variable_get('@' + resource.name).respond_to?(:to_partial_path) = render instance_variable_get('@' + resource.name) - elsif Rails.env.development? %p effective_resources index view is not sure what to render. %p Define an @datatable, @#{resource.try(:plural_name) || 'a plural'}, or @#{resource.try(:name) || 'a singular'}. %p or include Effective::CrudController in your controller -# .card-footer = render_optional_partial 'index_after'