 
 kd    = require 'kd'
+nick  = require 'app/util/nick'
 
 addTo = (parent, views)->
   map = {}


  return map

globals = require 'globals'
kontrolUrl = if globals.config.environment in ['dev', 'sandbox'] \
             then "\n$ export KONTROLURL=#{globals.config.newkontrol.url}" else ''

contents  =
  install : """#{kontrolUrl}
    $ curl -sO https://s3.amazonaws.com/koding-klient/install.sh
    $ bash ./install.sh
  """
  # Add %%TOKEN%% to install instructions to enable tokens

module.exports   = view =
  message        : ({text, cssClass}) -> new kd.View

  instructions   : (content) ->
    content      = contents[content] ? content
    if view._otatoken
      content    = content.replace '%%TOKEN%%',    view._otatoken
      content    = content.replace '%%USERNAME%%', nick()
    container    = new kd.View
    addTo container,
      header     : 'Instructions'
