Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- filterInput = new TJS_TextInput
- id: "friendsListFilter"
- label: "Search friends"
- ### Added by Jimbo - 2/2/2011 - Able to put the label inside the text as initial value ###
- labelAsValue: true
- friendChecklist = new TJS_Checklist
- id: "friendsList"
- pickButton = new TJS_Button
- id: "pickFriendsButton"
- label: "Ask Selected Friends"
- action: "pickFriends"
- skipButton = new TJS_Button
- id: "skipFriendsButton"
- label: "Skip"
- action: "skipFriends"
- new TJS_Dialog
- id: "helperPicker"
- modal: true
- contents: [
- filterInput
- friendChecklist
- pickButton
- skipButton
- ]
- ### Added by Jimbo - 2/2/2011 - Able to pass title and width as params ###
- title: "Send Invitations"
- width: 455
- friendsList = {}
- inputDictionary = []
- $('#friendsData li').each ->
- name = $(this).find('.friendName').html()
- id = $(this).find('.friendID').html()
- friendsList[id] = name
- inputDictionary.push name
- friendChecklist.setOptions friendsList
- filterInput.setDictionary inputDictionary
- $(document).bind 'autocompleteOpen', (event, object) ->
- filteredList = {}
- for friendID, friendName of friendsList
- do (friendID, friendName) ->
- for item in object
- do (item) ->
- if item == friendName
- filteredList[friendID] = friendName
- friendChecklist.setOptions filteredList
- $(document).bind 'textInput', (event, object) ->
- if object.id == 'friendsListFilter' && object.text == ''
- friendChecklist.setOptions friendsList
- $('#dataDump').remove()
- $(document).bind 'pickFriends', (event, object) ->
- list = []
- $('#friendsList input:checked').each ->
- list.push $(this).attr 'value'
- $.getJSON("/snapbooks/event_invite", {item_id: $('#events').data('event_id'), participation_array: list}, (data))
- $(document).bind 'skipFriends', (event, object) ->
- $.getJSON("/snapbooks/event_invite", {item_id: $('#events').data('event_id')},(data))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement