Sha256: 42ecf393e2141ac4c0a49ac92464c462a2f0ceccf4f2fef4c4d98bb0f4ee611a

Contents?: true

Size: 1.58 KB

Versions: 35

Compression:

Stored size: 1.58 KB

Contents

module Avo
  module ResourcesHelper
    def resource_table(resources, resource)
      render partial: "avo/partials/resource_table", locals: {
        resources: resources,
        resource: resource
      }
    end

    def resource_grid(resources, resource)
      render partial: "avo/partials/resource_grid", locals: {
        resources: resources,
        resource: resource
      }
    end

    def index_field_wrapper(**args, &block)
      render Index::FieldWrapperComponent.new(**args) do
        capture(&block)
      end
    end

    def show_field_wrapper(**args, &block)
      render Show::FieldWrapperComponent.new(**args) do
        capture(&block)
      end
    end

    def edit_field_wrapper(**args, &block)
      render Edit::FieldWrapperComponent.new(**args) do
        capture(&block)
      end
    end

    def filter_wrapper(name: nil, index: nil, **args, &block)
      render layout: "layouts/avo/filter_wrapper", locals: {
        name: name,
        index: index
      } do
        capture(&block)
      end
    end

    def item_selector_init(resource)
      "data-resource-name='#{resource.plural_name.downcase}' data-resource-id='#{resource.model.id}' data-controller='item-selector'"
    end

    def item_selector_input(floating: false, size: :md)
      "<input type='checkbox'
        class='mx-3 #{"absolute inset-auto left-0 mt-2 z-10 hidden group-hover:block checked:block" if floating} #{size.to_sym == :lg ? "w-5 h-5" : "w-4 h-4"}'
        data-action='input->item-selector#toggle'
        title='#{t "avo.select_item"}'
        data-tippy='tooltip'
      />"
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
avo-1.11.0 app/helpers/avo/resources_helper.rb
avo-1.10.1 app/helpers/avo/resources_helper.rb
avo-1.10.0 app/helpers/avo/resources_helper.rb
avo-1.9.1 app/helpers/avo/resources_helper.rb
avo-1.9.0 app/helpers/avo/resources_helper.rb
avo-1.8.4 app/helpers/avo/resources_helper.rb
avo-1.8.3 app/helpers/avo/resources_helper.rb
avo-1.8.2 app/helpers/avo/resources_helper.rb
avo-1.8.1 app/helpers/avo/resources_helper.rb
avo-1.8.0 app/helpers/avo/resources_helper.rb
avo-1.7.3 app/helpers/avo/resources_helper.rb
avo-1.7.3.pre.1 app/helpers/avo/resources_helper.rb
avo-1.7.2 app/helpers/avo/resources_helper.rb
avo-1.7.1 app/helpers/avo/resources_helper.rb
avo-1.7.0 app/helpers/avo/resources_helper.rb
avo-1.6.4.pre.1 app/helpers/avo/resources_helper.rb
avo-1.6.3.pre.3 app/helpers/avo/resources_helper.rb
avo-1.6.3.pre.2 app/helpers/avo/resources_helper.rb
avo-1.6.3.pre.1 app/helpers/avo/resources_helper.rb
avo-1.6.2.pre.1 app/helpers/avo/resources_helper.rb