How to create different view modes. Like a visitor can choose list or box view.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends how much these views are similar, what I would do is to create partials for each view and then in the main view I call the right one depending on the property. Say you have a function in
application_helperwhich_viewin yourindexyou can write something like this:I prefer the previous, but if you have few changes you can go for something like:
** EDIT **
make the action:
set your routes:
write your form:
Not best practice but it works!