jaduff / LabLog

Software for recording physical users of computers in a lab environment.
MIT License
0 stars 1 forks source link

Duplications of views #21

Closed jaduff closed 6 years ago

jaduff commented 7 years ago

Both Teacher and Admin will have a Room View. The only difference is that the Admin view will have an Add Room button at the bottom. I can implement this with a partial view, but that then requires logic embedded in the view to show the button or not according to authorisation. In this case, would it be better to have a single shared view, and enclose the form in an if statement to prevent it being rendered? What is the overhead of partial views? Which is the better approach, or is there a different way of handling it?

simonjduff commented 7 years ago

These should definitely be separate views, but they can share a partial view for rendering. They are not expensive generally. The Admin one should absolutely be behind an authorization check. You do not need an if statement, because the button would be outside the partial view. Think of it this way: Partial view: Room display Teacher view: View with RoomDisplay partial inside Admin view: View with RoomDisplay partial inside, and an add button.

jaduff commented 7 years ago

gotcha, ta :)