Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 1.91 KB | None | 0 0
  1.     filterInput = new TJS_TextInput
  2.         id: "friendsListFilter"
  3.         label: "Search friends"
  4.         ### Added by Jimbo - 2/2/2011 - Able to put the label inside the text as initial value ###
  5.         labelAsValue: true
  6.     friendChecklist = new TJS_Checklist
  7.         id: "friendsList"
  8.     pickButton = new TJS_Button
  9.         id: "pickFriendsButton"
  10.         label: "Ask Selected Friends"
  11.         action: "pickFriends"
  12.     skipButton = new TJS_Button
  13.         id: "skipFriendsButton"
  14.         label: "Skip"
  15.         action: "skipFriends"
  16.     new TJS_Dialog
  17.         id: "helperPicker"
  18.         modal: true
  19.         contents: [
  20.             filterInput
  21.             friendChecklist
  22.             pickButton
  23.             skipButton
  24.         ]
  25.         ### Added by Jimbo - 2/2/2011 - Able to pass title and width as params ###
  26.         title: "Send Invitations"
  27.         width: 455
  28.        
  29.     friendsList = {}
  30.     inputDictionary = []
  31.     $('#friendsData li').each ->
  32.         name = $(this).find('.friendName').html()
  33.         id = $(this).find('.friendID').html()
  34.         friendsList[id] = name
  35.         inputDictionary.push name
  36.     friendChecklist.setOptions friendsList
  37.     filterInput.setDictionary inputDictionary
  38.     $(document).bind 'autocompleteOpen', (event, object) ->
  39.         filteredList = {}
  40.         for friendID, friendName of friendsList
  41.             do (friendID, friendName) ->
  42.                 for item in object
  43.                     do (item) ->
  44.                         if item == friendName
  45.                             filteredList[friendID] = friendName
  46.     friendChecklist.setOptions filteredList
  47.   $(document).bind 'textInput', (event, object) ->
  48.     if object.id == 'friendsListFilter' && object.text == ''
  49.       friendChecklist.setOptions friendsList
  50.   $('#dataDump').remove()
  51.   $(document).bind 'pickFriends', (event, object) ->
  52.     list = []
  53.     $('#friendsList input:checked').each ->
  54.       list.push $(this).attr 'value'
  55.     $.getJSON("/snapbooks/event_invite", {item_id: $('#events').data('event_id'), participation_array: list}, (data))
  56.   $(document).bind 'skipFriends', (event, object) ->
  57.     $.getJSON("/snapbooks/event_invite", {item_id: $('#events').data('event_id')},(data))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement