Modified templates a little for sandwich by user and sandwich by month (to have more...
[~kgodey/maayanwich.git] / templates / editsandwich.html
1 {% extends "base.html" %}
2 {% block extrahead %}
3 <script type="text/javascript" src="{{ media_url }}sandwiches/jquery-1.4.2.min.js"></script>
4 <script type="text/javascript" src="{{ media_url }}sandwiches/jquery.tokeninput.js"></script>
5 <script type="text/javascript" src="{{ media_url }}sandwiches/date.js"></script>
6 <!--[if IE]><script type="text/javascript" src="http://127.0.0.1:8000/sandwiches/jquery.bgiframe.js"></script><![endif]-->
7 <script type="text/javascript" src="{{ media_url }}sandwiches/jquery.datePicker.js"></script>
8 <link rel="stylesheet" href="{{ media_url }}sandwiches/token-input.css" type="text/css" />
9 <link rel="stylesheet" href="{{ media_url }}sandwiches/datePicker.css" type="text/css" />
10 <script type="text/javascript">
11
12 $(document).ready(function () {
13   $("#id_ing").tokenInput("/ajaxfun/", {
14         hintText: "Type an ingredient!",
15         noResultsText: "No ingredients!",
16         searchingText: "Searching...",
17         prePopulate: [
18                 {% for i in prepop %}
19                         {id: '{{i.pk}}', name: '{{i.name}}' },
20                 {% endfor %}
21                 ]
22 });
23 });
24 </script>
25 <script type="text/javascript">
26 Date.firstDayOfWeek = 0;
27 Date.format = 'yyyy-mm-dd';
28 $(function()
29 {
30         $('#id_date_made').datePicker({startDate:'1996-01-01'}).val(new Date().asString()).trigger('change');
31 });
32 </script>
33 {% endblock %}
34 {% block title %}Edit sandwich{% endblock %}
35 {% block content %}
36         <h1 class="pagetitle">Edit sandwich</h1>
37         <span class="formspan">
38         <form enctype="multipart/form-data" action="{% url edit_sandwich slug=s.slug %}" method="post" class="cssform">
39         {{ sform.as_p }}
40         {% if s.picture %}
41                 <img src="{{ s.picture.url }}" width=400px vspace=10px>
42         {% endif %}
43         <p><label for="id_ing">Ingredients:</label> <input id="id_ing" type="text" name="ing"/></p>
44         <input type="submit" value="Submit" />
45         </form>
46         <script type="text/javascript">
47         <!--
48         function show_confirm()
49         {
50         var r=confirm("Are you sure you want to delete this sandwich?");
51         if (r !=0)
52           {
53           location = "{% url del_sandwich slug=s.slug %}"
54           }
55         }
56         -->
57         </script>
58         {% ifequal s.user request.user %}<p class="sandnotes"><a href="#" onClick='show_confirm(); return false;'>Delete sandwich</a></p>{% endifequal %}
59         </span>
60 {% endblock %}