Sha256: 5421a63d5df06eeb146c3d95c9cb1b1e3ed1af9f43462dd318e33b892dae1a60

Contents?: true

Size: 1.26 KB

Versions: 4

Compression:

Stored size: 1.26 KB

Contents

Luca.components.DevelopmentConsole = Luca.View.extend
  name: "development_console"
  className: 'luca-ui-development-console'

  initialize: (@options={})->
    Luca.View::initialize.apply @, arguments
    if @modal
      @$el.addClass 'luca-ui-modal'

  beforeRender: ()->
    @$el.append @make("div",class:"console-inner")

    @console_el = @$('.console-inner')

    @console = @console_el.console
      promptLabel: "Coffee> "
      animateScroll: true
      promptHistory: true
      autoFocus: true
      commandValidate: (line)->
        valid = true

        valid = false if line is ""

        try
          if CoffeeScript.compile(line)
            valid = true
          else
            valid = false
        catch error
          valid =  false

        valid

      returnValue: (val)->
        val?.toString()

      parseLine: (line)->
        _( line ).strip()
        line = line.replace(/^return/,' ')
        "return #{ line }"

      commandHandle: (line)->
        return if line is ""

        compiled = CoffeeScript.compile( @parseLine(line) )

        try
          ret = eval(compiled)
          return @returnValue(ret)
        catch error
          if error.message.match /circular structure to JSON/
            return ret.toString()

          error.toString()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
luca-0.7.92 src/components/development_console.coffee
luca-0.7.91 src/components/development_console.coffee
luca-0.7.9 src/components/development_console.coffee
luca-0.7.8 src/components/development_console.coffee