Created
September 4, 2013 20:36
-
-
Save uris77/6442516 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class List.Controller extends App.Controllers.Base | |
initialize: (options) -> | |
@searchModel = options.searchModel | |
@searchModel.on "change:sortField", @fetchAttendees | |
@searchModel.on "change:queryString", @fetchAttendees | |
@searchModel.on "change:group", @fetchAttendees | |
@fetchAttendees() | |
@layout = @getLayout() | |
@show @layout | |
attendeeRoles = App.request "attendee:eventRoles" | |
App.execute "when:fetched", attendeeRoles, => | |
@showSearchBar attendeeRoles | |
@showTopPanel attendeeRoles | |
getListView: (attendees, searchModel) -> | |
new App.AttendeeGeneralList.Views.AttendeesListView | |
collection: attendees | |
searchModel: searchModel | |
showTopPanel: (attendeeRoles) -> | |
new App.AttendeeGeneralList.TopPanel.Controller | |
region: @layout.topPanelRegion | |
modalRegion: @layout.modalRegion | |
attendeeRoles: attendeeRoles | |
showSearchBar: (attendeeRoles) -> | |
new App.AttendeeGeneralList.SearchBar.Controller | |
region: @layout.searchPanelRegion | |
searchModel: @searchModel | |
attendeeRoles: attendeeRoles | |
getAttendees: (options) -> | |
App.request "attendees:fetchAll", options | |
fetchAttendees: => | |
@attendees = App.request "attendees:fetchAll", @searchModel | |
App.execute "when:fetched", @attendees, => | |
@updateAttendeeList @attendees | |
updateAttendeeList: (attendees) -> | |
listView = @getListView attendees, @searchModel | |
@layout.attendeeListRegion.show listView | |
getLayout: -> | |
new App.AttendeeGeneralList.Views.Layout |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment