Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web and Mobile views best practices same controller or namespace?

Im looking for the guidance on best practices for developing a web app with normal views and mobile views. The mobile version would have less of the functionality but a whole lot of view files.

Is it a better idea to separate the whole application into two projects, or to create a namespace? Or simple to keep everything inside of the single set of controllers?

like image 348
Josh Crowder Avatar asked Nov 15 '22 01:11

Josh Crowder


1 Answers

Unless the functionality is drastically different, I'd leave the app as it is and create a mobile responder that would render the mobile site's pages.

respond_to :mobile { #render mobile view here }

The reason for this is that you'd be copying code into another namespace and therefore causing yourself maintainability headaches. However, if the functionality is very different, go ahead and create a namespace for the mobile site.

like image 78
Srdjan Pejic Avatar answered Nov 24 '22 00:11

Srdjan Pejic