mercredi 3 février 2016

Creating multiple dashboards for a half dozen user types in Rails

I'm working on a project that involves seven different kinds of users. These users each have a very similar-looking dashboard.

They're almost exactly the same for each user, but do differ slightly:

  • Higher-tier users have certain buttons visible
  • The table layout includes extra columns
  • Some actions related to table entries are restricted to normal users

I'd love to make the code more DRY but how do I approach this problem if partials will complicate the layout rather than simplify it, in this case?

My initial idea was to display ALL the elements, but hide/restrict them with if statements, making for one, but very logic-heavy view.

More broadly speaking, if the UI changes significantly based on the privilege level of the user viewing it, what's the accepted Rails pattern for keeping things organized?

Aucun commentaire:

Enregistrer un commentaire