       "click #xlf-download": "downloadButtonClick"
       "click #save": "saveButtonClick"
       "click #publish": "publishButtonClick"
-      "click #settings": "toggleSurveySettings"
       "update-sort": "updateSort"
       "click .js-select-row": "selectRow"
       "click .js-select-row--force": "forceSelectRow"


    getApp: -> @

    toggleSurveySettings: (evt) ->
      $et = $(evt.currentTarget)
      $et.toggleClass('active__settings')
      if @features.surveySettings
        $settings = @$(".form__settings")
        $settings.toggle()
        close_settings = (e) ->
          $settings_toggle = $('#settings')

          is_in_settings = (element) ->
            element == $settings[0] || $settings.find(element).length > 0
          is_in_settings_toggle = (element) ->
            element == $settings_toggle[0] || $settings_toggle.find(element).length > 0

          if !(is_in_settings(e.target) || is_in_settings_toggle(e.target))
            $settings.hide()
            $et.removeClass('active__settings')
            $('body').off 'click', close_settings

        $('body').on 'click', close_settings


    _getViewForTarget: (evt)->
      $et = $(evt.currentTarget)
      modelId = $et.closest('.survey__row').data('row-id')

    features:
      multipleQuestions: true
      skipLogic: true
      copyToLibrary: true

  class surveyApp.QuestionApp extends SurveyFragmentApp
    features:
      multipleQuestions: false
      skipLogic: false
      copyToLibrary: false
    render: () ->
      super
      @$('.survey-editor.form-editor-wrap.container').append $('.question__tags')
