Changeset 72
- Timestamp:
- 04/06/08 16:30:54 (5 months ago)
- Files:
-
- bitstructures/trunk/css/bitstructures.css (modified) (6 diffs)
- bitstructures/trunk/substructure/urls.py (modified) (1 diff)
- bitstructures/trunk/substructure/views.py (modified) (3 diffs)
- bitstructures/trunk/templates/substructure/all.html (added)
- bitstructures/trunk/templates/substructure/base.html (modified) (1 diff)
- bitstructures/trunk/templates/substructure/blog.html (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
bitstructures/trunk/css/bitstructures.css
r44 r72 9 9 #nameplate-container { 10 10 margin: 0; 11 padding: 24px 0 16px 24px;11 padding: 24px 0 16px 32px; 12 12 background-color: #ffde00; 13 13 } … … 26 26 27 27 #container { 28 max-width: 6 4em;28 max-width: 67em; 29 29 } 30 30 … … 35 35 36 36 #content { 37 padding: 0 24px 48px 24px;37 padding: 0 32px 48px 32px; 38 38 } 39 39 … … 43 43 44 44 #info-block { 45 padding: 0 24px 0 0;45 padding: 0 32px 0 0; 46 46 } 47 47 48 .info-entry { 49 padding: 24px 0 0 0; 50 } 51 52 .entry { 48 .entry, .info-entry, .page-nav { 53 49 padding: 24px 0 0 0; 54 50 } … … 62 58 } 63 59 64 h2 a {60 .entry h2 a { 65 61 text-decoration: none; 66 62 font-weight: bold; … … 68 64 } 69 65 70 h2 a:hover {66 .entry h2 a:hover { 71 67 text-decoration: none; 72 68 background-color: #82993d; 73 69 color: white; 70 } 71 72 .page-nav { 73 font-size: 1.2em; 74 font-weight: bold; 75 margin: 0; 76 color: #777; 74 77 } 75 78 bitstructures/trunk/substructure/urls.py
r25 r72 8 8 (r'^drafts/(?P<slug>[a-z0-9-]+)$', 'draft_page'), 9 9 (r'^drafts/(?P<slug>[a-z0-9-]+)/(?P<num>\d+)/(?P<filename>[a-zA-Z0-9-_\.]+)$', 'draft_codeblock'), 10 (r'^fb-atom.xml$', 'atom_feed') 10 (r'^fb-atom.xml$', 'atom_feed'), 11 (r'^all$', 'all') 11 12 ) 12 13 bitstructures/trunk/substructure/views.py
r42 r72 7 7 from bitstructures.substructure.codeblocks import MarkdownCodeblocksParser 8 8 9 DEFAULT_SUBSTRUCTURE_NUM_ENTRIES_PER_PAGE = 5 10 9 11 def blog(request): 12 page = 1 13 if ('page' in request.GET) and (int(request.GET['page']) > 0): 14 page = int(request.GET['page']) 15 if settings.SUBSTRUCTURE_NUM_ENTRIES_PER_PAGE: 16 num_entries_per_page = settings.SUBSTRUCTURE_NUM_ENTRIES_PER_PAGE 17 else: 18 num_entries_per_page = DEFAULT_SUBSTRUCTURE_NUM_ENTRIES_PER_PAGE 19 skip = (page - 1) * num_entries_per_page 20 skip_to = skip + num_entries_per_page 10 21 data = get_context_data(request) 11 data['entry_list'] = Entry.objects.filter(date_published__isnull=False).order_by('-date_published') 22 data['entry_list'] = get_published_entries().order_by('-date_published')[skip:skip_to] 23 data['next_page'] = skip_to < data['num_published_entries'] 24 data['next_page_num'] = page + 1 25 data['previous_page'] = page > 1 26 data['previous_page_first_page'] = page == 2 27 data['previous_page_num'] = page - 1 12 28 return render_to_response('substructure/blog.html', data) 13 29 … … 72 88 return HttpResponse(t.render(c), mimetype='application/atom+xml') 73 89 90 def all(request): 91 data = get_context_data(request) 92 data['entry_list'] = get_published_entries().order_by('-date_published') 93 return render_to_response('substructure/all.html', data) 94 95 def get_published_entries(): 96 return Entry.objects.filter(date_published__isnull=False) 97 74 98 def redirect_to_feedburner(request): 75 99 return HttpResponseRedirect(settings.SUBSTRUCTURE_FEEDBURNER_REDIRECT_URL) … … 77 101 def get_context_data(request): 78 102 data = { 'MEDIA_URL': settings.MEDIA_URL } 103 data['num_published_entries'] = get_published_entries().count() 79 104 if user_can_change_entry(request): 80 105 data['user_can_change_entry'] = True bitstructures/trunk/templates/substructure/base.html
r41 r72 38 38 39 39 <div class="info-entry"> 40 <h2>Starting points</h2> 41 <ul> 42 <li><a href="/all">All entries</a> ({{ num_published_entries }})</li> 43 </ul> 44 </div> 45 46 <div class="info-entry"> 40 47 <h2>Colophon</h2> 41 48 <p>This site is running a bitstructures/trunk/templates/substructure/blog.html
r2 r72 7 7 {% endfor %} 8 8 9 <div class="page-nav">{% if previous_page %}<a href="/{% if not previous_page_first_page %}?page={{ previous_page_num }}{% endif %}">« newer</a>{% else %}« newer{% endif %} 10 | {% if next_page %}<a href="/?page={{ next_page_num }}">older »</a>{% else %}older »{% endif %}</div> 11 9 12 {% endblock %}
