Sha256: 5e8c9875c21681ac95f67c21ebe2ff59c2e2c514bd8548ce24cffb4b87b6bf5b

Contents?: true

Size: 860 Bytes

Versions: 22

Compression:

Stored size: 860 Bytes

Contents

class Teaspoon.Reporters.BaseView

  constructor: ->
    @elements = {}
    @build()


  build: (className) ->
    @el = @createEl("li", className)


  appendTo: (el) ->
    el.appendChild(@el)


  append: (el) ->
    @el.appendChild(el)


  createEl: (type, className = "") ->
    el = document.createElement(type)
    el.className = className
    el


  findEl: (id) ->
    @elements ||= {}
    @elements[id] ||= document.getElementById("teaspoon-#{id}")


  setText: (id, value) ->
    el = @findEl(id)
    el.innerHTML = value


  setHtml: (id, value, add = false) ->
    el = @findEl(id)
    if add then el.innerHTML += value else el.innerHTML = value


  setClass: (id, value) ->
    el = @findEl(id)
    el.className = value


  htmlSafe: (str) ->
    el = document.createElement("div")
    el.appendChild(document.createTextNode(str))
    el.innerHTML

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
teaspoon-1.4.0 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.2.2 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.2.1 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.2.0 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.5 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.4 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.3 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.2 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.1 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.1.0 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.0.2 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.0.1 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-1.0.0 app/assets/javascripts/teaspoon/reporters/html/base_view.coffee
teaspoon-0.9.1 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.9.0 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.8.0 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.7.9 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.7.8 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.7.7 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee
teaspoon-0.7.6 app/assets/javascripts/teaspoon/base/reporters/html/base_view.coffee