-kd      = require 'kd'
-utils   = require './../core/utils'
-JView   = require './../core/jview'
-
+kd             = require 'kd'
+utils          = require './../core/utils'
+JView          = require './../core/jview'
+LoginInputView = require './../login/logininputview'
 
 module.exports = class TeamsSelectorForm extends kd.FormView
 

      attributes  : { testpath : 'goto-team-button' }
      type        : 'submit'

    @input.on 'ValidationFeedbackCleared', =>
      @inputView.unsetClass 'validation-error validation-passed'


  pistachio: ->

    """
    {{> @inputView}}
    <div class='submit'>{{> @button}}</div>
    """

    teams    = utils.getPreviousTeams()
    lastTeam = teams?.latest

    @teamName = new LoginInputView
      inputOptions   :
        label        : 'Team URL'
        placeholder  : 'your-team-name'
        name         : 'slug'
        defaultValue : lastTeam  if lastTeam

    @suffix = new kd.View
      tagName      : 'span'
      cssClass     : 'TeamDomainSuffix'
      partial      : ".#{kd.config.domains.main}"


