Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Using a partial for list views? #1361

Closed
dfischer opened this Issue · 1 comment

2 participants

Daniel Fischer Benoit Bénézech
Daniel Fischer

First off, I just want to say wow, rails_admin is cool! It doesn't look that customizable but once you dig into some of the internals you can really take advantage of interesting api piping.

I understand you can use partials for edit views (which is awesome!)

I am wondering if you can do the same for the list views? It took some random googling to find out I can do something like the following:

    list do
      field :photo_url do
        formatted_value do
          view = bindings[:view]
          bindings[:view].content_tag(:div) do 
            view.filepicker_image_tag(bindings[:object].photo_url, w: 160, h: 160, fit: 'clip')
          end
        end
      end
      field :title
    end

I'd be interested in doing this purely with a partial. Is that possible?

Benoit Bénézech
Collaborator

Sure.

    list do
      field :photo_url do
        formatted_value do
          bindings[:view].render partial: 'my_partial'
        end
      end
      field :title
    end
Benoit Bénézech bbenezech closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.