summaryrefslogtreecommitdiff
path: root/templates/createOrEdit.html
blob: 033edec65ffa9adaa703e8d57c160316706b859d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{% extends "base.html" %}
{% load i18n %}

{% block content %}
 {% if not new and not choices %}
 <p class='error'>{% trans "As long as no options were added to the poll, it will not be made available." %}</p>
 {% endif %}
 <h2>{% if new %}{% trans "New poll" %}{% else %}{% trans "Edit poll" %}{% endif %}</h2>
{% if error %}<p class='error'>{{ error }}</p>{% endif %}
<table class='new_poll'>
<form action="{{admin_url}}" method="post">

  {% if not new %}<tr>
   <td><label>{% trans "Poll url" %}</label></td>
   <td colspan='2'><a href='http://{{full_base_url}}'>http://{{full_base_url}}</a></td>
   <td class='form_description'>{% trans "Copy this address and send it to voters who want to participate to this poll" %}</td>
  </tr>
  <tr>
   <td><label>{% trans "Administration url" %}</label></td>
   <td colspan='2'><a href='http://{{full_admin_url}}'>http://{{full_admin_url}}</a></td>
   <td class='form_description'>{% trans "Address to modify the current poll" %}</td>
  </tr>
  {% endif %}

  <tr>
   <td><label for='author_name'>{% trans "Author name" %}</label></td>
   <td colspan='2'>{% if new %}<input type='text' name='author_name' value='{{poll.author.name}}'/>{% else %}{{poll.author.name}}{% endif %}</td>
   <td class='form_description'>{% trans "Name, firstname or nickname of the author" %}</td>
  </tr>

  <tr>
   <td><label for='poll_name'>{% trans "Poll name" %}</label></td>
   <td colspan='2'>{% if new %}<input type='text' name='poll_name' value='{{poll.name}}'/>{% else %}<input type='text' name='poll_name' value='{{poll.name}}'/>{% endif %}</td>
   <td class='form_description'>{% trans "Global name to present the poll" %}</td>
  </tr>

  <tr>
   <td><label for='poll_desc'>{% trans "Poll description" %}</label></td>
   <td colspan='2'>{% if new %}<textarea name='poll_desc'>{{poll.description}}</textarea>{% else %}<textarea name='poll_desc'>{{poll.description}}</textarea>{% endif %}</td>
   <td class='form_description'>{% trans "Precise description of the poll" %}</td>
  </tr>

  {% if not new %}<tr>
   <td><label for='poll_open'>{% trans "Poll status" %}</label></td>
   <td colspan='2'>
    <select name='poll_open'>
     <option value='1'{%if poll.open %} selected='selected'{%endif%}>{%trans "Open"%}</option>
     <option value='0'{%if not poll.open %} selected='selected'{%endif%}>{%trans "Closed"%}</option>
    </select>
   </td>
   <td class='form_description'>{% trans "Status of the poll. When closed no vote add or modification are allowed" %}</td>
  </tr>{% endif %}

  <tr>
   <td><label for='poll_public'>{% trans "Visibility" %}</label></td>
   <td colspan='2'>
    <select name='poll_public'>
     <option value='0'{%if not poll.public %} selected='selected'{%endif%}>{%trans "Private"%}</option>
     <option value='1'{%if poll.public %} selected='selected'{%endif%}>{%trans "Public"%}</option>
    </select>
   </td>
   <td class='form_description'>{% trans "If the poll is public it is available on the main page" %}</td>
  </tr>

  {% if categories %}<tr>
   <td><label for='poll_category'>{% trans "Poll category" %}</label></td>
   <td colspan='2'>{% if new %}
    <select name='poll_category'>
     <option value=''>---</option>
     {% for category in categories %}<option value='{{category.id}}'>{{category.name}}</option>{% endfor %}
    </select>{%else%}{{poll.category.name}}
   {% endif %}</td>
   <td class='form_description'>{% trans "Category of the poll" %}</td>
  </tr>{% endif %}

  <tr>
   <td><label for='poll_type'>{% trans "Poll type" %}</label></td>
   <td colspan='2'>{% if new %}<select name='poll_type'>
    {% for typ in TYPES %}<option value='{{typ.0}}'{% ifequal poll_type typ.0%} selected='selected'{% endifequal %}>{{typ.1}}</option>{% endfor %}
   </select>{% else %}{{type_name}}{% endif %}</td>
   <td class='form_description'>{% trans "Type of the poll:" %}
   <ul>
    <!--<li>{% trans "Meeting is the appropriate type to set a date for a meeting."%}</li>!-->
    <li>{% trans '"Poll" is the appropriate type for a simple multi-choice poll' %}</li>
    <li>{% trans '"Balanced poll" lets voters setting negative vote for some choices' %}</li>
    <li>{% trans '"One choice poll"' %}</li>
   </ul>
   </td>
  </tr>

  <tr>
   <td></td>
   <td>{% if new %}<input type='hidden' name='new' value='1'/>
   <input type='submit' value='{% trans "Create" %}' />
   {% else %}<input type='hidden' name='edit' value='1'/>
   <input type='submit' value='{% trans "Edit" %}' />
   {% endif %}</td>
  </tr>

 </form>
</table>
{% if not new %}
<h2>{% trans "Choices" %}</h2>
<table class='new_poll'>
  {% if choices %}<form action="{{admin_url}}" method="post">
  <tr>
   <th>{% trans "Choices" %}</th><th>{% trans "Label" %}</th><th>{% trans "Limit" %}</th><th>{% trans "Delete?"%}</th>
  </tr>
  {% for choice in choices %}<tr>
   <td>&nbsp;</td><td><input type='text' name='modify_{{choice.id}}' value="{{choice.name}}"/></td><td>{%if choice.limit%}{% blocktrans with choice.limit as choice_limit%}Limited to {{choice_limit}} vote(s){% endblocktrans %}{%endif%}</td><td><input type='checkbox' name='delete_{{choice.id}}'/></td>
  </tr>{% endfor %}
  <tr>
   <td></td>
   <td><input type='hidden' name='edit' value='1'/>
   <input type='submit' value='{% trans "Edit" %}' /></td>
  </tr>
 </form>{% endif %}

 <form action="{{admin_url}}" method="post">
  <tr><td><label>{% trans "New choice" %}</label></td><td><input type='text' name='new_choice'/></td><td>{%trans "Limited to"%} <input type='text' name='limit' id='limit'/> {%trans "vote(s)"%}</td><td class='form_description'>{% trans "Setting a new choice. Optionally you can set a limit of vote for this choice. This limit is usefull for limited resources allocation." %}</td></tr>
  <tr>
   <td></td>
   <td><input type='hidden' name='add' value='1'/> <input type='submit' value='{% trans "Add" %}' /></td>
  </tr>
 </form>
</table>
 {% endif %}
{% endblock %}