Created
December 23, 2008 17:08
-
-
Save ahoward/39369 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tabs_for_teacher | |
tabs = | |
[ | |
tab('Home', :teacher_home){|c| c.class.name =~ %r/unit|home/i and request.request_uri !~ %r/classroom/}, | |
tab('Classes', :teacher_classrooms){|c| request.request_uri =~ %r/classroom/ and request.request_uri !~ %r/teacher_tools/} | |
] | |
# | |
# MEGA HACK - and won't work once there are more units, or even more of the | |
# same unit... sigh | |
# | |
classrooms = current_user.classrooms | |
unless classrooms.empty? | |
classroom = classrooms.first | |
href = unit_energy_classroom_teacher_tools_path(:classroom_id => classroom.id) | |
tabs << tab('Teacher Tools', href) | |
end | |
tabs | |
end | |
helper_method 'tabs_for_teacher' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment