thoughtbot / administrate

A Rails engine that helps you put together a super-flexible admin dashboard.
http://administrate-demo.herokuapp.com
MIT License
5.9k stars 1.12k forks source link

view variants support #2578

Open hksk opened 5 months ago

hksk commented 5 months ago
$ ls -lah app/views/admin/courses
drwxr-xr-x  7 casa  staff   224B May  4 02:17 .
drwxr-xr-x  4 casa  staff   128B May  4 01:00 ..
-rw-r--r--  1 casa  staff   2.0K May  4 02:38 show+student.html.erb
-rw-r--r--  1 casa  staff   2.0K May  4 02:38 show.html.erb
# main controller
    def show
     variant = ""
     if !request.variant.nil? 
       variant = "+#{request.variant.to_s}"
     end
      render render "show#{variant}"locals: {
        page: Administrate::Page::Show.new(dashboard, requested_resource)
      }
    end
# generated controller
    def show
      request.variant = :student
      super
    end
nickcharlton commented 1 month ago

I'm not familiar with view variants. Is this a Rails feature we're not supporting? If so, could you link to the docs so we can plan out how to support it?

Thrizian commented 1 week ago

I'm not familiar with view variants. Is this a Rails feature we're not supporting? If so, could you link to the docs so we can plan out how to support it?

https://guides.rubyonrails.org/layouts_and_rendering.html#the-variants-option