Closed ArturAguiar closed 11 years ago
Yes, that's the purpose of the @offerings variable -- it contains the offerings whose content are currently being viewed on a particular page, not all of the offerings that are available at any particular time.
You would need to do a different query to populate that dropdown.
On Mon, Sep 23, 2013 at 1:58 PM, ArturAguiar notifications@github.comwrote:
In a course's home page the @offerings variable only lists the specific offering being viewed if the user isn't viewing all offerings for the course. This decision was made in the FriendlyUrlController.
I'm unsure as to why that is. I would need a list of all offerings to correctly populate that dark dropdown in the instructor view of the home page which allows them to switch between the offerings.
In addition to that it seems that a lot of code in the view and controllers use the fact that the @offerings variable only has one element to determine whether the user is viewing a single offering or all of them.
— Reply to this email directly or view it on GitHubhttps://github.com/web-cat/pythy/issues/54 .
Tony Allevato tony.allevato@gmail.com
Okay. Thanks for the clarification. (:
Like you said, I had to create another variable called @all_course_offerings as in:
@all_course_offerings = []
@course.course_offerings.each do |offering|
@all_course_offerings << offering if can?(:show, offering)
end
The dropdown is now populated correctly.
In a course's home page the @offerings variable only lists the specific offering being viewed if the user isn't viewing all offerings for the course. This decision was made in the FriendlyUrlController.
I'm unsure as to why that is. I would need a list of all offerings to correctly populate that dark dropdown in the instructor view of the home page which allows them to switch between the offerings.
In addition to that it seems that a lot of code in the view and controllers use the fact that the @offerings variable only has one element to determine whether the user is viewing a single offering or all of them.