       "click .js-toggle-row-settings": "toggleRowSettings"
       "click .js-toggle-row-multioptions": "toggleRowMultioptions"
       "click .js-expand-row-selector": "expandRowSelector"
+      "click .js-expand-multioptions--all": "expandMultioptions"
       "click .rowselector_toggle-library": "toggleLibrary"
       "mouseenter .card__buttons__button": "buttonHoverIn"
       "mouseleave .card__buttons__button": "buttonHoverOut"

          throw new Error('View for row was not found: ' + rowId)
        new $viewRowSelector.RowSelector(el: $spacer.get(0), ngScope: @ngScope, spawnedFromView: view, surveyView: @, reversible:true).expand()

    render: ()->
      @$el.removeClass("content--centered").removeClass("content")
      @$el.html $viewTemplates.$$render('surveyApp', @)
      @survey.settings.on 'validated:invalid', (model, validations) ->
        for key, value of validations
            break

      @formEditorEl = @$(".-form-editor")
      # @$(".survey-editor__null-top-row .survey__row__spacer .btn--addrow").click (evt)=>
      #   if !@emptySurveyXlfRowSelector
      #     @emptySurveyXlfRowSelector = new $viewRowSelector.RowSelector(el: @$el.find(".survey__row__spacer").get(0), survey: @survey, ngScope: @ngScope)
      #   @emptySurveyXlfRowSelector.expand()

      @null_top_row_view_selector = new $viewRowSelector.RowSelector(el: @$el.find(".survey__row__spacer").get(0), survey: @survey, ngScope: @ngScope, surveyView: @, reversible:true)

      if @features.displayTitle
        $viewUtils.makeEditable @, @survey.settings, '.form-title', property:'form_title', options: validate: (value) ->
          if value.length > 255
            return "Length cannot exceed 255 characters, is " + value.length + " characters."
          return
      else
        @$(".survey-header__inner").hide()

      # see this page for info on what should be in a form_id
      # http://opendatakit.org/help/form-design/guidelines/
      $viewUtils.makeEditable @, @survey.settings, '.form-id', property:'form_id', transformFunction: $modelUtils.sluggify
      # @.survey.on 'change:form_id', _.bind viewUtils.handleChange('form_id', XLF.sluggify), @

      addOpts = @$("#additional-options")
      for detail in @survey.surveyDetails.models
        addOpts.append((new $surveyDetailView.SurveyDetailView(model: detail)).render().el)

      @reset()

      if not @features.surveySettings
        @$(".survey-header__options-toggle").hide()

      if @features.multipleQuestions
        @activateSortable()
      else
        @$el.addClass('survey-editor--singlequestion')

        if @survey.rows.length is 0
          new $viewRowSelector.RowSelector(el: @$el.find(".survey__row__spacer").get(0), survey: @survey, ngScope: @ngScope, surveyView: @, reversible: false).expand()

      if not @features.copyToLibrary
        # TODO: what happened to this element?
        @$(".row-extras__add-to-question-library").hide()


      if @expand_all_multioptions is null
        $expand_multioptions = @$(".js-expand-multioptions--all")
        $expand_multioptions.click () =>
          if @expand_all_multioptions
            @expand_all_multioptions = false
            $(".card.card--selectquestion").removeClass("card--expandedchoices")
            $expand_multioptions.html($expand_multioptions.html().replace("Collapse", "Expand"));
          else
            @expand_all_multioptions = true
            $(".card.card--selectquestion").addClass("card--expandedchoices")
            $expand_multioptions.html($expand_multioptions.html().replace("Expand", "Collapse"));

      @

    getItemPosition: (item) ->
      i = 0

      @survey.forEachRow(fn, includeErrors: true, includeGroups: true, flat: true)

      null_top_row = @formEditorEl.find(".survey-editor__null-top-row, .survey-editor__message").removeClass("expanded")

      if isEmpty and @features.multipleQuestions
        null_top_row.removeClass("hidden")
      else if @features.multipleQuestions
        null_top_row.addClass("hidden")

      if @features.multipleQuestions
        @activateSortable()

      ``

    clickRemoveRow: (evt)->
      evt.preventDefault()
