evolve-proj / composeapp / lists.yml

Full commit |
  (head, req) ->
    {_} = require 'underscore'
    {TableWriter} = require 'lib/tabular'
    start headers: {'Content-Type': 'text/html'}

    send '<h1>tabular</h1>'
    send """
          .correct {background-color: green;}
          .incorrect {background-color: red;}

    send """
          <dt>left to right
          <dt>top to botom
          <dd>incorrect result
          <dd> correct result
    info = _.clone req.query
    baseinfo = getRow().value
    hw_array = baseinfo.axis["height-weight"]
    hw = hw_array[0]
    tw = new TableWriter send, hw_array, (row) -> row.value.spec['height-weight']

    tw.make_header (send, val) ->
      send """
        <h2>heights weight #{ val }</h2>
      for p in baseinfo.axis.population
        send "  <th>#{ p }\n"
    last = {}
    tw.make_rows getRow, (send, row, last) ->
      val = row.value
      if last.generations != val.spec.generations
        send "  <tr><th>#{ val.spec.generations }\n"
      if val.correct
        send '    <td class=correct>'
        send '    <td class=incorrect>'
      send '&nbsp\n'
      return val.spec
    tw.make_footer (send) -> send '</table>'
    return |
  (head, req) ->
    start headers: {'Content-Type': 'text/html'}
    send '<h1>Runs:</h1>'
    while row = getRow()
       send "<h2><a href=#{ row.key[0] }>#{ row.key[0] }</a></h2>\n"
       send "<table>\n"
       for key, value of row.value.axis
         send "<tr><th>#{ key }</th><td>#{ toJSON value }</td></tr>\n"