Sha256: 648555d91c502fc0886443b85e716120221bd447b74d7f68cd6f7da12feeb723
Contents?: true
Size: 1.3 KB
Versions: 3
Compression:
Stored size: 1.3 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 %>/deleted.mustache var doc = { type: '<%= model_name %>', <% attributes.each do |attribute| -%> '<%= attribute %>': req.form['<%= attribute %>'], <% end -%> _id: req.form.id, _rev: req.form.rev }; if (req.form['delete'] == 'true') { doc._deleted = true; }; var view = { path: path(), body: { path: path(), <% attributes.each do |attribute| -%> '<%= attribute %>': doc['<%= attribute %>'], <% end -%> id: doc._id } }; var partial; if (doc._deleted) { view.title = "Deleted <%= model_name.humanize %>"; view.notice = "<%= model_name.humanize %> has been deleted."; partial = 'deleted'; } else { view.title = "Showing <%= model_name.humanize %>"; if (doc._rev) { view.notice = "<%= model_name.humanize %> has been updated."; } else { view.notice = "<%= model_name.humanize %> has been created."; }; partial = 'show'; } return [doc, Mustache.to_html(templates.layout, view, { body: templates.<%= pluralized_model_name %>[partial] })]; }
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rid-0.5.2 | lib/rid/generators/update/templates/update.js |
rid-0.5.1 | lib/rid/generators/update/templates/update.js |
rid-0.5.0 | lib/rid/generators/update/templates/update.js |