diff --git a/blogs/templates/blogs/base.html b/blogs/templates/blogs/base.html index 3b76a39..3ec1b20 100644 --- a/blogs/templates/blogs/base.html +++ b/blogs/templates/blogs/base.html @@ -1,5 +1,7 @@ {% extends "base.html" %} +{% load compress %} + {% block meta %} {% if 'page' in request.get_full_path %} @@ -7,16 +9,21 @@ {% endblock %} {% block body-class %}blog-site{% endblock %} +{% block html-class %}blog-site{% endblock %} + +{% block css %} + {% compress css %} + + + + {% endcompress %} +{% endblock %} {% block page-title %}{{ user.username }}'s blog - Powered by Snipt.net{% endblock %} -{% block header %} -
-
-

{{ user.username }}'s blog

-
-
-{% endblock %} +{% block page-description %}{% endblock %} {% block sub-header %}{% endblock %} {% block rochester-made %}{% endblock %} {% block aside %}{% endblock %} +{% block header %}{% endblock %} +{% block keyboard-shortcuts %}{% endblock %} diff --git a/blogs/templates/blogs/homepage.html b/blogs/templates/blogs/homepage.html new file mode 100644 index 0000000..1edb2b1 --- /dev/null +++ b/blogs/templates/blogs/homepage.html @@ -0,0 +1,38 @@ +{% extends "blogs/base.html" %} + +{% load compress pagination_tags %} + +{% block js %} + {{ block.super }} + window.detail = false; +{% endblock %} + +{% block body-class %}{{ block.super }} blog-homepage{% endblock %} + +{% block css %} + {% compress css %} + + + {% endcompress %} +{% endblock %} + +{% block main %} +
+

+ + {% if user.username == 'nick' %} + Nick Sergeant + {% else %} + {{ user.username }} + {% endif %} + +

+ {% if homepage.lexer == 'markdown' %} +
+ {{ homepage.stylized|safe }} +
+ {% else %} + {{ homepage.stylized|safe }} + {% endif %} +
+{% endblock %} diff --git a/blogs/templates/blogs/list.html b/blogs/templates/blogs/list.html index 468259d..81a7ac6 100644 --- a/blogs/templates/blogs/list.html +++ b/blogs/templates/blogs/list.html @@ -7,6 +7,17 @@ window.detail = false; {% endblock %} +{% block header %} +
+

+ + {% if user.username == 'nick' %} + Nick Sergeant{% else %} + {{ user.username }}{% endif %}'s Blog + +

+
+{% endblock %} {% block content %}
{% autopaginate snipts 10 %} diff --git a/blogs/views.py b/blogs/views.py index 84e63b7..2306122 100644 --- a/blogs/views.py +++ b/blogs/views.py @@ -6,11 +6,19 @@ from annoying.decorators import render_to from snipts.models import Snipt -@render_to('blogs/list.html') -def list_blog(request, subdomain): +@render_to('blogs/homepage.html') +def blog_homepage(request, user, homepage): + + context = { + 'homepage': homepage, + 'user': user, + } + + return context + +@render_to('blogs/list.html') +def blog_list(request, user): - subdomain = subdomain.replace('-', '_') - user = get_object_or_404(User, username__iexact=subdomain) snipts = Snipt.objects.filter(user=user, blog_post=True, public=True).order_by('-created') context = { diff --git a/media/css/style.css b/media/css/style.css index e41e281..8284e21 100644 --- a/media/css/style.css +++ b/media/css/style.css @@ -1263,20 +1263,53 @@ body.blog article.snipt section.code { height: auto; } -body.blog-site header.blog div.inner { - border-left: 1px solid rgba(229, 229, 229, 0.25); - margin: 30px auto 0 auto; - width: 939px; +body.blog-site { + color: #B3B3B3; + font: normal 17px/24px "Helvetica Neue", Helvetica, Arial, "Liberation Sans", FreeSans, sans-serif; + margin: 0; } -body.blog-site header.blog div.inner h1 { +body.blog-site section.frame { + margin: 0 auto; + padding-top: 50px; + width: 500px; +} +body.blog-site h1.blog-title { + font-size: 34px; + margin-bottom: 50px; + margin-top: 0; +} +body.blog-site h1.blog-title a { color: #0094AF; - font: normal 34px "Helvetica Neue", Helvetica, Arial, "Liberation Sans", FreeSans, sans-serif; - margin-left: 15px; -} -body.blog-site header.blog div.inner h1 a { - color: #0094AF; -} -body.blog-site header.blog div.inner h1 a:hover { - color: #292929; + font-weight: normal; text-decoration: none; } +body.blog-site a { + color: #898989; +} +body.blog-site a:hover { + color: #292929; +} +body.blog-site header.main { + background: none; + border-bottom: 0; + height: auto; + margin: 0 auto; + width: 940px; +} +body.blog-site header.main h1 { + margin: 0; + padding: 29px 0 0 15px; +} + +body.blog-homepage li { + line-height: 24px; + margin: 5px 0; +} +body.blog-homepage p:last-of-type { + margin: 0; + padding-bottom: 56px; +} +body.blog-homepage img { + display: block; + margin: 53px auto 0 auto; +} diff --git a/media/css/style.scss b/media/css/style.scss index fd42f03..9ece6b9 100644 --- a/media/css/style.scss +++ b/media/css/style.scss @@ -1432,26 +1432,57 @@ body.blog { // Blogs body.blog-site { - header.blog { - div.inner { - border-left: 1px solid rgba(229, 229, 229, .25); - margin: 30px auto 0 auto; - width: 939px; + color: #B3B3B3; + font: normal 17px/24px $Helvetica; + margin: 0; - h1 { - color: #0094AF; - font: normal 34px $Helvetica; - margin-left: 15px; + section.frame { + margin: 0 auto; + padding-top: 50px; + width: 500px; + } + h1.blog-title { + font-size: 34px; + margin-bottom: 50px; + margin-top: 0; - a { - color: #0094AF; + a { + color: #0094AF; + font-weight: normal; + text-decoration: none; + } + } + a { + color: #898989; - &:hover { - color: #292929; - text-decoration: none; - } - } - } + &:hover { + color: #292929; + } + } + header.main { + background: none; + border-bottom: 0; + height: auto; + margin: 0 auto; + width: 940px; + + h1 { + margin: 0; + padding: 29px 0 0 15px; } } } +body.blog-homepage { + li { + line-height: 24px; + margin: 5px 0; + } + p:last-of-type { + margin: 0; + padding-bottom: 56px; + } + img { + display: block; + margin: 53px auto 0 auto; + } +} diff --git a/snipts/urls.py b/snipts/urls.py index d2e1f9f..946427b 100644 --- a/snipts/urls.py +++ b/snipts/urls.py @@ -6,6 +6,7 @@ from snipts import views urlpatterns = patterns('', url(r'^$', views.home, name='home'), url(r'^public/$', views.list_public, name='list-public'), + url(r'^blog/$', views.blog, name='blog'), url(r'^public/tag/(?P[^/]+)/$', views.list_public, name='list-public-tag'), url(r'^embed/(?P[^/]+)/$', views.embed, name='embed'), url(r'^raw/(?P[^/]+)/$', views.raw, name='raw'), diff --git a/snipts/views.py b/snipts/views.py index 5808806..56f56f0 100644 --- a/snipts/views.py +++ b/snipts/views.py @@ -7,7 +7,7 @@ from django.template import RequestContext from annoying.decorators import render_to from snipts.models import Favorite, Snipt from django.db.models import Count -from blogs.views import list_blog +from blogs.views import blog_homepage, blog_list from django.conf import settings from django.db.models import Q from taggit.models import Tag @@ -21,13 +21,28 @@ RESULTS_PER_PAGE = getattr(settings, 'HAYSTACK_SEARCH_RESULTS_PER_PAGE', 20) def home(request): if request.subdomain: - return list_blog(request, request.subdomain) + subdomain = request.subdomain.replace('-', '_') + user = get_object_or_404(User, username__iexact=subdomain) + + try: + homepage = Snipt.objects.get(user=user, title__iexact='Homepage', blog_post=True, public=True) + return blog_homepage(request, user, homepage) + except Snipt.DoesNotExist: + return blog_list(request, user) if request.user.is_authenticated(): return HttpResponseRedirect('/%s/' % request.user.username) else: return list_public(request) +def blog(request): + if request.subdomain: + subdomain = request.subdomain.replace('-', '_') + user = get_object_or_404(User, username__iexact=subdomain) + return blog_list(request, user) + else: + return list_user(request, 'blog') + @render_to('snipts/detail.html') def detail(request, username, snipt_slug): diff --git a/templates/base.html b/templates/base.html index 3e70ac6..1a54be2 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,7 +6,9 @@ {% block page-title %}Snipt{% endblock %} - + {% block page-description %} + + {% endblock %} {% block meta %}{% endblock %} @@ -131,152 +133,156 @@ {% endblock %} -
-
- {% block content %}{% endblock %} - {% block rochester-made %} -
- - - -
+ {% block main %} +
+
+ {% block content %}{% endblock %} + {% block rochester-made %} +
+ + + +
+ {% endblock %} +
+ {% block aside %} + {% endblock %} -
- {% block aside %} - - {% endblock %} -
-
-
+
+
+
+ {% endblock %} -