lib/couch/generators/show/templates/show.js in couch-0.0.4 vs lib/couch/generators/show/templates/show.js in couch-0.1.0

- old
+ new

@@ -1,19 +1,20 @@ 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) { - <% attributes.each do |attribute| %> + 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>' + body += '<p><strong><%= attribute.humanize %></strong>: ' + doc['<%= attribute %>'] + '</p>'; } - <% end %> +<% 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" /></p>' +<% 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; } }