Sha256: 2e7f61b9a582d2ddfe1ebfe3f1fd07a2f5c5979a1422def35e9007e11f22ea93

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

- resource = (@_effective_resource || Effective::Resource.new(controller_path))

- if @datatable
  - content_for :datatable do
    = render_datatable(@datatable, charts: false)
  - content_for :datatable_charts do
    - keys = @datatable._charts.keys
    - ks = keys.size
    - if ks.positive?
      %br
      .row
        - @datatable._charts.keys.each do |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-secondary
              .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': :maximize }
                    %i.fas.fa-expand
              .card-body
                = render_datatable_chart(@datatable, k)

  = content_for :datatable_charts

.row
  .col-12
    .card
      .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

- begin
  = render partial: 'index_additional'
- rescue ActionView::MissingTemplate
  - Rails.logger.debug "did not find additional index partial"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
five-two-nw-olivander-0.1.2.15 app/views/application/index.html.haml
five-two-nw-olivander-0.1.2.14 app/views/application/index.html.haml
five-two-nw-olivander-0.1.2.13 app/views/application/index.html.haml