Commits

Anonymous committed fc29022

recent posts ok.

Comments (0)

Files changed (3)

lib/templates/edit.html

 
 <body>
         <header>
-        <div id
         <h1>
             <a rel="me author" href="<%= assets %>/benoitc.html">Benoît Chesneau</a>
         </h1>
 
             $.CouchApp(function(app) {
                 app.loggedInNow(function(login) {
-                    // w00t, we're logged in (according to the cookie)
                     $("#header").prepend('<span id="login">'+login+'</span>');
-                    // setup CouchApp document/form system, adding app-specific callbacks
-                    // rename docForm?
+                    
                     var B = new Blog(app);
 
                     var postForm = app.docForm("form#fedit", {
                             if (doc.body)
                                 doc.html = B.formatBody(doc.body);
 
-
                             if (!doc.created_at) {
                                 doc.created_at = new Date().rfc3339();
                             }
                                 doc._id = doc.slug;
                             }
 
-
                             doc.updated = new Date().rfc3339();
                             if(doc.labels) {
                                 doc.labels = doc.labels.split(",");

lib/templates/feeds/row.html

 <h2 class="date"><%= last_day %></h2>
 <% } %>
 <article>
-    <header>
-    <hp><a href="<%= item.link %>" title="<%= item.title %>"><img
-            src="<%= item.service.iconUrl %>" alt=""></a> - <a
-            href="<%= item.service.profileUrl %>"><%= item.service.id
-            %></a></p>
-    </header>
-    
+<header>
+<p><a href="<%= item.link %>" title="<%= item.title %>"><img
+        src="<%= item.service.iconUrl %>" alt=""></a> - <a
+        href="<%= item.service.profileUrl %>"><%= item.service.id
+        %></a></p>
+</header>
+
     <p><%= item.title %></p>
     
 </article>

validate_doc_update.js

 function (newDoc, oldDoc, userCtx) {
-  var type = (oldDoc || newDoc)['type'];
+  var doc_type = (oldDoc || newDoc)['type'];
   var author = (oldDoc || newDoc)['author'];
 
   function forbidden(message) {    
     
     if (userCtx.roles.indexOf('_admin') == -1) {
       // admin can edit anything, only check when not admin...
-      if (oldDoc && oldDoc.author != newDoc.author) 
+      if (!newDoc._deleted && (oldDoc && oldDoc.author != newDoc.author))
         forbidden("You may not change the author of a doc.");
 
       if (author != userCtx.name)
 
   
   // general timestamps
-  if (oldDoc && oldDoc.created_at != newDoc.created_at) 
+  if (!newDoc._deleted && (oldDoc && oldDoc.created_at != newDoc.created_at)) 
     forbidden("You may not change the created_at field of a doc.");
   
   // this ensures that the date will be UTC, parseable, and collate correctly
   //    forbidden("Sorry, "+newDoc.created_at+" is not a valid date format. Try: 2008/12/10 21:16:02 +0000");
   //}
     
-  if (type == 'post') {
+  if (doc_type == 'post') {
     // post required fields
     require(author, "Posts must have an author.")
     require(newDoc.body, "Posts must have a body field")
     require(newDoc.slug == newDoc._id, "Post slugs must be used as the _id.")
     require(newDoc.created_at, "Posts must have a created_at date.");
 
-  } else if (type == 'comment') {
+  } else if (doc_type == 'comment') {
     // comment required fields
     require(newDoc.created_at, "Comments must have a created_at date.");
     require(newDoc.post_id, "Comments require a post_id.");