Deleting sandwiches works.
[~kgodey/maayanwich.git] / templates / editsandwich.html
index f70bc85..ed649d4 100644 (file)
@@ -8,11 +8,17 @@
 <link rel="stylesheet" href="{{ media_url }}sandwiches/token-input.css" type="text/css" />
 <link rel="stylesheet" href="{{ media_url }}sandwiches/datePicker.css" type="text/css" />
 <script type="text/javascript">
+
 $(document).ready(function () {
   $("#id_ing").tokenInput("/ajaxfun/", {
        hintText: "Type an ingredient!",
        noResultsText: "No ingredients!",
-       searchingText: "Searching..."
+       searchingText: "Searching...",
+       prePopulate: [
+               {% for i in prepop %}
+                       {id: '{{i.pk}}', name: '{{i.name}}' },
+               {% endfor %}
+               ]
 });
 });
 </script>
@@ -29,7 +35,7 @@ $(function()
 {% block content %}
        <h1 class="pagetitle">Edit sandwich</h1>
        <span class="formspan">
-       <form enctype="multipart/form-data" action="{% url add_sandwich %}" method="post" class="cssform">
+       <form enctype="multipart/form-data" action="{% url edit_sandwich slug=s.slug %}" method="post" class="cssform">
        {{ sform.as_p }}
        {% if s.picture %}
                <img src="{{ s.picture.url }}" width=400px vspace=10px>
@@ -37,5 +43,6 @@ $(function()
        <p><label for="id_ing">Ingredients:</label> <input id="id_ing" type="text" name="ing"/></p>
        <input type="submit" value="Submit" />
        </form>
+       {% ifequal s.user request.user %}<p class="sandnotes"><a href="{% url del_sandwich slug=s.slug %}">Delete sandwich</a></p>{% endifequal %}
        </span>
 {% endblock %}
\ No newline at end of file