Commits

Anonymous committed ffd724a

some other changes.

  • Participants
  • Parent commits 6d311bd

Comments (0)

Files changed (6)

 {
     "env": {
         "default": {
-            "db": "http://127.0.0.1:5984/benoitc-dev"
+            "db": "http://benoitc:test@127.0.0.1:5984/benoitc-dev"
         }
     }
 }

_attachments/css/layout.css

+body {
+    background-color: #e7e7e7;
+    color: #000;
+}
+
+#container {
+    width: 100%;
+}
+
+
+a {
+    color: #14456e;
+}
+h2, h3 {
+font-size:medium;
+}
+
+body {
+    -x-system-font:none;
+    font-family:'Gill Sans','Gill Sans MT',Verdana,sans-serif;
+    font-size:medium;
+    font-size-adjust:none;
+    font-stretch:normal;
+    font-style:normal;
+    font-variant:normal;
+    font-weight:normal;
+    line-height: 18px;
+    font-size: 12px;
+}
+
+
+
+img { border: none; }
+
+#main-footer {
+    clear: both;
+    width: 100%;
+}
+
+#edit {
+    height: 100%;
+    overflow:hidden;
+}
+#edit #fedit {
+    display: block;
+    position: relative;
+     width: 50%;
+    float: left;
+    height: 100%;
+
+}
+
+#edit #mdpreview {
+    display: block;
+    position: relative;
+    width: 48%;
+    float: right;
+    height: 100%;     
+    overflow: auto;    
+}
+
+form ol {
+    list-style: none;
+}
+form ol li {
+    padding: 2px 0;
+    /*clear: both;*/
+    margin: 0;
+}
+form li * {
+    vertical-align: middle
+}
+form label {
+    display: block;
+    width: 14em;
+    height: 11px;
+    float: left;
+    padding: 0 1em 3px 0;
+}
+input[type='text'], 
+input[type='password'],
+select {
+    width: 174px;
+    border: 1px solid;
+    margin: 0;
+}
+
+#fedit textarea {
+    width: 99%;
+    height: 100%;
+    border: 1px solid;
+    height: 280px;
+}

_attachments/css/screen.css

-body {
-    background-color: #e7e7e7;
-    color: #000;
-}
-
-#container {
-    width: 100%;
-}
-
-
-a {
-    color: #14456e;
-}
-h2, h3 {
-font-size:medium;
-}
-
-body {
-    -x-system-font:none;
-    font-family:'Gill Sans','Gill Sans MT',Verdana,sans-serif;
-    font-size:medium;
-    font-size-adjust:none;
-    font-stretch:normal;
-    font-style:normal;
-    font-variant:normal;
-    font-weight:normal;
-    line-height: 18px;
-    font-size: 12px;
-}
-
-
-
-img { border: none; }
-
-#main-footer {
-    clear: both;
-    width: 100%;
-}
-
-#edit {
-    height: 100%;
-    overflow:hidden;
-}
-#edit #fedit {
-    display: block;
-    position: relative;
-     width: 50%;
-    float: left;
-    height: 100%;
-
-}
-
-#edit #preview {
-    display: block;
-    position: relative;
-    width: 48%;
-    float: right;
-    height: 100%;     
-    overflow: auto;    
-}
-
-form ol {
-    list-style: none;
-}
-form ol li {
-    padding: 2px 0;
-    /*clear: both;*/
-    margin: 0;
-}
-form li * {
-    vertical-align: middle
-}
-form label {
-    display: block;
-    width: 14em;
-    height: 11px;
-    float: left;
-    padding: 0 1em 3px 0;
-}
-input[type='text'], 
-input[type='password'],
-select {
-    width: 174px;
-    border: 1px solid;
-    margin: 0;
-}
-
-#fedit textarea {
-    width: 99%;
-    height: 100%;
-    border: 1px solid;
-    height: 280px;
-}

_attachments/js/showdown.js

 //
 // Copyright (c) 2007 John Fraser.
 //
-// Original Markdown Copyright (c) 2004-2005 John Gruber
-//   <http://daringfireball.net/projects/markdown/>
+// Original Markdown Copyright (c) 2004-2005 John Gruber
+//   <http://daringfireball.net/projects/markdown/>
 //
 // Redistributable under a BSD-style open source license.
 // See license.txt for more information.
 			return _EncodeEmailAddress( _UnescapeSpecialChars(m1) );
 		}
 	);
+	
+	/* wiki links */
+    //text = text.replace(/(^| )(\b[A-Z][a-z]+[A-Z][\w\u00A1-\uFFFF]+\b)/, "<a href=\""+site.url+"/$1\">$1</a>");
+    //text = text.replace(/\[\[\s*([^\]]+)\]\]/, "<a href=\""+site.url+"/$1\">$1</a>")
 
 	return text;
 }
 	return "~E"+charCodeToEscape+"E";
 }
 
-} // end of Showdown.converter
+} // end of Showdown.converter

_local/feeder/feeder.py

                 update_ids = []
                 docs = []
                 for entry in list(g):
-                    entry['_id'] = uuid.UUID(entry.pop('id'))
+                    entry['_id'] = uuid.UUID(entry.pop('id')).hex
                     entry['doc_type'] = 'FeedItem'
                     update_ids.append(entry['_id'])
                     docs.append(entry)
                     docs[i].update({'_rev': row.value('_rev')})
             else:
                 for entry in list(g):
-                    entry['_id'] = uuid.UUID(entry.pop('id'))
-        db.save(entries)
+                    entry['_id'] = uuid.UUID(entry.pop('id')).hex
+        self.db.save(entries)
         f = open(self.token_file, 'w')
         f.write(self.token)
         f.close()

lib/templates/edit.html

     <link rel="home index" href="http://benoitc.org/" type="text/html">
     <link rel="me author" href="http://benoitc.org/apropos.html" type="text/html">
 
-    <link rel="stylesheet" href="<%= assets %>/css/screen.css" type="text/css" media="screen, projection" />
-
+    <link rel="stylesheet" href="<%= assets %>/css/layout.css" type="text/css" media="screen, projection" />
+    <link rel="stylesheet" href="<%= assets %>/css/default.css" type="text/css" media="screen, projection" />
     
+    <link rel="stylesheet" href="<%= assets %>/css/typography.css" type="text/css" media="screen, projection" />
 
 
 </head>
         </h1>
         </header>
         <div id="edit">
-            <form id="fedit" name="fedit" action="new.html">
+            <form id="fedit" name="fedit" action="new.html"
+                method="post">
                 <p><label for="title">Titre<label><input type="text"
                         name="title" id="title" value=""></p>
                         
 
     <script src="/_utils/script/json2.js"></script>
     <script src="/_utils/script/jquery.js"></script>
+    <script src="/_utils/script/jquery.cookies.js"></script>
     <script src="/_utils/script/jquery.couch.js"></script>
     <script src="<%= assets %>/js/showdown.js"></script>
 
     <script src="<%= assets %>/js/textarea.jquery.js"></script>
+    <script src="<%= assets %>/js/jquery.couchapp.js"></script>
     <script src="<%= assets %>/js/editor.js"></script>
+    <script src="<%= assets %>/js/blog.js"></script>
     <script>
-        new Editor() 
+        $(document).ready(function() {
+
+            $.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);
+                    // thin controller - move to B?
+
+                    var postForm = app.docForm("form#new-post", {
+                        id : <%= docid %>,
+                        fields : ["title", "body", "tags"],
+                        onLoad : function(doc) {
+                            if (doc._id) {
+
+                            }
+                        },
+                        beforeSave : function(doc) {
+                            doc.html = B.formatBody(doc.content);
+                            doc.format = "markdown";
+
+                            if(doc.labels) {
+                                doc.labels = doc.labels.split(",");
+                                for(var idx in doc.labels) {
+                                    doc.labelsidx] = $.trim(doc.labels[idx]);
+                                }
+                            } 
+                        },
+                        success : function(resp) {
+                           /* $("#saved").text("Saved _rev: "+resp.rev).fadeIn(500).fadeOut(3000);
+                            B.editing(resp.id);*/
+                        }
+                    });  
+
+                    new Editor(); 
+                    }, function() {
+                    // callback
+                    $('body').append('<a href="<%= assets %>/account.html#'+document.location+'">redirect</a>');
+                    var absurl = $('body a:last')[0].href;
+                    document.location = absurl;
+                });
+            });
+            
+            
+            
+        });
     </script>
 
 </html>