Sha256: 54fa7b5ce834c61e976bf00f1e4e7fdafe66cbb5317b84a6007191bda43abd9c

Contents?: true

Size: 856 Bytes

Versions: 19

Compression:

Stored size: 856 Bytes

Contents

class Teabag.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("teabag-#{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

19 entries across 19 versions & 1 rubygems

Version Path
teabag-0.7.3 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.7.2 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.7.1 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.7.0 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.6.0 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.5 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.4 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.3 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.2 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.1 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.5.0 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.6 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.5 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.4 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.3 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.2 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.1 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.4.0 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee
teabag-0.3.6 app/assets/javascripts/teabag/base/reporters/html/base_view.coffee