Sha256: 42d1b4fdeb66dc760ceff5d41d63b3a537a255501f7c9ff5051875dd3d207d17

Contents?: true

Size: 777 Bytes

Versions: 1

Compression:

Stored size: 777 Bytes

Contents

function(head, req) {
  // !code mustache.js
  // !json templates/layout.mustache
  // !json templates/<%= pluralized_model_name %>/index.mustache

  provides("html", function() {
    var view = {
      title: "Listing <%= pluralized_model_name.humanize %>",
      body: {
        rows: function() {
          var rows = [];
          var row;
          while (row = getRow()) {
            rows.push({
<% attributes.each do |attribute| -%>
              <%= attribute %>: row.value['<%= attribute %>'],
<% end -%>
              id: row.id
            });
          }

          return rows;
        }
      }
    };

    Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.index }, function(line) {
      send(line + "\n");
    });
  });
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rid-0.4.0 lib/rid/generators/list/templates/list.js