view bitsyblog/templates/blog.html @ 35:7e7fbdc64cc1

enable atom support, this brings us to 2.0
author k0s <k0scist@gmail.com>
date Sun, 01 Nov 2009 13:30:18 -0500
parents 89f5158ef191
children
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>

    <!-- stylesheets -->
    <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>

    <!-- feeds -->
    <link rel="alternate" type="application/rss+xml" title="blog - ${user} - RSS" href="${user_url(request, user, 'rss')}"/>
    <link rel="alternate" type="application/atom+xml" title="blog - ${user} - Atom" href="${user_url(request, user, 'atom')}"/>
  </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 min(n_links,len(blog)) 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"
         py:with="datestamp=entry.datestamp(); url=user_url(request, request.user.name, datestamp)"
         id="${entry.datestamp()}" 
         class="blog-entry">
      <a name="${entry.datestamp()}" />
      
      <div class="subject">
        <a href="${url}">${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="${url}" 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>