Modified templates a little for sandwich by user and sandwich by month (to have more...
[~kgodey/maayanwich.git] / templates / editsandwich.html
index 912b6bb..a8a8133 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>
@@ -37,5 +43,18 @@ $(function()
        <p><label for="id_ing">Ingredients:</label> <input id="id_ing" type="text" name="ing"/></p>
        <input type="submit" value="Submit" />
        </form>
+       <script type="text/javascript">
+       <!--
+       function show_confirm()
+       {
+       var r=confirm("Are you sure you want to delete this sandwich?");
+       if (r !=0)
+         {
+         location = "{% url del_sandwich slug=s.slug %}"
+         }
+       }
+       -->
+       </script>
+       {% ifequal s.user request.user %}<p class="sandnotes"><a href="#" onClick='show_confirm(); return false;'>Delete sandwich</a></p>{% endifequal %}
        </span>
 {% endblock %}
\ No newline at end of file