Permalink
Browse files

use HAML

  • Loading branch information...
1 parent 9f4c3ff commit 116da7d2edbfb9fe6a7509d928606d0d0dd2fb72 @d1ffuz0r committed Aug 4, 2012
Showing with 246 additions and 227 deletions.
  1. +6 −0 homesite/template_loaders.py
  2. +6 −0 homesite/templates/404.haml
  3. +6 −0 homesite/templates/500.haml
  4. +8 −0 homesite/templates/about.haml
  5. +85 −0 homesite/templates/base.haml
  6. +22 −0 homesite/templates/blog.haml
  7. +22 −0 homesite/templates/contacts.haml
  8. +15 −0 homesite/templates/home.haml
  9. +5 −4 public/templates/post.html → homesite/templates/post.haml
  10. +15 −0 homesite/templates/skills.haml
  11. +24 −0 homesite/urls.py
  12. +12 −2 homesite/views.py
  13. +0 −9 public/templates/404.html
  14. +0 −9 public/templates/500.html
  15. +0 −12 public/templates/about.html
  16. +0 −83 public/templates/base.html
  17. +0 −19 public/templates/blog.html
  18. +0 −18 public/templates/contacts.html
  19. +0 −12 public/templates/home.html
  20. +0 −13 public/templates/skills.html
  21. +11 −14 settings.py
  22. BIN {public → }/static/css/fonts/bebasneue-webfont.eot
  23. 0 {public → }/static/css/fonts/bebasneue-webfont.svg
  24. BIN {public → }/static/css/fonts/bebasneue-webfont.ttf
  25. BIN {public → }/static/css/fonts/bebasneue-webfont.woff
  26. +1 −1 {public → }/static/css/style.css
  27. BIN {public → }/static/images/bg.png
  28. BIN {public → }/static/images/contacts.png
  29. BIN {public → }/static/images/django-logo.gif
  30. BIN {public → }/static/images/footer-header.png
  31. BIN {public → }/static/images/footer_top_bg.png
  32. BIN {public → }/static/images/form-bg.png
  33. BIN {public → }/static/images/form-send.png
  34. BIN {public → }/static/images/form-textarea-bg.png
  35. BIN {public → }/static/images/home-links.png
  36. BIN {public → }/static/images/menu-buttons.png
  37. BIN {public → }/static/images/pathbar.png
  38. BIN {public → }/static/images/rss_logo.png
  39. BIN {public → }/static/images/service-item.png
  40. BIN {public → }/static/images/social-split.png
  41. BIN {public → }/static/images/social/facebook.png
  42. BIN {public → }/static/images/social/github.png
  43. BIN {public → }/static/images/social/linkedin.png
  44. BIN {public → }/static/images/social/twitter.png
  45. 0 {public → }/static/js/jquery-1.6.2.min.js
  46. +2 −6 {public → }/static/js/site.js
  47. +1 −0 static/masha
  48. +5 −25 urls.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+from django.template.loaders import filesystem, app_directories
+from djaml.loaders import get_haml_loader
+
+DjamlFilesystemLoader = get_haml_loader(filesystem)
+DjamlAppDirectoriesLoader = get_haml_loader(app_directories)
@@ -0,0 +1,6 @@
+{% extends 'base.haml' %}
+{% block page_title %}Whoops. 404{% endblock %}
+{% block content %}
+ #error
+ Page not found
+{% endblock %}
@@ -0,0 +1,6 @@
+{% extends 'base.haml' %}
+{% block page_title %}Whoops. 500{% endblock %}
+{% block content %}
+ #error
+ Error
+{% endblock %}
@@ -0,0 +1,8 @@
+{% extends 'base.haml' %}
+{% block title %}About me{% endblock %}
+{% block page_title %}Hi, There.{% endblock %}
+{% block content %}
+ #about
+ .about-left
+ {{ about.0.description|safe }}
+{% endblock %}
@@ -0,0 +1,85 @@
+{% load masha %}
+!!! 5
+%html
+ %head
+ %title {% block title %}{% endblock %}
+ %meta{'http-equiv': 'Content-type', 'content': 'text/html', 'charset': 'utf-8'}
+ %meta{'name': 'author', 'content': 'Roman Gladkov, d1fffuz0r@gmail.com'}
+ %meta{'name': 'keywords', 'content': 'd1ffuz0r, blog, contacts, portfolio, python, django, tornado, jQuery, Erlang'}
+ %meta{'name': 'description', 'content': 'd1ffuz0r personal site, blog, portfolio'}
+ %link{'rel': 'stylesheet', 'href': '{{ STATIC_URL }}css/style.css', 'type': 'text/css', 'charset': 'utf-8', 'media': 'screen'}
+ %script{'type': 'text/javascript', 'src': '{{ STATIC_URL }}js/jquery-1.6.2.min.js', 'charset': 'utf-8'}
+ %script{'type': 'text/javascript', 'src': '{{ STATIC_URL }}js/site.js', 'charset': 'utf-8'}
+ {% masha %}
+ %body
+ #head
+ #menu
+ %ul
+ %li
+ %a{'href': '/'}
+ %button{'class': '{% if home %}active{% else %}button{% endif %}'} Home
+ %li
+ %a{'href': '/about/'}
+ %button{'class': '{% if about %}active{% else %}button{% endif %}'} About me
+ %li
+ %a{'href': '/blog/'}
+ %button{'class': '{% ifequal page "blog" %} active{% else %}button{% endifequal %}'} Blog
+ %li
+ %a{'href': '/skills/'}
+ %button{'class': '{% if skills %} active{% else %}button{% endif %}'} Skills
+ %li
+ %a{'href': '/contacts/'}
+ %button{'class': '{% if contacts %} active{% else %}button{% endif %}'} Contacts
+ #content
+ .title {% block page_title %}{% endblock %}
+ {% block content %}{% endblock %}
+ #footer
+ {% load footer_tags %}
+ %div{'style': 'background: #566579;'}
+ %ul
+ %li
+ .block
+ .header.social
+ #activity
+ .loader.hidden
+ %ul#activity-tweets
+ #social_link
+ %ul
+ {% social %}
+ %li
+ %a{'href': '{{ social.facebook }}', 'target': '_blank'}
+ %img{'src': '{{ STATIC_URL }}images/social/facebook.png'}
+ %li
+ %a{'href': '{{ social.twitter }}', 'target': '_blank'}
+ %img{'src': '{{ STATIC_URL }}images/social/twitter.png'}
+ %li
+ %a{'href': '{{ social.github }}', 'target': '_blank'}
+ %img{'src': '{{ STATIC_URL }}images/social/github.png'}
+ %li
+ %a{'href': '{{ social.linkedin }}', 'target': '_blank'}
+ %img{'src': '{{ STATIC_URL }}images/social/linkedin.png'}
+ %li
+ .block
+ .header.contact
+ #quick-form
+ %form#quick-message
+ {% csrf_token %}
+ {% quick_form %}
+ %p
+ %button#quick-submit{'onclick': 'return false;'} Send
+ %li.last
+ .block
+ .header.find_us
+ #latest-post
+ %ul
+ {% latest_posts %}
+ {% for post in latest_posts %}
+ %li
+ <a href="{{ post.get_absolute_url }}">{{ post.title }}</a>
+ {% endfor %}
+ .copyright
+ .by-django
+ %img{'src': '{{ STATIC_URL }}images/django-logo.gif'}
+ .rss
+ %a{'href': '/blog/rss/'}
+ %img{'src': '{{ STATIC_URL }}images/rss_logo.png'}
@@ -0,0 +1,22 @@
+{% extends 'base.haml' %}
+{% block title %}Blog{% endblock %}
+{% block page_title %}Blog{% endblock %}
+{% block content %}
+ #blog
+ {% if posts %}
+ %ul.posts
+ {% for post in posts.object_list %}
+ %li.blog-post
+ %h1
+ <a class="more" href="{{ post.get_absolute_url }}">{{ post.title }}</a>
+ %span
+ {{ post.text|safe|linebreaksbr|truncatewords:10 }}
+ %a.more{'href': '{{ post.get_absolute_url }}'} More
+ {% endfor %}
+ .pagination
+ %span.step-links
+ {% if posts.has_previous %}<a href="?page={{ posts.previous_page_number }}">previous</a>{% endif %}
+ <span class="current">{{ posts.number }} of {{ posts.paginator.num_pages }}</span>
+ {% if posts.has_next %}<a href="?page={{ posts.next_page_number }}">next</a>{% endif %}
+ {% else %}No posts :({% endif %}
+{% endblock %}
@@ -0,0 +1,22 @@
+{% extends 'base.haml' %}
+{% load footer_tags %}
+{% block title %}Contacts{% endblock %}
+{% block page_title %}Contacts{% endblock %}
+{% block content %}{% social %}
+ #contacts
+ .contact.jabber
+ %span
+ Jabber
+ .desc
+ {{ social.jabber }}
+ .contact.skype
+ %span
+ Skype
+ .desc
+ {{ social.skype }}
+ .contact.email
+ %span
+ Email
+ .desc
+ {{ social.email }}
+{% endblock %}
@@ -0,0 +1,15 @@
+{% extends 'base.haml' %}
+{% block title %}Home{% endblock %}
+{% block content %}
+ #home
+ #home-links
+ %ul
+ %li{'class': 'about'}
+ %a{'href': '/about/'} About me
+ %li{'class': 'portfolio'}
+ %a{'href': '/blog/'} Blog
+ %li{'class': 'skills'}
+ %a{'href': '/skills/'} Skills
+ %li{'class': 'contact'}
+ %a{'href': '/contacts/'} Contacts
+{% endblock %}
@@ -1,10 +1,11 @@
-{% extends 'base.html' %}
+{% extends 'base.haml' %}
{% load disqus_tags %}
{% disqus_dev %}
{% block title %}Blog - {{ post.title|capfirst }}{% endblock %}
{% block page_title %}{{ post.title|capfirst }}{% endblock %}
-{% block content %}<div id="post">
+{% block content %}
+ #post
{{ post.text|safe|linebreaksbr }}
- <hr class='split'>
+ %hr.split
{% disqus_show_comments %}
- </div>{% endblock %}
+{% endblock %}
@@ -0,0 +1,15 @@
+{% extends 'base.haml' %}
+{% block title %}Skills{% endblock %}
+{% block page_title %}Skills{% endblock %}
+{% block content %}
+ #skills
+ .skills-items
+ %ul
+ {% if skills %}{% for skill in skills %}
+ %li.skill
+ .skill-item-image
+ %img{'src': '{{ MEDIA_URL }}{{ skill.image }}', 'height': '100'}
+ .skill-item-desc
+ {{ skill.description }}
+ {% endfor %}{% else %}No skills :({% endif %}
+{% endblock %}
View
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+from feed import BlogRss
+from models import About, Services, Settings
+from django.conf.urls import patterns, url
+from django.views.generic.list import ListView
+
+
+urlpatterns = patterns('',
+ url(r'^$', ListView.as_view(model=Settings,
+ context_object_name="home",
+ template_name="home.haml")),
+ url(r'^about/', ListView.as_view(queryset=About.objects.all(),
+ context_object_name="about",
+ template_name="about.haml")),
+ url(r'^skills/', ListView.as_view(queryset=Services.objects.all(),
+ context_object_name="skills",
+ template_name="skills.haml")),
+ url(r'^contacts/', ListView.as_view(model=Settings,
+ template_name="contacts.haml")),
+ url(r'^blog/rss/$', BlogRss()),
+ url(r'^blog/post/(\d+)', 'homesite.views.blog_post'),
+ url(r'^blog/', 'homesite.views.blog_list'),
+ url(r'^ajax/quick-form', 'homesite.views.quick_form'),
+)
View
@@ -7,7 +7,7 @@
from decorators import render_to
-@render_to("blog.html")
+@render_to("blog.haml")
def blog_list(request):
posts_list = Blog.objects.all()
paginator = Paginator(posts_list, 5)
@@ -23,7 +23,7 @@ def blog_list(request):
return {"page": "blog", "posts": posts}
-@render_to("post.html")
+@render_to("post.haml")
def blog_post(request, post_id):
post = get_object_or_404(Blog, id=post_id)
return {"page": "blog", "post": post}
@@ -40,3 +40,13 @@ def quick_form(request):
else:
message = u"Not data"
return HttpResponse(message)
+
+
+@render_to('404.haml')
+def error404(request):
+ return {}
+
+
+@render_to('500.haml')
+def error500(request):
+ return {}
@@ -1,9 +0,0 @@
-{% extends 'base.html' %}
-{% block page_title %}
- Whoops. 404
-{% endblock %}
-{% block content %}
- <div id="error">
- Page not found
- </div>
-{% endblock %}
@@ -1,9 +0,0 @@
-{% extends 'base.html' %}
-{% block page_title %}
- Whoops. 500
-{% endblock %}
-{% block content %}
- <div id="error">
- Error
- </div>
-{% endblock %}
@@ -1,12 +0,0 @@
-{% extends 'base.html' %}
-{% block title %}About me{% endblock %}
-{% block page_title %}Hi, There.{% endblock %}
-{% block content %}<div id="about">
- <div class="about-left">
- {{ about.0.description|safe }}
- <p>Follow my on GitHub as <a href="{{ settings.github }}">d1ffuz0r</a></p>
- </div>
- {% comment %}<div class="about-right">
- <a id="my-cv" href="{{ MEDIA_URL }}{{ settings.cv }}"><button>Download CV</button></a>
- </div>
- {% endcomment %}</div>{% endblock %}
View
@@ -1,83 +0,0 @@
-{% load masha %}
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-"http://www.w3.org/TR/html4/loose.dtd">
-<html>
- <head>
- <title>{% block title %}{% endblock %}</title>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8">
- <meta name="author" content="d1ffuz0r, d1fffuz0r@gmail.com" />
- <meta name="keywords" content="d1ffuz0r, blog, contacts, portfolio, services, python, django, tornado, jQuery" />
- <meta name="description" content="d1ffuz0r personal site, blog, portfolio" />
- <link rel="stylesheet" href="{{ STATIC_URL }}css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
- <script type="text/javascript" src="{{ STATIC_URL }}js/jquery-1.6.2.min.js" charset="utf-8"></script>
- <script type="text/javascript" src="{{ STATIC_URL }}js/site.js" charset="utf-8"></script>
- {% masha %}
- </head>
- <body>
- <div id="head">
- <div id="menu">
- <ul>
- <li><a href="/"><button class="{% if home %}active{% else %}button{% endif %}">Home</button></a></li>
- <li><a href="/about/"><button class="{% if about %}active{% else %}button{% endif %}">About me</button></a></li>
- <li><a href="/blog/"><button class="{% ifequal page 'blog' %} active{% else %}button{% endifequal %}">Blog</button></a></li>
- <li><a href="/skills/"><button class="{% if skills %} active{% else %}button{% endif %}">Skills</button></a></li>
- <li><a href="/contacts/"><button class="{% if contacts %} active{% else %}button{% endif %}">Contacts</button></a></li>
- </ul>
- </div>
- </div>
- <div id="content">
- <div class="title">{% block page_title %}{% endblock %}</div>
- {% block content %}{% endblock %}
- </div>
- <div id="footer">{% load footer_tags %}
- <div style="background: #566579;">
- <ul>
- <li>
- <div class="block">
- <div class="header social"></div>
- <div id="activity">
- <div class="loader hidden"></div>
- <ul id="activity-tweets"></ul>
- </div>
- <div id="social_link">
- <ul>{% social %}
- <li><a href="{{ social.facebook }}" target="_blank"><img src="{{ STATIC_URL }}images/social/facebook.png" alt=""></a></li>
- <li><a href="{{ social.twitter }}" target="_blank"><img src="{{ STATIC_URL }}images/social/twitter.png" alt=""></a></li>
- <li><a href="{{ social.github }}" target="_blank"><img src="{{ STATIC_URL }}images/social/github.png" alt=""></a></li>
- <li><a href="{{ social.linkedin }}" target="_blank"><img src="{{ STATIC_URL }}images/social/linkedin.png" alt=""></a></li>
- </ul>
- </div>
- </div>
- </li>
- <li>
- <div class="block">
- <div class="header contact"></div>
- <div id="quick-form">
- <form id="quick-message">
- {% csrf_token %}
- {% quick_form %}
- <p><button id="quick-submit" onclick="return false;">Send</button></p>
- </form>
- </div>
- </div>
- </li>
- <li class="last">
- <div class="block">
- <div class="header find_us"></div>
- <div id="latest-post">
- <ul>{% latest_posts %}
- {% for post in latest_posts %}<li><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></li>
- {% endfor %}
- </ul>
- </div>
- </div>
- </li>
- </ul>
- <div class="copyright">
- <div class="by-django"><img src="{{ STATIC_URL }}images/django-logo.gif" alt=""></div>
- <div class="rss"><a href="/blog/rss/"><img src="{{ STATIC_URL }}images/rss_logo.png" alt=""></a></div>
- </div>
- </div>
- </div>
- </body>
-</html>
Oops, something went wrong.

0 comments on commit 116da7d

Please sign in to comment.