Merge pull request #198 from kylef/page

Remove WITH_PAGINATION, only have a DEFAULT_PAGINATION setting
This commit is contained in:
Alexis Metaireau 2011-12-22 09:09:35 -08:00
commit b3b0af5a45
5 changed files with 10 additions and 11 deletions

View file

@ -160,9 +160,9 @@ Setting name (default value) what does it do?
`DEFAULT_ORPHANS` (0) The minimum number of articles allowed on the
last page. Use this when you don't want to
have a last page with very few articles.
`DEFAULT_PAGINATION` (5) The maximum number of articles to include on a
page, not including orphans.
`WITH_PAGINATION` (``False``) Activate pagination.
`DEFAULT_PAGINATION` (False) The maximum number of articles to include on a
page, not including orphans. False to disable
pagination.
================================================ =====================================================
Tag cloud

View file

@ -38,8 +38,7 @@ _DEFAULT_CONFIG = {'PATH': None,
'DATE_FORMATS': {},
'JINJA_EXTENSIONS': [],
'LOCALE': '', # default to user locale
'WITH_PAGINATION': False,
'DEFAULT_PAGINATION': 5,
'DEFAULT_PAGINATION': False,
'DEFAULT_ORPHANS': 0,
'DEFAULT_METADATA': (),
'FILES_TO_COPY': (),

View file

@ -1,4 +1,4 @@
{% if WITH_PAGINATION %}
{% if DEFAULT_PAGINATION %}
<p class="paginator">
{% if articles_page.has_previous() %}
{% if articles_page.previous_page_number() == 1 %}
@ -12,4 +12,4 @@
<a href="{{ SITEURL }}/{{ page_name }}{{ articles_page.next_page_number() }}.html">&raquo;</a>
{% endif %}
</p>
{% endif %}
{% endif %}

View file

@ -127,7 +127,7 @@ class Writer(object):
for key in paginated.iterkeys():
object_list = paginated[key]
if self.settings.get('WITH_PAGINATION'):
if self.settings.get('DEFAULT_PAGINATION'):
paginators[key] = Paginator(object_list,
self.settings.get('DEFAULT_PAGINATION'),
self.settings.get('DEFAULT_ORPHANS'))

View file

@ -86,7 +86,6 @@ SOCIAL = (
('You can add links in your config file', '#'),
)
WITH_PAGINATION = $with_pagination
DEFAULT_PAGINATION = $default_pagination
@ -104,7 +103,6 @@ CONF = {
'ssh_user': 'root',
'ssh_target_dir': '/var/www',
'dropbox_dir' : '~/Dropbox/Public/',
'with_pagination' : True,
'default_pagination' : 7,
'lang': 'en'
}
@ -221,10 +219,12 @@ Please answer the following questions so this script can generate the files need
CONF['author'] = ask('Who will be the author of this Web site ?', answer=str, default=args.author)
CONF['lang'] = ask('What will be the default language of this Web site ?', str, args.lang or CONF['lang'], 2)
CONF['with_pagination'] = ask('Do you want to enable article pagination ?', bool, CONF['with_pagination'])
CONF['with_pagination'] = ask('Do you want to enable article pagination ?', bool, bool(CONF['default_pagination']))
if CONF['with_pagination']:
CONF['default_pagination'] = ask('So how many articles per page do you want ?', int, CONF['default_pagination'])
else:
CONF['default_pagination'] = False
mkfile = ask('Do you want to generate a Makefile to easily manage your website ?', bool, True)