Non-view functionality in a partial of layout.

Bug #596840 reported by Sami Saada
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Tarkisto
New
Undecided
Unassigned

Bug Description

From revision 25 there is a wrong type of functionality in line 4 of /app/views/layouts/_main.html.haml

The main problem is "@controller.controller_name == 'exams'". If we want other controller to have same kind of functionality, that isn't possible without modifying this code snippet. This breaks lots of conventions and I'm tried of arguing about it.

More rails-way to do this is to use partials or different layouts. In this case a single partial can be more DRY-friendly:
     #left= render :partial => "leftside"

How ever that has a problem, which makes the site crash, if there isn't leftside view-partial for requested controller. For our luck there is a rescue :)
     #left= render :partial => "leftside" rescue nil
We rescue nil, because there isn't any content then.

app/views/exams/_leftside contains then all exams tabs info.

This type of coding opens us lots of possibilities, like different kind of tabs in every page.

Related branches

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.