From: W. Trevor King
Date: Wed, 21 Jul 2010 18:58:51 +0000 (-0400)
Subject: Use dropdowns (with textbox option for new tags) for tag manipulation.
X-Git-Tag: v0.1~14
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=91240f7518f59423b5d2fa7af87a2ae335a88971;p=cookbook.git
Use dropdowns (with textbox option for new tags) for tag manipulation.
---
diff --git a/cookbook/server.py b/cookbook/server.py
index d606414..94f70f6 100644
--- a/cookbook/server.py
+++ b/cookbook/server.py
@@ -103,6 +103,14 @@ class Server (object):
def _clean_tag(self, tag):
"""Sanitize tag."""
+ if not isinstance(tag, types.StringType):
+ if len(tag) == 2 and '' in tag:
+ # User used either dropdown or textbox
+ tag.remove('')
+ tag = tag[0]
+ else:
+ # User used both dropdown and textbox
+ return None
m = self.tag_regexp.match(tag)
if m != None:
return m.group()
diff --git a/cookbook/template/recipe.html b/cookbook/template/recipe.html
index b335014..5864d23 100644
--- a/cookbook/template/recipe.html
+++ b/cookbook/template/recipe.html
@@ -28,16 +28,28 @@
{% endif %}
-
-
+ {% endif %}
{% for ingredient_block in recipe.ingredient_blocks %}