Zine

open source content publishing system


Changeset 1349:632fc46fa6fb


Ignore:
Timestamp:
05/15/10 02:03:34 (2 years ago)
Author:
Mike Crute <mcrute@…>
Branch:
default
Message:

Ticket 179: PagesNavigation? widget

Location:
zine
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • zine/templates/widgets/pages_navigation.html

    r465 r1349  
    33{% block body %} 
    44  {%- if widget.pages %} 
    5   <ul class="pages_navigation"> 
     5  <ul class="pages-navigation"> 
    66  {%- for item in widget.pages %} 
    77    <li><a href="{{ url_for(item)|e }}">{{ item.title|e }}</a></li> 
  • zine/widgets.py

    r1279 r1349  
    119119 
    120120 
     121class PagesNavigation(Widget): 
     122    """Show a list of all pages.""" 
     123 
     124    name = 'pages_navigation' 
     125    template = 'widgets/pages_navigation.html' 
     126 
     127    def __init__(self, show_title=False, show_drafts=False): 
     128        self.pages = Post.query.type('page').published().all() 
     129        if show_drafts: 
     130            self.pages += Post.query.type('page').drafts().all() 
     131        self.show_title = show_title 
     132 
    121133#: list of all core widgets 
    122134all_widgets = [PostArchiveSummary, LatestPosts, LatestComments, TagCloud, 
    123                CategoryList, IncludePage] 
     135               CategoryList, IncludePage, PagesNavigation] 
Note: See TracChangeset for help on using the changeset viewer.