Source

benoitc.im / templates / post.html

<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="utf-8"/>
    <title>benoît chesneau web - <%= doc.title %></title>

    <!--[if IE]>

    <script>
        // allow IE to recognize HTMl5 elements
        document.createElement('section');
        document.createElement('article');
        document.createElement('aside');
        document.createElement('footer');
        document.createElement('header');
        document.createElement('nav');
        document.createElement('time');

    </script>
    <![endif]-->
    <link rel="openid.server" href="http://www.myopenid.com/server">
    <link rel="openid.delegate" href="http://bchesneau.myopenid.com/">
    <link rel="home index" href="http://benoitc.org" type="text/html">
    <link rel="me author" href="http://benoitc.org/static/benoitc.html" type="text/html">

    <link rel="stylesheet" href="../../css/benoitc.css" type="text/css" media="screen, projection" />


</head>


<body>
    <div id="container">
        <header id="adminheader"></header>
        <section id="maincontent"> 
        <article class="article content">
            <header>
                <h1><%= doc.title %></h1>
                <time title="GMT" datetime="<%= doc.created_at %>" class="caps"><%= fcreated_at %></time>     
                <p><a rel="me author" href="../../benoitc.html">Benoît Chesneau</a></p>       
            </header>    
            <%= doc.html %>
            <% if (labels) { %>
            <footer>
            <p>Cette entrée a été marquée <%= labels %> — Suivez un des libellés pour obtenir d'autres articles ou essais en relation.</p>
            </footer>
            <% } %>
        </article>
        </section>
        <section id="comments">
            <h2>Discutez</h2>
            <ol></ol>
            <h2>Laissez un commentaire</h2>
            <form id="new-comment" action="post.html" class="leave" method="post">
                <div>

                    <label for="commenter-name">Nom</label>
                    <br>
                    <input name="commenter-name" type="text">
                    <br>
                    <label for="commenter-url">URL (optionnel)</label>
                    <br>
                    <input name="commenter-url" type="text" value="">
                    <br>
                    <label for="commenter-email">Courriel</label>
                    <small>(pour <a href="http://gravatar.com">Gravatar</a>)</small>
                    <br />
                    <input type="text" name="commenter-email" value="">
                    <br />
                    <label for="comment">Commentaire</label>
                    <small>(syntaxe: <a href="http://daringfireball.net/projects/markdown/syntax" title="Markdown Syntax Reference">markdown</a>)</small>
                    <br>
                    <textarea id="comment" name="comment" rows="8" style="width: 100%;"></textarea>
                    <input type="button" id="preview" value="Prévisualiser">&nbsp;<input value="Laissez un commentaire" type="submit">
                </div>
                <div id="comment-preview"></div>
            </form>
            
        </section>

        <footer id="main-footer">
            <p>2009 (c) <a href="../../benoitc.html">Benoît Chesneau</a> - <a rel="license" href="http://creativecommons.org/licenses/by/2.0/fr/">Certains droits reservés</a>.</p>
        </footer> 
    </div>
</body>
    <script src="/_utils/script/json2.js"></script>
    <script src="/_utils/script/jquery.js"></script>
    <script src="/_utils/script/jquery.couch.js"></script>
    <script src="/_utils/script/jquery.cookies.js"></script>
    <script src="../../js/jquery.couchapp.js"></script>
    <script src="../../js/strftime.js"></script>
    <script src="../../js/showdown.js"></script>
    <script src="../../js/blog.js"></script>
    <script src="../../js/md5.js"></script>  
    <script>
        $(document).ready(function() {
            localizeDates();

            $.CouchApp(function(app) {
                if (app.is_logged()) {
                    $("#adminheader").html('<p><a href="<%= editPath %>">Edit</a>'
                    +'</p>');
                }
                var docid = document.location.pathname.split('/').pop();
                var B = new Blog(app);
                function displayComments() {
                    app.design.view("comments", {
                    startkey: [docid],
                    endkey: [docid, {}],
                    reduce : false,
                    success: function(json) {
                        var ol = $("#comments ol");
                        for (var i=0; i < json.rows.length; i++) {
                            var c = json.rows[i].value;
                        ol.append(B.commentListing(c));
                        }
                        $('#comments').fadeIn(2000);      
                    }
                    });
                };
              
              displayComments();
              localizeDates();

              var commentForm = app.docForm("form#new-comment", {
                fields : [
                  "commenter-name", 
                  "commenter-email", 
                  "commenter-url", 
                  "comment"
                ],
                template : {
                  doc_type : "comment",
                  post_id : docid,
                  format : "markdown"
                },
                beforeSave : function(doc) {
                    if (doc.comment)
                        doc.html = B.formatBody(doc.comment);
                  doc.created_at = new Date().rfc3339();
                },
                success : function(resp, doc) {
                  if (doc.commenter.email) { 
                        doc.commenter.gravatar = hex_md5(doc.commenter.email);
                  } else {
                    doc.commenter.gravatar = null;
                  }
                  $("#new-comment").html("<h3>votre commentaire vient d'être ajouté.</h3>");
                  $("#comments ol").append(B.commentListing(doc));
                  $("#comments ol li:last").hide().fadeIn(2000);
                }
              });
              
              $("#preview").click(function() {
                var doc = commentForm.localDoc();
                if (typeof doc.comment != "undefined" && doc.comment) {
                    var html = B.formatBody(doc.comment);
                    $('#comment-preview').html(html);
                }
              });
            });
        });

    </script>
</html>