Skip to content
This repository has been archived by the owner on Oct 25, 2018. It is now read-only.

Commit

Permalink
Added a SHOW_VIEWS_ON_HOMEPAGE setting which does what it says on the…
Browse files Browse the repository at this point in the history
… tin.
  • Loading branch information
orf committed Oct 3, 2012
1 parent cff0b45 commit d3c7705
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions create_config.py
Expand Up @@ -12,6 +12,7 @@ def input_with_default(prompt, default):
SETTINGS = ( SETTINGS = (
input_with_default("Posts per page", 5), input_with_default("Posts per page", 5),
input_with_default("Show the post content on the homepage","y").lower()[0] == "y", input_with_default("Show the post content on the homepage","y").lower()[0] == "y",
input_with_default("Show post view count on the homepage?","n").lower()[0] == "y",
input_with_default("Admin username","admin"), input_with_default("Admin username","admin"),
generate_password_hash(input_with_default("Admin password","password")), generate_password_hash(input_with_default("Admin password","password")),
input_with_default("Google analytics ID",""), input_with_default("Google analytics ID",""),
Expand All @@ -28,6 +29,7 @@ def input_with_default(prompt, default):
fd.write("""# -*- coding: utf-8 -*-\n fd.write("""# -*- coding: utf-8 -*-\n
POSTS_PER_PAGE = %s POSTS_PER_PAGE = %s
POST_CONTENT_ON_HOMEPAGE = %s POST_CONTENT_ON_HOMEPAGE = %s
SHOW_VIEWS_ON_HOMEPAGE = %s
ADMIN_USERNAME = '%s' ADMIN_USERNAME = '%s'
ADMIN_PASSWORD = '%s' ADMIN_PASSWORD = '%s'
ANALYTICS_ID = '%s' ANALYTICS_ID = '%s'
Expand Down
3 changes: 2 additions & 1 deletion templates/index.html
Expand Up @@ -16,7 +16,8 @@ <h1><a href="{{ url_for('view_post_slug', slug=post.slug, pid=current_page) }}">
<br/> <br/>
{{ post.render_content()|safe }} {{ post.render_content()|safe }}
{% else %} {% else %}
<p style="color: #999;">Posted: {{ post.created_at.strftime('%B %d, %Y') }}, viewed {{ post.views }} times</p> <p style="color: #999;">Posted: {{ post.created_at.strftime('%B %d, %Y') }}
{% if config.get('SHOW_VIEWS_ON_HOMEPAGE',False) %}, viewed {{ post.views }} times{% endif %}</p>
{% endif %} {% endif %}
</section> </section>
</div> </div>
Expand Down

0 comments on commit d3c7705

Please sign in to comment.