Skip to content

Instantly share code, notes, and snippets.

@ahoward
Created December 23, 2008 17:08
Show Gist options
  • Save ahoward/39369 to your computer and use it in GitHub Desktop.
Save ahoward/39369 to your computer and use it in GitHub Desktop.
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