From dfe358564832e034bbd8a1277c6ed11b16b80855 Mon Sep 17 00:00:00 2001 From: Nick Sergeant Date: Thu, 10 Nov 2011 14:34:51 -0500 Subject: [PATCH] Working on tags and expansion for tags --- snipt/media/css/style.less | 18 ++++++++++++++++-- snipt/media/js/src/modules/snipt.js | 2 ++ snipt/snipts/models.py | 4 ++++ snipt/snipts/templates/snipts/list-public.html | 12 +++++++----- snipt/snipts/templates/snipts/snipt-list.html | 12 ++++++++---- snipt/snipts/templates/snipts/tags-user.html | 4 ++-- 6 files changed, 39 insertions(+), 13 deletions(-) diff --git a/snipt/media/css/style.less b/snipt/media/css/style.less index 049a859..f928f51 100644 --- a/snipt/media/css/style.less +++ b/snipt/media/css/style.less @@ -76,7 +76,6 @@ html, body { body { color: #666; font: normal 14px @Helvetica; - overflow-y: scroll; text-rendering: optimizeLegibility; } @@ -484,7 +483,7 @@ article.snipt { } aside { float: right; - margin: 29px 30px 0 0; + margin: 23px 30px 0 0; width: 100px; ul.options { @@ -542,12 +541,27 @@ article.snipt { a { border-bottom: 1px solid #999; color: #999; + display: inline-block; font: normal 12px @Helvetica; + max-width: 72px; + overflow: hidden; + text-overflow: ellipsis; text-decoration: none; + white-space: nowrap; + + &:hover { + border-color: #000; + color: #000; + } } } } } + &.expanded { + li { + display: block; + } + } } footer { clear: both; diff --git a/snipt/media/js/src/modules/snipt.js b/snipt/media/js/src/modules/snipt.js index a43959b..15bf3b1 100644 --- a/snipt/media/js/src/modules/snipt.js +++ b/snipt/media/js/src/modules/snipt.js @@ -9,6 +9,7 @@ this.model.view = this; this.$el = $(this.el); this.$container = $('div.container', this.$el); + this.$aside = $('aside', this.$el); this.$expand_button = $('a.expand', this.$el); }, events: { @@ -16,6 +17,7 @@ }, expand: function() { this.$container.toggleClass('expanded', 100); + this.$aside.toggleClass('expanded'); return false; } }); diff --git a/snipt/snipts/models.py b/snipt/snipts/models.py index afaeac8..dded65d 100644 --- a/snipt/snipts/models.py +++ b/snipt/snipts/models.py @@ -72,6 +72,10 @@ class Snipt(models.Model): site.domain, self.key) + @property + def sorted_tags(self): + return self.tags.all().order_by('name') + @property def lexer_name(self): return get_lexer_by_name(self.lexer).name diff --git a/snipt/snipts/templates/snipts/list-public.html b/snipt/snipts/templates/snipts/list-public.html index aad4ba2..cc64a99 100644 --- a/snipt/snipts/templates/snipts/list-public.html +++ b/snipt/snipts/templates/snipts/list-public.html @@ -8,10 +8,12 @@ {% block content %}
- {% autopaginate snipts 20 %} - {% for snipt in snipts %} - {% include "snipts/snipt-list.html" %} - {% endfor %} - {% paginate %} + {% with public='true' %} + {% autopaginate snipts 20 %} + {% for snipt in snipts %} + {% include "snipts/snipt-list.html" %} + {% endfor %} + {% paginate %} + {% endwith %}
{% endblock %} diff --git a/snipt/snipts/templates/snipts/snipt-list.html b/snipt/snipts/templates/snipts/snipt-list.html index 3d30d60..85cd9a9 100644 --- a/snipt/snipts/templates/snipts/snipt-list.html +++ b/snipt/snipts/templates/snipts/snipt-list.html @@ -36,11 +36,15 @@
-

Tags

+

{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}

diff --git a/snipt/snipts/templates/snipts/tags-user.html b/snipt/snipts/templates/snipts/tags-user.html index da53ccf..34ac259 100644 --- a/snipt/snipts/templates/snipts/tags-user.html +++ b/snipt/snipts/templates/snipts/tags-user.html @@ -1,9 +1,9 @@
-

{{ user.username }}'s tags

+

{{ request.user.username }}'s tags