summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authoretienne2009-12-04 13:33:06 +0000
committeretienne2009-12-04 13:33:06 +0000
commit442d34494354cbca1cad022290db417ae7a7aede (patch)
tree84e2371fb94945e7ac456da41ddfeb68e5f1f1e3 /templates
parent25e778bebb1804aeaf0d7716119bcbfbe967e8b2 (diff)
Template cleaning - Simplification - Use of newforms
Diffstat (limited to 'templates')
-rw-r--r--templates/createOrEdit.html129
-rw-r--r--templates/edit.html45
-rw-r--r--templates/editChoices.html19
-rw-r--r--templates/editChoicesAdmin.html42
-rw-r--r--templates/editChoicesUser.html31
5 files changed, 103 insertions, 163 deletions
diff --git a/templates/createOrEdit.html b/templates/createOrEdit.html
deleted file mode 100644
index 1e52ee1..0000000
--- a/templates/createOrEdit.html
+++ /dev/null
@@ -1,129 +0,0 @@
-{% 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 %}
-{% if error %}<p class='error'>{{ error }}</p>{% endif %}
- <h2>{% if new %}{% trans "New poll" %}{% else %}{% trans "Edit poll" %}{% endif %}</h2>
-<form action="{{admin_url}}" method="post">
-<table class='new_poll'>
-
- {% 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{% if new %} for='author_name'{%endif%}>{% trans "Author name" %}</label></td>
- <td colspan='2'>{% if new %}<input type='text' name='author_name' id='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'><input type='text' name='poll_name' id='poll_name' value='{{poll.name}}'/></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'><textarea name='poll_desc' id='poll_desc' rows='' cols=''>{{poll.description}}</textarea></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' id='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' id='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{% if new %} for='poll_category'{%endif%}>{% trans "Poll category" %}</label></td>
- <td colspan='2'>{% if new %}
- <select name='poll_category' id='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{% if new %} for='poll_type'{%endif%}>{% trans "Poll type" %}</label></td>
- <td colspan='2'>{% if new %}<select name='poll_type' id='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" %}' class='submit'/>
- {% else %}<input type='hidden' name='edit' value='1'/>
- <input type='submit' value='{% trans "Edit" %}' class='submit'/>
- {% endif %}</td>
- </tr>
-</table>
-</form>
-{% if not new %}
-<h2>{% trans "Choices" %}</h2>
-{% if choices %}<form action="{{admin_url}}" method="post">
-<table class='new_poll'>
- <tr>
- <th>{% trans "Up/down" %}</th><th>{% trans "Label" %}</th><th>{% trans "Limit" %}</th><th>{% trans "Delete?"%}</th>
- </tr>
- {% for choice in choices %}<tr>
- <td><a href='?up_choice={{choice.id}}' class='arrow'>+</a> / <a href='?down_choice={{choice.id}}' class='arrow'>-</a></td><td><input type='text' name='modify_{{choice.id}}' value="{{choice.name}}"/></td><td>{% trans "Limited to"%} <input type='text' name='limit_{{choice.id}}' class='limit'{%if choice.limit%} value='{{choice.limit}}'{%endif%}/> {% trans "vote(s)" %}</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" %}' class='submit'/></td>
- </tr>
-</table>
-</form>{% endif %}
-
-<form action="{{admin_url}}" method="post">
-<table class='new_poll'>
- <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' class='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" %}' class='submit'/></td>
- </tr>
-</table>
-</form>
- {% endif %}
-{% endblock %}
diff --git a/templates/edit.html b/templates/edit.html
index c8b7d75..f24395f 100644
--- a/templates/edit.html
+++ b/templates/edit.html
@@ -10,18 +10,13 @@
{% endblock %}
{% block content %}
- {% if not choices %}
- <p class='error'>{% blocktrans %}As long as no options were added to the poll,
-it will not be made available.{% endblocktrans %}</p>
- {% endif %}
-
<h2>{% trans "Edit poll" %}</h2>
<form action="" method="post">
<table class='new_poll'>
<tr>
<td><label>{% trans "Poll url" %}</label></td>
<td>
-<a href='http://{{root_url}}edit/{{poll.base_url}}'>http://{{root_url}}edit/{{poll.base_url}}</a>
+<a href='http://{{root_url}}poll/{{poll.base_url}}'>http://{{root_url}}poll/{{poll.base_url}}</a>
</td>
<td class='form_description'><p>
{% trans "Copy this address and send it to voters who want to participate to this poll" %}
@@ -30,12 +25,21 @@ it will not be made available.{% endblocktrans %}</p>
<tr>
<td><label>{% trans "Administration url" %}</label></td>
<td>
-<a href='http://{{root_url}}poll/{{poll.admin_url}}'>http://{{root_url}}poll/{{poll.admin_url}}</a>
+<a href='http://{{root_url}}edit/{{poll.admin_url}}'>http://{{root_url}}edit/{{poll.admin_url}}</a>
</td>
<td class='form_description'><p>
{% trans "Address to modify the current poll" %}
</p></td>
</tr>
+ <tr>
+ <td><label>{% trans "Choices administration url" %}</label></td>
+ <td>
+<a href='http://{{root_url}}editChoicesAdmin/{{poll.admin_url}}'>http://{{root_url}}editChoicesAdmin/{{poll.admin_url}}</a>
+ </td>
+ <td class='form_description'><p>
+ {% trans "Address to modify choices of the current poll." %}
+ </p></td>
+ </tr>
{% for field in form %}
{% if field.is_hidden %}
{{field}}
@@ -55,31 +59,4 @@ it will not be made available.{% endblocktrans %}</p>
</table>
</form>
-<h2>{% trans "Choices" %}</h2>
-{% if choices %}<form action="{{admin_url}}" method="post">
-<table class='new_poll'>
- <tr>
- <th>{% trans "Up/down" %}</th><th>{% trans "Label" %}</th><th>{% trans "Limit" %}</th><th>{% trans "Delete?"%}</th>
- </tr>
- {% for choice in choices %}<tr>
- <td><a href='?up_choice={{choice.id}}' class='arrow'>+</a> / <a href='?down_choice={{choice.id}}' class='arrow'>-</a></td><td><input type='text' name='modify_{{choice.id}}' value="{{choice.name}}"/></td><td>{% trans "Limited to"%} <input type='text' name='limit_{{choice.id}}' class='limit'{%if choice.limit%} value='{{choice.limit}}'{%endif%}/> {% trans "vote(s)" %}</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" %}' class='submit'/></td>
- </tr>
-</table>
-</form>{% endif %}
-
-<form action="{{admin_url}}" method="post">
-<table class='new_poll'>
- <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' class='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" %}' class='submit'/></td>
- </tr>
-</table>
-</form>
-
{% endblock %}
diff --git a/templates/editChoices.html b/templates/editChoices.html
new file mode 100644
index 0000000..1082d30
--- /dev/null
+++ b/templates/editChoices.html
@@ -0,0 +1,19 @@
+{% load markup %}
+{% load i18n %}
+
+<h2>{% trans "New choice" %}</h2>
+{%if form_new_choice.errors %} <p class='error'>{{form_new_choice.errors}}</p>{%endif%}
+<form action="{{admin_url}}" method="post">
+{{form_new_choice.poll}}
+{{form_new_choice.order}}
+<table class='new_poll'>
+ <tr>
+ <td class='form_description' colspan='3'><p>{% trans "Setting a new choice. Optionally you can set a limit of vote for this choice. This limit is usefull for limited resources allocation." %}</p></td>
+ </tr>
+ <tr>
+ <td>{{form_new_choice.name}}</td>
+ <td>{%trans "Limited to"%} {{form_new_choice.limit}} {%trans "vote(s)"%}</td>
+ <td><input type='hidden' name='add' value='1'/> <input type='submit' value='{% trans "Add" %}' class='submit'/></td>
+ </tr>
+</table>
+</form>
diff --git a/templates/editChoicesAdmin.html b/templates/editChoicesAdmin.html
new file mode 100644
index 0000000..a668319
--- /dev/null
+++ b/templates/editChoicesAdmin.html
@@ -0,0 +1,42 @@
+{% extends "base.html" %}
+{% load markup %}
+{% load i18n %}
+
+{% block fullscript %}
+<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+{{ form_new_choice.media }}
+{% endblock %}
+
+{% block content %}
+{% if not choices %}<p class='error'>
+{% blocktrans %}As long as no options were added to the poll, it will not be available.{% endblocktrans %}
+</p>{% else %}
+<h2>{% trans "Complete/Finalise the poll" %}</h2>
+<p><a href='http://{{root_url}}edit/{{poll.admin_url}}'><button>{% trans "Next"%}</button></p>
+{% endif %}
+{% include 'editChoices.html' %}
+{% if choices %}
+<h2>{% trans "Available choices" %}</h2>
+<form action="" method="post">
+<table class='new_poll'>
+ <tr>
+ {%if not poll.dated_choices%}<th>{% trans "Up/down" %}</th>{%endif%}
+ <th>{% trans "Label" %}</th>
+ <th>{% trans "Limit" %}</th>
+ <th>{% trans "Delete?"%}</th>
+ </tr>
+ {% for choice in choices %}{{choice.form.poll}}{{choice.form.order}}<tr>
+ {%if not poll.dated_choices%}<td><a href='?up_choice={{choice.id}}' class='arrow'>+</a>
+ / <a href='?down_choice={{choice.id}}' class='arrow'>-</a></td>{%endif%}
+ <td>{{choice.form.name}}</td>
+ <td>{% trans "Limited to"%} {{choice.form.limit}} {% trans "vote(s)" %}</td>
+ <td><input type='checkbox' name='delete_{{choice.id}}'/></td>
+ <td><input type='hidden' name='edit' value='{{choice.id}}'/></td>
+ <td><input type='submit' value='{% trans "Edit" %}' class='submit'/></td>
+ </tr>{% endfor %}
+</table>
+</form>{% endif %}
+
+{% endblock %}
diff --git a/templates/editChoicesUser.html b/templates/editChoicesUser.html
new file mode 100644
index 0000000..bec7384
--- /dev/null
+++ b/templates/editChoicesUser.html
@@ -0,0 +1,31 @@
+{% extends "base.html" %}
+{% load markup %}
+{% load i18n %}
+
+{% block fullscript %}
+<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+{{ form_new_choice.media }}
+{% endblock %}
+
+{% block content %}
+<h2>{% trans "Choices" %}</h2>
+{% if choices %}<table class='new_poll'>
+ <tr>
+ <th>{% trans "Label" %}</th>
+ <th>{% trans "Limit" %}</th>
+ </tr>
+ {% for choice in choices %}<tr>
+ <td>{{choice.name}}</td>
+ <td>{% if choice.limit %}{% trans "Limited to"%} {{choice.limit}} {% trans "vote(s)" %}{% endif %}</td>
+ </tr>{% endfor %}
+ <tr>
+ <td></td>
+ <td><input type='hidden' name='edit' value='1'/>
+ <input type='submit' value='{% trans "Edit" %}' class='submit'/></td>
+ </tr>
+</table>
+</form>{% endif %}
+{% include 'editChoices.html' %}
+{% endblock %}