Permalink
Browse files

New Sidebar Blocks Configuration mechanism. A bit more verbose, but m…

…ore flexible. The 'default' Theme is being adapted to support it.
  • Loading branch information...
1 parent c2d3579 commit 5e59541483d7732f31aa505f849e3965b64b156d @detro committed Sep 9, 2010
View
@@ -21,17 +21,61 @@
# day - the day the post was published in
post_path_format = '/%(year)d/%(month)02d/%(slug)s'
-# A nested list of sidebar menus, for convenience. If this isn't versatile
-# enough, you can edit themes/default/base.html instead.
-sidebars = [
- ('Blogroll', [
- '<a href="http://blog.notdot.net/">Nick Johnsonz</a>',
- '<a href="http://www.billkatz.com/">Bill Katz</a>',
- '<a href="http://www.codinghorror.com/blog/">Coding Horror</a>',
- '<a href="http://craphound.com/">Craphound</a>',
- '<a href="http://www.neopythonic.blogspot.com/">Neopythonic</a>',
- '<a href="http://www.schneier.com/blog/">Schneier on Security</a>',
- ]),
+# Sidebar configuration.
+# It is a sequence of DIV Blocks with various types of content supported.
+# The format is an array of Dictionary like:
+# [
+# {
+# 'enabled' : True (absent or set to False will make the Section disappear) ,
+# 'type' : 'links' (just a set of links)
+# or 'gfc' (Google Friends Connect Widget)
+# or 'twitter' (Twitter Widget)
+# or 'code' (Generic HTML Code Block: stuff like Ads or Licenses),
+# 'title' : Title to give to this Section in the Sidebar ,
+# TYPE-SPECIFIC key-values (see examples below) ,
+# },
+# ...
+# ]
+# More can be supported easily, tweaking the theme. Or just using the block of type 'code'.
+sidebar_blocks = [
+ # Block of Links
+ {
+ 'enabled' : True,
+ 'type' : 'links',
+ 'title' : 'Blogroll',
+ 'links' : [
+ { 'title' : 'Nick Johnsonz', 'url' : 'http://blog.notdot.net/', 'external' : True, 'rel' : 'bookmark' },
+ { 'title' : 'Bill Katz', 'url' : 'http://www.billkatz.com/', 'external' : True, 'rel' : 'bookmark' },
+ { 'title' : 'Coding Horror', 'url' : 'http://www.codinghorror.com/blog/', 'external' : True, 'rel' : 'bookmark' },
+ { 'title' : 'Craphound', 'url' : 'http://craphound.com/', 'external' : True, 'rel' : 'bookmark' },
+ { 'title' : 'Neopythonic', 'url' : 'http://www.neopythonic.blogspot.com/', 'external' : True, 'rel' : 'bookmark' },
+ { 'title' : 'Schneier on Security', 'url' : 'http://www.schneier.com/blog/', 'external' : True, 'rel' : 'bookmark' },
+ ]
+ },
+ # Google Friends Connect Widget
+ {
+ 'enabled' : False,
+ 'type' : 'gfc',
+ 'title' : 'Members',
+ 'id' : None, # Google Friends Connect ID
+ 'nrows' : 4 # Number of Rows in the Widget
+ },
+ # Twitter Widget
+ {
+ 'enabled' : True,
+ 'type' : 'twitter',
+ 'title' : 'Twitter',
+ 'username' : 'nicksdjohnson', # Twitter Username
+ 'ntweets' : 5, # Number of Tweets to Show
+ 'height' : 500 # Widget Height (='ntweets * 100' is adviced)
+ },
+ # An HTML Code Block (this license one is a good example)
+ {
+ 'enabled' : True,
+ 'type' : 'code',
+ 'title' : 'License',
+ 'path' : '../../custom_blocks/license.html', # Path to any custom HTML Code that you want to include
+ },
]
# Number of entries per page in indexes.
@@ -84,13 +128,6 @@
# For use a feed proxy like feedburne.google.com
feed_proxy = None
-# To use Google Friends Connect.
-# If you want use Google Friends Connect, go to http://www.google.com/friendconnect/
-# and register your domain for get a Google Friends connect ID.
-google_friends_id = None
-google_friends_comments = True # For comments.
-google_friends_members = True # For a members container.
-
# To format the date of your post.
# http://docs.djangoproject.com/en/1.1/ref/templates/builtins/#now
date_format = "d F, Y"
@@ -0,0 +1,3 @@
+<div style="text-align: center;">
+<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons Licence" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br />This <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" rel="dc:type">work</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.
+</div>
View
@@ -27,6 +27,7 @@
{% block head %}{% endblock %}
</head>
<body>
+ <!-- Header Start -->
<div id="header-wrap"><div id="header" class="container_16">
<h1 id="logo-text"><a href="{{config.url_prefix}}/" title="">{{config.blog_name}}</a></h1>
<p id="intro">{{config.slogan}}</p>
@@ -49,56 +50,42 @@ <h1 id="logo-text"><a href="{{config.url_prefix}}/" title="">{{config.blog_name}
</form>
<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form=quick-search&lang=en"></script>
</div></div>
+ <!-- Header End -->
+
+ <!-- Content Start -->
<div id="content-outer"><div id="content-wrapper" class="container_16">
<div id="main" class="grid_12">
{% block body %}{% endblock %}
</div>
<div id="left-columns" class="grid_4">
- {% for sidebar in config.sidebars %}
- <div class="sidemenu">
- <h3>{{sidebar.0}}</h3>
- <ul>
- {% for entry in sidebar.1 %}
- <li>{{entry}}</li>
+ {% for block in config.sidebar_blocks %}
+ {% if block.enabled %}
+ <div class="sidemenu">
+ {% ifequal block.type 'links' %}
+ <h3>{% if block.title %}{{ block.title }}{% else %}Links{% endif %}</h3>
+ {% include "links_block.html" %}
+ {% endifequal %}
+ {% ifequal block.type 'gfc' %}
+ <h3>{% if block.title %}{{ block.title }}{% else %}Members{% endif %}</h3>
+ {% include "google_friends_connect_block.html" %}
+ {% endifequal %}
+ {% ifequal block.type 'twitter' %}
+ <h3>{% if block.title %}{{ block.title }}{% else %}Twitter{% endif %}</h3>
+ {% include "twitter_block.html" %}
+ {% endifequal %}
+ {% ifequal block.type 'code' %}
+ <h3>{% if block.title %}{{ block.title }}{% else %}Code Block{% endif %}</h3>
+ {% include block.path %}
+ {% endifequal %}
+ </div>
+ {% endif %}
{% endfor %}
- </ul>
- </div>
- {% endfor %}
-
- {% if config.google_friends_id and config.google_friends_members %}
- <div class="sidemenu">
- <h3>Members</h3>
- <!-- Define the div tag where the gadget will be inserted. -->
- <div id="div-1279810020886984279" style=""></div>
- <!-- Render the gadget into a div. -->
- <script type="text/javascript">
- var skin = {};
- skin['BORDER_COLOR'] = '#cccccc';
- skin['ENDCAP_BG_COLOR'] = '#fff';
- skin['ENDCAP_TEXT_COLOR'] = '#444';
- skin['ENDCAP_LINK_COLOR'] = '#0000cc';
- skin['ALTERNATE_BG_COLOR'] = '#ffffff';
- skin['CONTENT_BG_COLOR'] = '#ffffff';
- skin['CONTENT_LINK_COLOR'] = '#000';
- skin['CONTENT_TEXT_COLOR'] = '#666';
- skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
- skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
- skin['CONTENT_HEADLINE_COLOR'] = '#666';
- skin['NUMBER_ROWS'] = '4';
- google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);
- google.friendconnect.container.renderMembersGadget(
- { id: 'div-1279810020886984279',
- site: '{{ config.google_friends_id }}'
- }, skin);
- </script>
- </div>
- {% endif %}
-
-
-
-
- </div>
+ </div>
+
</div></div>
+ <!-- Content End -->
+
+ <!-- Footer Start -->
<div id="footer-wrapper" class="container_16">
<div id="footer-bottom">
<p class="bottom-left">
@@ -118,6 +105,8 @@ <h1 id="logo-text"><a href="{{config.url_prefix}}/" title="">{{config.blog_name}
</p>
</div>
</div>
+ <!-- Footer End -->
+
{% if config.analytics_id and not devel and not is_admin %}
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
@@ -0,0 +1,23 @@
+<!-- Define the div tag where the gadget will be inserted. -->
+<div id="div-1279810020886984279" style=""></div>
+<!-- Render the gadget into a div. -->
+<script type="text/javascript">
+ var skin = {};
+ skin['BORDER_COLOR'] = '#cccccc';
+ skin['ENDCAP_BG_COLOR'] = '#fff';
+ skin['ENDCAP_TEXT_COLOR'] = '#444';
+ skin['ENDCAP_LINK_COLOR'] = '#0000cc';
+ skin['ALTERNATE_BG_COLOR'] = '#ffffff';
+ skin['CONTENT_BG_COLOR'] = '#ffffff';
+ skin['CONTENT_LINK_COLOR'] = '#000';
+ skin['CONTENT_TEXT_COLOR'] = '#666';
+ skin['CONTENT_SECONDARY_LINK_COLOR'] = '#7777cc';
+ skin['CONTENT_SECONDARY_TEXT_COLOR'] = '#666666';
+ skin['CONTENT_HEADLINE_COLOR'] = '#666';
+ skin['NUMBER_ROWS'] = '{{ block.nrows }}';
+ google.friendconnect.container.setParentUrl('/' /* location of rpc_relay.html and canvas.html */);
+ google.friendconnect.container.renderMembersGadget(
+ { id: 'div-1279810020886984279',
+ site: '{{ block.id }}'
+ }, skin);
+</script>
@@ -0,0 +1,9 @@
+<ul>
+ {% for link in block.links %}
+ <li>
+ <a rel="{{ link.rel }}{% if link.external %} external{% endif %}"
+ target="{% if link.external %}_blank{% else %}_self{% endif %}"
+ href="{{ link.url }}">{{ link.title }}</a>
+ </li>
+ {% endfor %}
+</ul>
@@ -0,0 +1,32 @@
+<!-- Twitter Widget -->
+<script src="http://widgets.twimg.com/j/2/widget.js"></script>
+<script>
+new TWTR.Widget({
+ version: 2,
+ type: 'profile',
+ rpp: {{ block.ntweets }},
+ interval: 6000,
+ width: 'auto',
+ height: {{ block.height }},
+ theme: {
+ shell: {
+ background: '#f8f8f8',
+ color: '#666666'
+ },
+ tweets: {
+ background: '#ffffff',
+ color: '#666666',
+ links: '#ae855c'
+ }
+ },
+ features: {
+ scrollbar: true,
+ loop: false,
+ live: true,
+ hashtags: true,
+ timestamp: true,
+ avatars: false,
+ behavior: 'all'
+ }
+}).render().setUser('{{ block.username }}').start();
+</script>

0 comments on commit 5e59541

Please sign in to comment.