Sha256: 19d40389a00e75266859dc69a65dadfcaf8e2e8b7acc8610a82454b32ba90959

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

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

  if (!doc) {
    var doc = {
      _id: req.form.id,
      type: '<%= model_name %>',
<% attributes.each do |attribute| -%>
      '<%= attribute %>': req.form['<%= attribute %>'],
<% end -%>
    };
    var view = {
      path: path(),
      title: "Created Post",
      body: {
        path: path(),
<% attributes.each do |attribute| -%>
        '<%= attribute %>': doc['<%= attribute %>'],
<% end -%>
        id: doc._id
      }
    };

    return [doc, Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.show })];
  }
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rid-0.4.1 lib/rid/generators/update/templates/update.js