view bitsyblog/templates/blog.html @ 24:7505329b3134

fix nlinks issue
author k0s <k0scist@gmail.com>
date Sat, 31 Oct 2009 00:22:26 -0400
parents e5cbc53cacf8
children 62c961bb91e6
line wrap: on
line source

<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:py="http://genshi.edgewall.org/"
      xmlns:xi="http://www.w3.org/2001/XInclude">

  <head>
    <title>${user} - ${site_name}</title>

    <py:for each="index, (href, sheet) in enumerate(stylesheets)">
      <link href="${href}"
            type="text/css" 
            rel="${index and 'alternate stylesheet' or 'stylesheet'}"
            title="${sheet}"/>
    </py:for>

  </head>

  <body>
    
    <xi:include href="navigation.html" />
      
    <!-- blog navigation -->
    <div class="navigation"
         py:if="n_links and len(blog) &gt; 1"
         py:with="_n_links = (n_links != -1) and n_links or len(blog)">
      <ul>
        <li py:for="index in range(_n_links)"
            py:with="synopsis = blog[index].title()">
          <a href="#${blog[index].datestamp()}">${blog[index].date.strftime(date_format)}</a><py:if test="synopsis">: ${synopsis}</py:if>
        </li>
      </ul>
      <a py:if="_n_links != len(blog)" href="${request.path}?n=all">more</a>
    </div>

    <!-- blog entries -->
    <div py:for="entry in blog"
         id="${entry.datestamp()}" class="blog-entry">
      <a name="${entry.datestamp()}" />
      
      <div class="subject">
        <a href="${user_url(request, request.user.name, entry.datestamp())}">${subject % dict(date=entry.date.strftime(date_format))}</a>
        <em py:if="entry.privacy == 'secret' and role == 'friend'">
          secret
        </em>
      </div>
        
      ${entry.cooked_body}
      
      <div py:if="role == 'author'">

        <!-- privacy settings -->
        <form action="TODO" method="post">
          <span title="viewable to everyone">
            public
            <input type="radio" name="privacy" value="public" 
                   py:attrs="{'checked': entry.privacy=='public' and True or None}"/>
          </span> 
          <span title="viewable only to your friends">
            secret
            <input type="radio" name="privacy" value="secret" 
                   py:attrs="{'checked': entry.privacy=='secret' and True or None}"/>
          </span> 
          <span title="viewable only to you">
            private
            <input type="radio" name="privacy" value="private"
                   py:attrs="{'checked': entry.privacy=='private' and True or None}"/>
          </span>
          <input type="submit" name="submit" value="Change Privacy" />
        </form>

        <!-- mangled URL -->
        <div py:if="entry.privacy != 'public'"
             py:with="mangled_url = mangledurl(request, entry)">
          <span title="${'You can give this URL so people may see this %s post without logging in' % entry.privacy}">Mangled URL:</span>
          <a href="${mangled_url}">${mangled_url}</a>
        </div>
      </div>
      
    </div><!-- blog-entry -->

  </body>

</html>