lib/rid/generators/show/templates/show.js in rid-0.4.0 vs lib/rid/generators/show/templates/show.js in rid-0.4.1
- old
+ new
@@ -1,22 +1,39 @@
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: {
- title: doc.title,
- body: doc.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 {
- return '404 not found';
+ 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 });
}
}