From: W. Trevor King Date: Thu, 22 Jul 2010 16:10:57 +0000 (-0400) Subject: Added recipe removal link and replaced ' />' -> '/>' X-Git-Tag: v0.1~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3ecf3c9cc749c3e753c6bf57f97d922c870767b2;p=cookbook.git Added recipe removal link and replaced ' />' -> '/>' --- diff --git a/cookbook/server.py b/cookbook/server.py index 76dded6..19b3d58 100644 --- a/cookbook/server.py +++ b/cookbook/server.py @@ -132,7 +132,13 @@ class Server (object): def edit(self, name=None, **kwargs): """Remove a tag from a single recipe.""" name,recipe,action = self._normalize_edit_params(name, **kwargs) - if action.startswith('edit'): + if action == 'remove': + recipe = self.cookbook.index[name] + os.remove(recipe.path) + self.cookbook.remove(recipe) + self.cookbook.make_index() + raise cherrypy.HTTPRedirect(u'.', status=302) + elif action.startswith('edit'): self._update_recipe(name, recipe) if action == 'edit and redirect': # done editing this recipe raise cherrypy.HTTPRedirect( diff --git a/cookbook/template/recipe.html b/cookbook/template/recipe.html index cd20d12..d5c0f03 100644 --- a/cookbook/template/recipe.html +++ b/cookbook/template/recipe.html @@ -12,20 +12,20 @@

{% if recipe.yield_ %} Yield: - {{ recipe.yield_ }}
+ {{ recipe.yield_ }}
{% endif %} {% if recipe.author %} Author: - {{ recipe.author }}
+ {{ recipe.author }}
{% endif %} {% if recipe.source %} Source: - {{ recipe.source }}
+ {{ recipe.source }}
{% endif %} {% if recipe.tags %} Tags: {{ ', '.join(recipe.tags) }} -
+
{% endif %}

@@ -37,7 +37,7 @@ {% endfor %} - +
{% if recipe.tags %}
@@ -47,7 +47,7 @@ {% endfor %} - +
{% endif %} @@ -73,6 +73,10 @@ {% endif %} -

- edit receipe

+ {% endblock %} diff --git a/cookbook/template/recipes.html b/cookbook/template/recipes.html index d0b5b36..06e320e 100644 --- a/cookbook/template/recipes.html +++ b/cookbook/template/recipes.html @@ -10,14 +10,14 @@ {% for tag in cookbook.tags() %} {% endfor %} -
- +
+

add new receipe