window.Build = find: (id) -> $("##{id}") all: (cb) -> $.getJSON '/build', (data) -> cb(data) DOM: UIHelper: # Click log to expand/collapse expand_toggle: (el) -> el.on "click", (e) -> if el.css("max-height") is "100px" el.css "max-height", "100%" else el.css "max-height", "100px" enable_links: (element) -> element.find('a.remove').click -> $.ajax type: "DELETE" url: $(@).data('url') return false element.find('a.retest').click -> $(@).parents('.build').find('pre').html("") $.post $(@).data('url') return false init: (build_id) -> build = Build.find(build_id) # Color the output logs pre = build.find(".output pre") output = pre.html() if output? && output.size > 0 pre.html ansi2html(output) # Enable expansion toggle Build.DOM.UIHelper.expand_toggle pre Build.DOM.UIHelper.enable_links build List: add: (build) -> html = Build.to_html(build) if $('.build').length > 0 $('.build').first().before html else $('ul#builds').append html Build.DOM.init build.id to_html: (build) -> """
  • #{build.status}
    #{build.name}
    #{build.ref?=''}
    #{build.output}
    Remove | Retest
  • """