Sha256: 8e0e0d63e06b806dd4f2d0af786c87ce08f138ee56ee862ff27cf5dd302815e4

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

function(doc, req) {
  // !code path.js
  // !code mustache.js
  // !json templates/layout.mustache
  // !json templates/<%= pluralized_model_name %>/show.mustache
  // !json templates/<%= pluralized_model_name %>/form.mustache
  
  if(doc) {
    provides("html", function() {
      var view = {
        path: path(),
        title: "Showing <%= model_name.humanize %>",
        body: {
          path: path(),
<% attributes.each do |attribute| -%>
          '<%= attribute %>': doc['<%= attribute %>'],
<% end -%>
          id: doc._id
        }
      };
      
      return Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>.show });
    });
  } else {
    var view = {
      path: path(),
      title: "New <%= model_name.humanize %>",
      body: {
        path: path(),
<% attributes.each do |attribute| -%>
          '<%= attribute %>': '',
<% end -%>
        id: ''
      }
    };

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

Version data entries

1 entries across 1 versions & 1 rubygems

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