Disabling Turbo on a Link to a custom tab

25 views
Skip to first unread message

Rory McKinley

unread,
Mar 12, 2022, 3:06:26 AM3/12/22
to rails_admin
Hello All

I am using 3.0.0.rc and I have created a page that renders a MermaidJS chart. I did the necessary `//=require mermaid` in my own copy of ui.js.

If I browse directly to the custom page, mermaid correctly generates the diagram, but if I follow a link from, say, the list page, then the JS does not function correctly. I suspect it is because of Turbo. 

What I would I like to is the `data-turbo=false` attributes on any links that point to my custom tab. Is there any way to do this without messing with RailsAdmin internals?

Thanks

Rory

D F

unread,
May 25, 2022, 6:42:36 PM5/25/22
to rails_admin
You should be able to do something like this:

```
list do
  field :chart do
    label 'Mermaid'
    filterable false
    pretty_value { bindings[:view].link_to("Chart", mermaid_path, data: { turbo: false }) }
  end
end
```

You also have access to `bindings[:object]` which is the model object. Obviously you'd also want to include your other fields. I formatted for simplicity.
Reply all
Reply to author
Forward
0 new messages