Sha256: f25b62ab3ddeba5418feefd793331ca717b2cc3a8a9f88436cd05d8b8e5a2a51

Contents?: true

Size: 838 Bytes

Versions: 4

Compression:

Stored size: 838 Bytes

Contents

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

  provides("html", function() {
    var view = {
      path: path(),
      title: "Listing <%= pluralized_model_name.humanize %>",
      body: {
        path: path(),
        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

4 entries across 4 versions & 1 rubygems

Version Path
rid-0.5.2 lib/rid/generators/list/templates/list.js
rid-0.5.1 lib/rid/generators/list/templates/list.js
rid-0.5.0 lib/rid/generators/list/templates/list.js
rid-0.4.1 lib/rid/generators/list/templates/list.js