Is there any way to add custom actions? #135
Answered
by
cjavdev
brunoprietog
asked this question in
Q&A
-
Hi, |
Beta Was this translation helpful? Give feedback.
Answered by
cjavdev
Dec 6, 2022
Replies: 2 comments 5 replies
-
I used this PR for guidance and was able to get custom actions working: 2351ae0 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Put a call to member_action do
button_to "Fetch", main_app.fetch_madmin_video_path(@record), method: :patch, data: { turbo_confirm: "Are you sure?" }, class: "btn btn-primary"
end Put a route in your config/routes/madmin.rb routes: resources :videos do
member do
patch :fetch
end
end Add the controller method to the madmin controller def fetch
@record.fetch!
redirect_to main_app.madmin_video_path(@record), notice: "Video fetched!"
end |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
excid3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Put a call to
member_action
in your Resource that will render some HTML into the detail view of the resource.Put a route in your config/routes/madmin.rb routes:
Add the controller method to the madmin controller