diff options
author | Tom Willemsen | 2012-03-10 14:02:59 +0100 |
---|---|---|
committer | Tom Willemsen | 2012-03-10 14:02:59 +0100 |
commit | 63d1ed7d192e2e17665add4f70dca10c2681d704 (patch) | |
tree | ecf583a24eeecc98d1b5428ce1a9a0ad15fb7c83 | |
parent | ca93d7a2d20f2044bfe3a15ecd43160ba84d7ad2 (diff) | |
download | ryuslash.org-63d1ed7d192e2e17665add4f70dca10c2681d704.tar.gz ryuslash.org-63d1ed7d192e2e17665add4f70dca10c2681d704.zip |
Add a little 'design' to the site
-rw-r--r-- | aggregator/fixtures/initial_data.json | 18 | ||||
-rw-r--r-- | aggregator/models.py | 6 | ||||
-rw-r--r-- | aggregator/views.py | 8 | ||||
-rw-r--r-- | settings.py | 6 | ||||
-rw-r--r-- | static/logo.png | bin | 0 -> 15931 bytes | |||
-rw-r--r-- | static/main.css | 113 | ||||
-rw-r--r-- | templates/aggregator/posts.html | 90 | ||||
-rw-r--r-- | urls.py | 8 |
8 files changed, 194 insertions, 55 deletions
diff --git a/aggregator/fixtures/initial_data.json b/aggregator/fixtures/initial_data.json index 58fb2d4..a9a83df 100644 --- a/aggregator/fixtures/initial_data.json +++ b/aggregator/fixtures/initial_data.json @@ -7,7 +7,6 @@ "base_url": "http://www.advogato.org/", "feed_url": "person/ryuslash/rss.xml", "profile_url": "person/ryuslash", - "uses_title": false, "favicon_ext": "ico" } }, @@ -19,8 +18,6 @@ "base_url": "http://diasp.org/", "feed_url": "public/ryuslash.atom", "profile_url": "public/ryuslash", - "uses_title": false, - "favicon_ext": "png", "br2nl": true } }, @@ -32,7 +29,6 @@ "base_url": "http://identi.ca/", "feed_url": "api/statuses/user_timeline/107950.rss", "profile_url": "ryuslash", - "uses_title": false, "favicon_ext": "ico" } }, @@ -43,9 +39,17 @@ "name": "Github", "base_url": "https://github.com/", "feed_url": "ryuslash.atom", - "profile_url": "ryuslash", - "uses_title": true, - "favicon_ext": "png" + "profile_url": "ryuslash" + } + }, + { + "model": "aggregator.Feed", + "pk": 5, + "fields": { + "name": "Gitorious", + "base_url": "https://gitorious.org/", + "feed_url": "~ryuslash/feed.atom", + "profile_url": "~ryuslash" } } ] diff --git a/aggregator/models.py b/aggregator/models.py index 3825d69..6bc6d1a 100644 --- a/aggregator/models.py +++ b/aggregator/models.py @@ -20,6 +20,9 @@ class Feed(models.Model): def get_favicon_url(self): return self.base_url + 'favicon.' + self.favicon_ext + class Meta: + ordering = [ '-updated' ] + class Post(models.Model): post_id = models.CharField(max_length=500, unique=True) title = models.CharField(max_length=500) @@ -28,3 +31,6 @@ class Post(models.Model): updated = models.DateTimeField() added = models.DateTimeField(auto_now_add=True) feed = models.ForeignKey(Feed) + + class Meta: + ordering = [ '-updated' ] diff --git a/aggregator/views.py b/aggregator/views.py index c946c31..b0fdf3b 100644 --- a/aggregator/views.py +++ b/aggregator/views.py @@ -2,10 +2,11 @@ from django.core.paginator import Paginator, InvalidPage, EmptyPage from django.http import Http404 from django.shortcuts import render_to_response -from .models import Post +from .models import Post, Feed def posts(request, page=1): - queryset = Post.objects.order_by('-updated') + queryset = Post.objects.all() + feeds = Feed.objects.all() paginator = Paginator(queryset, 20) if page == None: @@ -17,4 +18,5 @@ def posts(request, page=1): raise Http404 return render_to_response('aggregator/posts.html', - { 'list': object_list }) + { 'list': object_list, + 'feeds': feeds }) diff --git a/settings.py b/settings.py index 2a0cf36..b46918e 100644 --- a/settings.py +++ b/settings.py @@ -73,11 +73,7 @@ STATIC_URL = '/static/' ADMIN_MEDIA_PREFIX = '/static/admin/' # Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) +STATICFILES_DIRS = [ '%s/static' % DEPLOY_PATH ] # List of finder classes that know how to find static files in # various locations. diff --git a/static/logo.png b/static/logo.png Binary files differnew file mode 100644 index 0000000..a451578 --- /dev/null +++ b/static/logo.png diff --git a/static/main.css b/static/main.css new file mode 100644 index 0000000..243431d --- /dev/null +++ b/static/main.css @@ -0,0 +1,113 @@ +* { + padding: 0; + margin: 0; + border: 0; +} + +a { + text-decoration: none; + color: #bbbbbb; +} + +a:hover { + text-decoration: underline; +} + +body { + background-color: #000000; + font-family: "DejaVu Sans", sans-serif; +} + +.post { + background-color: #808080; + padding: 5px; + border: 1px #505050 solid; + margin-bottom: 15px; + color: #000000; +} + +.post .posttitle { + margin-bottom: 10px; +} + +#logo { + float: left; +} + +#sitetitle { + background-color: #000000; + color: #ffffff; + height: 70px; + line-height: 70px; +} + +#sitetitle #blue { + color: #4169E1; + position: relative; + top: -5px; +} + +#sitetitle #orange { + color: #ff9800; + position: relative; + top: 5px; +} + +#sitesubtitle { + background-color: #404040; + color: #dddddd; + text-align: right; + height: 30px; + line-height: 30px; + border-top: 1px #808080 solid; +} + +#content { + width: 750px; + margin: 0 auto; + color: #ffffff; + margin-top: 2px; +} + +#content h2 { + margin-bottom: 3px; +} + +#feeds { + float: right; + background-color: #404040; +} + +#feeds a { + color: #dddddd; + display: block; + padding: 5px; + text-decoration: none; +} + +#feeds a:hover { + background-color: #dddddd; + color: #404040; +} + +#pager { + background-color: #808080; + color: #000000; + padding: 0 5px; + position: relative; +} + +#pager #previous { + position: absolute; + left: 5px; +} + +#pager #next { + float: right; + position: absolute; + right: 5px; +} + +#pager #current { + text-align: center; +} diff --git a/templates/aggregator/posts.html b/templates/aggregator/posts.html index 94b9626..aef81d0 100644 --- a/templates/aggregator/posts.html +++ b/templates/aggregator/posts.html @@ -1,51 +1,69 @@ +<!DOCTYPE html> + <html> <head> - <title>ryuslash.org</title> + <title>ryuslash</title> + <link href="/static/main.css" type="text/css" rel="stylesheet" /> </head> <body> - {% for post in list.object_list %} - <p> - <div> - <a href="{{ post.remote_url }}"> - <img src="{{ post.feed.get_favicon_url }}" /> - {{ post.updated }} - </a> - </div> - {% if post.feed.uses_title %} - <div>{{ post.title }}</div> - {% endif %} + <img src="/static/logo.png" id="logo"> - {% autoescape off %} - {% if post.feed.br2nl %} - {{ post.body|linebreaks }} - {% else %} - {{ post.body }} - {% endif %} - {% endautoescape %} - <div> - Through: - <a href="{{ post.feed.get_profile_url }}"> - {{ post.feed.name|lower }} - </a> - </div> - </p> - {% endfor %} + <h1 id="sitetitle"><span id="blue">ryu</span><span id="orange">slash</span></h1> + <div id="sitesubtitle">Will this ever really be my website?</div> + + <div id="feeds"> + {% for feed in feeds %} + <a href="{{ feed.get_profile_url }}"> + <img src="{{ feed.get_favicon_url }}"> + {{ feed.name }} + </a> + {% endfor %} + </div> + + <div id="content"> + {% regroup list.object_list by updated.date as grouped_list %} + {% for group in grouped_list %} + <h2>{{ group.grouper }}</h2> - <div class="pagination"> - <span class="step-links"> + {% for post in group.list %} + <div class="post {{ post.feed.name|slugify }}"> + <div class="posttitle"> + <a href="{{ post.feed.get_profile_url }}"><img src="{{ post.feed.get_favicon_url }}" /></a> + <a href="{{ post.remote_url }}"> + {% if post.feed.uses_title %} + {{ post.title }} + {% else %} + {{ post.updated }} + {% endif %} + </a> + </div> + + {% autoescape off %} + {% if post.feed.br2nl %} + {{ post.body|linebreaks }} + {% else %} + {{ post.body }} + {% endif %} + {% endautoescape %} + </div> + {% endfor %} + {% endfor %} + + <div id="pager"> {% if list.has_previous %} - <a href="/{{ list.previous_page_number }}/">previous</a> + <a href="/{{ list.previous_page_number }}/" id="previous">previous</a> {% endif %} - <span class="current"> - Page {{ list.number }} of {{ list.paginator.num_pages }}. - </span> - {% if list.has_next %} - <a href="/{{ list.next_page_number }}/">next</a> + <a href="/{{ list.next_page_number }}/" id="next">next</a> {% endif %} - </span> + + <div id="current"> + {{ list.number }} / {{ list.paginator.num_pages }} + </div> + + </div> </div> </body> </html> @@ -1,11 +1,11 @@ from django.conf.urls.defaults import patterns, include, url +from django.contrib.staticfiles.urls import staticfiles_urlpatterns -# Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^((?P<page>\d+)/)?$', 'aggregator.views.posts'), - # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - url(r'^admin/', include(admin.site.urls)), -) + url(r'^admin/', include(admin.site.urls))) + +urlpatterns += staticfiles_urlpatterns() |