Sha256: f7d02f69cc758bcc7e22cd3b2d912f2acb46c43abb36c7219094ac19f351a0dc

Contents?: true

Size: 1.07 KB

Versions: 6

Compression:

Stored size: 1.07 KB

Contents

function(doc, req) {
  var head = '<html><head><link rel="stylesheet" href="../../stylesheets/application.css" type="text/css" media="screen" charset="utf-8"></head><body>';
  var body = '';
  var tail = '</body></html>';
  if(doc) {
    body += '<p><a href="../../_list/<%= pluralized_model_name %>/<%= pluralized_model_name %>">List <%= pluralized_model_name.humanize %></a></p>';
<% attributes.each do |attribute| -%>
    if(doc['<%= attribute %>']) {
      body += '<p><strong><%= attribute.humanize %></strong>: ' + doc['<%= attribute %>'] + '</p>';
    }
<% end -%>
    return head + '<h1>Showing <%= model_name.humanize %></h1>' + body + tail;
  } else {
<% attributes.each do |attribute| -%>
    body += '<p><label><%= attribute.humanize %></label>: <input type="text" name="<%= model_name %>[<%= attribute %>]" id="<%= model_name %>_<%= attribute %>" /></p>';
<% end -%>
    body += '<p><input type="submit" /> <a href="../../_list/<%= pluralized_model_name %>/<%= pluralized_model_name %>">Cancel</a></p>';
    return head + '<h1>New <%= model_name.humanize %></h1>' + body + tail;
  }
}

Version data entries

6 entries across 6 versions & 2 rubygems

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