Sha256: 7e9f2e7a191616bdc9830d37425e1faeb66be72a6bac6d264c4942e5ae904fb6

Contents?: true

Size: 988 Bytes

Versions: 6

Compression:

Stored size: 988 Bytes

Contents

function(head, req) {
  provides("html", function() {
    var header = '<html><head><link rel="stylesheet" href="../../stylesheets/application.css" type="text/css" media="screen" charset="utf-8"></head><body><h1>Listing <%= pluralized_model_name.humanize %></h1>';

    header += '<p><a href="../../_show/<%= model_name %>/">New <%= model_name.humanize %></a></p>';

    header += '<table><tr>';
<% attributes.each do |attribute| -%>
    header += '<th><%= attribute.humanize %></th>';
<% end -%>
    header += '<th></th>';
    header += '</tr>';
    send(header);

    var row;
    while (row = getRow()) {
      var body = '<tr>';
<% attributes.each do |attribute| -%>
      body += '<td>' + row.value['<%= attribute %>'] + '</td>';
<% end -%>
      body += '<td><a href="../../_show/<%= model_name %>/' + row.id + '" alt="Show <%= model_name.humanize %>">Show</a></td>';
      body += '</tr>';
      send(body);
    }

    var tail = '</table></body></html>';
    return tail;
  });
}

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
rid-0.3.1 lib/rid/generators/list/templates/list.js
rid-0.3.0 lib/rid/generators/list/templates/list.js
couch-0.2.0 lib/couch/generators/list/templates/list.js
couch-0.1.2 lib/couch/generators/list/templates/list.js
couch-0.1.1 lib/couch/generators/list/templates/list.js
couch-0.1.0 lib/couch/generators/list/templates/list.js