view bitsyblog/templates/blog.html @ 15:36698624435b

blog page mostly works
author k0s <k0scist@gmail.com>
date Sun, 25 Oct 2009 17:25:58 -0400
parents fbf8f198ef67
children 2bd6b2b543dc
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, sheet in enumerate(stylesheets)">
      <link href="${link(request, ('css', sheet))}"
            type="text/css" 
            rel="${index and 'alternate stylesheet' or 'stylesheet'}"
            title="sheet.rsplit('.', 1)[0]"/>
    </py:for>

  </head>

  <body>
    
    <xi:include href="navigation.html" />
      
      <div class="navigation"
           py:if="n_links == 0 or not len(blog)"
           py:with="_n_links = (n_links != -1) and n_links or len(blog)">
        <ul>
          <li py:for="index in range(_n_links)">
          </li>
        </ul>
        <a py:if="_n_links != len(blog)" href="TODO?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>
  </body>

</html>