<commit_before>class ConversationStarterButton extends KDButtonView

  constructor:(options, data)->

    options = $.extend
      cssClass  : 'clean-gray conversation-starter'
      icon      : yes
      iconClass : 'plus-black'
    , options

    super options, data

  click:->
    conversationStarter = new ConversationStarter
    contextMenu   = new JContextMenu
      menuWidth   : 200
      delegate    : @
      x           : @getX() - 206
      y           : @getY() - 6
      arrow       :
        placement : "right"
        margin    : 6
      lazyLoad    : yes
    , customView  : conversationStarter

    conversationStarter.on 'ConversationStarted', contextMenu.bound 'destroy'
    conversationStarter.focus()

class ConversationStarter extends JView

  constructor:->
    super
      cssClass : "conversation-starter-popup"

    @recipientsWrapper = new KDView
      cssClass : "completed-items"

    @recipient = new KDAutoCompleteController
      name                : "recipient"
      itemClass           : MemberAutoCompleteItemView
      selectedItemClass   : MemberAutoCompletedItemView
      outputWrapper       : @recipientsWrapper
      itemDataPath        : "profile.nickname"
      listWrapperCssClass : "users"
      submitValuesAsText  : yes
      dataSource          : ({inputValue}, callback)=>
        blacklist = (data.getId() for data in @recipient.getSelectedItemData())
        KD.remote.api.JAccount.byRelevance \
          inputValue, {blacklist}, (err, accounts)=>
            callback accounts

    @startConversationButton = new KDButtonView
      title    : 'Create'
      cssClass : 'cupid-green create-conversation'
      callback : @bound 'createConversation'
    @startConversationButton.hide()

    @recipient.on 'ItemListChanged', (newCount)=>
      if newCount > 0
      then @startConversationButton.show()
      else @startConversationButton.hide()

    @input = @recipient.getView()
    @input.setPlaceHolder "Start by typing user names..."

  viewAppended:->
    super

    @addSubView @input
    @addSubView @recipientsWrapper
    @addSubView @startConversationButton

  focus:-><commit_msg>ConversationStarter: Added hidden class to search results container (showing it if results found)<commit_after>class ConversationStarterButton extends KDButtonView

  constructor:(options, data)->

    options = $.extend
      cssClass  : 'clean-gray conversation-starter'
      icon      : yes
      iconClass : 'plus-black'
    , options

    super options, data

  click:->
    conversationStarter = new ConversationStarter
    contextMenu   = new JContextMenu
      menuWidth   : 200
      delegate    : @
      x           : @getX() - 206
      y           : @getY() - 6
      arrow       :
        placement : "right"
        margin    : 6
      lazyLoad    : yes
    , customView  : conversationStarter

    conversationStarter.on 'ConversationStarted', contextMenu.bound 'destroy'
    conversationStarter.focus()

class ConversationStarter extends JView

  constructor:->
    super
      cssClass : "conversation-starter-popup"

    @recipientsWrapper = new KDView
      cssClass : "completed-items hidden"

    @recipient = new KDAutoCompleteController
      name                : "recipient"
      itemClass           : MemberAutoCompleteItemView
      selectedItemClass   : MemberAutoCompletedItemView
      outputWrapper       : @recipientsWrapper
      itemDataPath        : "profile.nickname"
      listWrapperCssClass : "users"
      submitValuesAsText  : yes
      dataSource          : ({inputValue}, callback)=>
        blacklist = (data.getId() for data in @recipient.getSelectedItemData())
        KD.remote.api.JAccount.byRelevance \
          inputValue, {blacklist}, (err, accounts)=>
            callback accounts

    @startConversationButton = new KDButtonView
      title    : 'Create'
      cssClass : 'cupid-green create-conversation'
      callback : @bound 'createConversation'
    @startConversationButton.hide()

    @recipient.on 'ItemListChanged', (newCount)=>
      if newCount > 0
        @recipientsWrapper.show()
        @startConversationButton.show()
      else
        @startConversationButton.hide()

    @input = @recipient.getView()
    @input.setPlaceHolder "Start by typing user names..."

  viewAppended:->
    super
    @addSubView @input
    @addSubView @recipientsWrapper
    @addSubView @startConversationButton

  focus:->
{'fraction_non_alphanumeric': 0.08482243836236146, 'fraction_numerical': 0.00407147704139335, 'mean_word_length': 2.4928909952606637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6991162', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1191, 'n_words': 280}