Tons of cosmetic stuff for public views. Private icon / sub header nav / proper titles / tag list views
parent
c5f3b24cee
commit
d38bef1ab0
|
@ -193,6 +193,40 @@ header.main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
header.sub {
|
||||||
|
.vertical-gradient(#ECECEC, #DBDBDB);
|
||||||
|
|
||||||
|
div.inner {
|
||||||
|
border-left: 1px solid #d0d0d0;
|
||||||
|
margin: 0 auto;
|
||||||
|
position: relative;
|
||||||
|
width: 939px;
|
||||||
|
z-index: 49;
|
||||||
|
|
||||||
|
ul {
|
||||||
|
border-right: 1px solid #d0d0d0;
|
||||||
|
padding-left: 16px;
|
||||||
|
width: 733px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 4px 0 6px 0;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #999999;
|
||||||
|
font: bold 14px @Inconsolata;
|
||||||
|
text-shadow: 0 1px 0 #FFF;
|
||||||
|
}
|
||||||
|
&.prompt {
|
||||||
|
color: #999999;
|
||||||
|
font: bold 14px @Inconsolata;
|
||||||
|
margin-right: 3px;
|
||||||
|
text-shadow: 0 1px 0 #FFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
section.main {
|
section.main {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
@ -241,7 +275,7 @@ section.main {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
section.tags {
|
section.tags {
|
||||||
margin: 45px 15px;
|
margin: 0 15px 45px 15px;
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
background: transparent url('/media/images/tags-icon.png') 0 0 no-repeat;
|
background: transparent url('/media/images/tags-icon.png') 0 0 no-repeat;
|
||||||
|
@ -629,6 +663,13 @@ article.snipt {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
article.private-snipt {
|
||||||
|
div.container {
|
||||||
|
header {
|
||||||
|
.vertical-gradient-with-image(#FFF, #FFFAF2, url('/media/images/private-icon.png') top right no-repeat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
div.pagination {
|
div.pagination {
|
||||||
margin: 0 15px 35px 15px;
|
margin: 0 15px 35px 15px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -69,7 +69,6 @@ STATICFILES_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
STATIC_URL = '/media/'
|
STATIC_URL = '/media/'
|
||||||
else:
|
else:
|
||||||
#STATIC_URL = 'https://dn2p0mzo970os.cloudfront.net/'
|
|
||||||
STATIC_URL = 'https://snipt.s3.amazonaws.com/'
|
STATIC_URL = 'https://snipt.s3.amazonaws.com/'
|
||||||
|
|
||||||
# S3 Settings
|
# S3 Settings
|
||||||
|
@ -80,7 +79,7 @@ AWS_STORAGE_BUCKET_NAME = 'snipt'
|
||||||
# URL prefix for admin static files -- CSS, JavaScript and images.
|
# URL prefix for admin static files -- CSS, JavaScript and images.
|
||||||
# Make sure to use a trailing slash.
|
# Make sure to use a trailing slash.
|
||||||
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
# Examples: "http://foo.com/static/admin/", "/static/admin/".
|
||||||
ADMIN_MEDIA_PREFIX = STATIC_URL + 'grappelli/'
|
ADMIN_MEDIA_PREFIX = 'https://snipt.s3.amazonaws.com/grappelli/'
|
||||||
|
|
||||||
# Additional locations of static files
|
# Additional locations of static files
|
||||||
STATICFILES_DIRS = (
|
STATICFILES_DIRS = (
|
||||||
|
@ -114,8 +113,8 @@ TEMPLATE_CONTEXT_PROCESSORS = (
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE_CLASSES = (
|
||||||
'snipt.middleware.www.WWWMiddleware',
|
'snipt.middleware.www.WWWMiddleware',
|
||||||
'johnny.middleware.LocalStoreClearMiddleware',
|
#'johnny.middleware.LocalStoreClearMiddleware',
|
||||||
'johnny.middleware.QueryCacheMiddleware',
|
#'johnny.middleware.QueryCacheMiddleware',
|
||||||
'django.middleware.cache.CacheMiddleware',
|
'django.middleware.cache.CacheMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
@ -155,6 +154,9 @@ INSTALLED_APPS = (
|
||||||
'snipts',
|
'snipts',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if DEBUG:
|
||||||
|
INSTALLED_APPS += ('django_extensions',)
|
||||||
|
|
||||||
# A sample logging configuration. The only tangible logging
|
# A sample logging configuration. The only tangible logging
|
||||||
# performed by this configuration is to send an email to
|
# performed by this configuration is to send an email to
|
||||||
# the site admins on every HTTP 500 error.
|
# the site admins on every HTTP 500 error.
|
||||||
|
@ -202,11 +204,11 @@ ABSOLUTE_URL_OVERRIDES = {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Caching
|
# Caching
|
||||||
CACHES = {
|
#CACHES = {
|
||||||
'default': dict(
|
#'default': dict(
|
||||||
BACKEND = 'johnny.backends.memcached.MemcachedCache',
|
#BACKEND = 'johnny.backends.memcached.MemcachedCache',
|
||||||
LOCATION = ['app1575260%40heroku.com@mc7.ec2.northscale.net:11211'],
|
#LOCATION = ['127.0.0.1:11211'],
|
||||||
JOHNNY_CACHE = True,
|
#JOHNNY_CACHE = True,
|
||||||
)
|
#)
|
||||||
}
|
#}
|
||||||
JOHNNY_MIDDLEWARE_KEY_PREFIX='johnny_snipt'
|
#JOHNNY_MIDDLEWARE_KEY_PREFIX='johnny_snipt'
|
||||||
|
|
|
@ -9,8 +9,7 @@ class CommentInline(admin.TabularInline):
|
||||||
allow_add = False
|
allow_add = False
|
||||||
|
|
||||||
class SniptAdmin(admin.ModelAdmin):
|
class SniptAdmin(admin.ModelAdmin):
|
||||||
# TODO: Make user readonly
|
readonly_fields = ('user',)
|
||||||
#readonly_fields = ('user',)
|
|
||||||
list_display = ('title', 'slug', 'user', 'lexer', 'public', 'created', 'modified',)
|
list_display = ('title', 'slug', 'user', 'lexer', 'public', 'created', 'modified',)
|
||||||
search_fields = ('title', 'user__username', 'lexer', 'id',)
|
search_fields = ('title', 'user__username', 'lexer', 'id',)
|
||||||
ordering = ('created',)
|
ordering = ('created',)
|
||||||
|
|
|
@ -2,6 +2,15 @@
|
||||||
|
|
||||||
{% load pagination_tags %}
|
{% load pagination_tags %}
|
||||||
|
|
||||||
|
{% block page-title %}{% if tag %}/ public / {{ tag }} - {% endif %}{{ block.super }}{% endblock %}
|
||||||
|
|
||||||
|
{% block breadcrumb %}
|
||||||
|
<li><a href="/public/">public</a></li>
|
||||||
|
{% if tag %}
|
||||||
|
<li>/ <a href="/public/{{ tag }}/">{{ tag }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block tags %}
|
{% block tags %}
|
||||||
{% include "snipts/tags-public.html" %}
|
{% include "snipts/tags-public.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -2,6 +2,15 @@
|
||||||
|
|
||||||
{% load pagination_tags %}
|
{% load pagination_tags %}
|
||||||
|
|
||||||
|
{% block page-title %}/ {{ user.username }}{% if tag %} / {{ tag }}{% endif %} - {{ block.super }}{% endblock %}
|
||||||
|
|
||||||
|
{% block breadcrumb %}
|
||||||
|
<li><a href="/{{ user.username }}/">{{ user.username }}</a></li>
|
||||||
|
{% if tag %}
|
||||||
|
<li>/ <a href="/{{ user.username }}/{{ tag }}/">{{ tag }}</a></li>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block tags %}
|
{% block tags %}
|
||||||
{% include "snipts/tags-user.html" %}
|
{% include "snipts/tags-user.html" %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{% load humanize %}
|
{% load humanize %}
|
||||||
|
|
||||||
<article class="snipt">
|
<article class="snipt {% if not snipt.public %}private-snipt{% endif %}">
|
||||||
<div class="number">#{{ snipt.id }}</div>
|
<div class="number">#{{ snipt.id }}</div>
|
||||||
<div class="group">
|
<div class="group">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
{% if public %}
|
{% if public %}
|
||||||
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
|
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/{{ request.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
|
<a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<section class="tags">
|
<section class="tags">
|
||||||
<h1>{{ request.user.username }}'s tags</h1>
|
<h1>{{ user.username }}'s tags</h1>
|
||||||
<ul>
|
<ul>
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{{ request.user.username }}/tag/{{ tag.slug }}/">{{ tag.name }} ({{ tag.count }})</a>
|
<a href="/{{ user.username }}/tag/{{ tag.slug }}/">{{ tag.name }} ({{ tag.count }})</a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -5,5 +5,8 @@ from snipts import views
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^$', views.home, name='home'),
|
url(r'^$', views.home, name='home'),
|
||||||
url(r'^(?P<user>[^/]+/)?$', views.list_user, name='list-user'),
|
url(r'^public/$', views.list_public, name='list-public'),
|
||||||
|
url(r'^public/tag/(?P<tag>[^/]+)/$', views.list_public, name='list-public-tag'),
|
||||||
|
url(r'^(?P<user>[^/]+)/$', views.list_user, name='list-user'),
|
||||||
|
url(r'^(?P<user>[^/]+)/tag/(?P<tag>[^/]+)/$', views.list_user, name='list-user-tag'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from snipts.api import PublicSniptResource, PublicTagResource
|
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
|
from django.http import HttpResponseRedirect
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from annoying.decorators import render_to
|
from annoying.decorators import render_to
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
|
@ -8,12 +8,12 @@ from taggit.models import Tag
|
||||||
|
|
||||||
def home(request):
|
def home(request):
|
||||||
if request.user.is_authenticated():
|
if request.user.is_authenticated():
|
||||||
return list_user(request, user=request.user)
|
return HttpResponseRedirect('/%s/' % request.user.username)
|
||||||
else:
|
else:
|
||||||
return list_public(request)
|
return list_public(request)
|
||||||
|
|
||||||
@render_to('snipts/list-public.html')
|
@render_to('snipts/list-public.html')
|
||||||
def list_public(request):
|
def list_public(request, tag=None):
|
||||||
|
|
||||||
tags = Tag.objects.filter(snipt__public=True)
|
tags = Tag.objects.filter(snipt__public=True)
|
||||||
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
|
tags = tags.annotate(count=Count('taggit_taggeditem_items__id'))
|
||||||
|
@ -21,17 +21,19 @@ def list_public(request):
|
||||||
|
|
||||||
snipts = Snipt.objects.filter(public=True).order_by('-created')
|
snipts = Snipt.objects.filter(public=True).order_by('-created')
|
||||||
|
|
||||||
|
if tag:
|
||||||
|
snipts = snipts.filter(tags__name__in=[tag])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'snipts': snipts,
|
'snipts': snipts,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
|
'tag': tag,
|
||||||
}
|
}
|
||||||
|
|
||||||
@render_to('snipts/list-user.html')
|
@render_to('snipts/list-user.html')
|
||||||
def list_user(request, user):
|
def list_user(request, user, tag=None):
|
||||||
|
|
||||||
if type(user) == unicode:
|
|
||||||
user = get_object_or_404(User, username=user.strip('/'))
|
|
||||||
|
|
||||||
|
user = get_object_or_404(User, username=user)
|
||||||
tags = Tag.objects
|
tags = Tag.objects
|
||||||
snipts = Snipt.objects
|
snipts = Snipt.objects
|
||||||
|
|
||||||
|
@ -46,8 +48,12 @@ def list_user(request, user):
|
||||||
tags = tags.order_by('-count')
|
tags = tags.order_by('-count')
|
||||||
snipts = snipts.order_by('-created')
|
snipts = snipts.order_by('-created')
|
||||||
|
|
||||||
|
if tag:
|
||||||
|
snipts = snipts.filter(tags__name__in=[tag])
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'snipts': snipts,
|
'snipts': snipts,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
|
'tag': tag,
|
||||||
'user': user,
|
'user': user,
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body class="{% block body-class %}{% endblock %}">
|
<body class="{% block body-class %}{% endblock %}">
|
||||||
|
|
||||||
<header class="main">
|
<header class="main">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<div class="shadey"></div>
|
<div class="shadey"></div>
|
||||||
|
@ -58,7 +57,7 @@
|
||||||
<nav class="public">
|
<nav class="public">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<a href="/" class="active">Public snipts</a>
|
<a href="/public/" {% if '/public/' in request.path or not request.user.is_authenticated %} class="active"{% endif %}>Public snipts</a>
|
||||||
</li>
|
</li>
|
||||||
{% if not request.user.is_authenticated %}
|
{% if not request.user.is_authenticated %}
|
||||||
<li>
|
<li>
|
||||||
|
@ -69,7 +68,7 @@
|
||||||
</li>
|
</li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/">My snipts</a>
|
<a href="/" {% if request.user.username in request.path %} class="active"{% endif %}>My snipts</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -77,18 +76,19 @@
|
||||||
<aside class="nav"></aside>
|
<aside class="nav"></aside>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<header class="sub">
|
||||||
|
<div class="inner">
|
||||||
|
<ul>
|
||||||
|
<li class="prompt">/</li>
|
||||||
|
{% block breadcrumb %}{% endblock %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
<section class="main group">
|
<section class="main group">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
<aside class="main">
|
<aside class="main">
|
||||||
<section class="ad">
|
|
||||||
<div class="asset"></div>
|
|
||||||
<div class="meta">
|
|
||||||
Ads by Yoggrt
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
{% block tags %}{% endblock %}
|
{% block tags %}{% endblock %}
|
||||||
<nav class="footer">
|
<nav class="footer">
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -98,8 +98,11 @@
|
||||||
<li class="twitter">
|
<li class="twitter">
|
||||||
<a href="https://twitter.com/#!/snipt">@snipt</a>
|
<a href="https://twitter.com/#!/snipt">@snipt</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="pro">
|
<li class="twitter">
|
||||||
<a href="/pro/">Go Pro</a>
|
<a href="https://twitter.com/#!/nicksergeant">@nicksergeant</a>
|
||||||
|
</li>
|
||||||
|
<li class="twitter">
|
||||||
|
<a href="https://twitter.com/#!/nickadamssays">@nickadamssays</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
@ -107,7 +110,6 @@
|
||||||
<div class="left-y ruler"></div>
|
<div class="left-y ruler"></div>
|
||||||
<div class="right-y ruler"></div>
|
<div class="right-y ruler"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{% if not debug %}
|
{% if not debug %}
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
|
@ -122,6 +124,5 @@
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue