euscanwww: Favourite/Unfavourite template code refactored

* Now is more DRY, the JS code and the HTML code are in one place
* It works even without JS

Signed-off-by: volpino <fox91@anche.no>
This commit is contained in:
volpino
2012-11-08 18:57:29 +01:00
parent 9143301875
commit 9f5402f896
13 changed files with 125 additions and 157 deletions

View File

@ -0,0 +1,23 @@
<form class="favourite-form inline"
action="{{ favourite_url }}"
method="POST">
<button type="submit" class="btn favourite-button {% if favourited %}hide{% endif %}">
<img src="{{ STATIC_URL}}/img/watch-icon.png" alt="Watch" />
</button>
<input type="hidden" name="nojs" value="true" />
{% for pk in packages_ids %}
<input type="hidden" name="packages[]" value="{{ pk }}" />
{% endfor %}
</form>
<form class="unfavourite-form inline"
action="{{ unfavourite_url }}"
method="POST">
<button type="submit" class="btn unfavourite-button {% if not favourited %}hide{% endif %}">
<img src="{{ STATIC_URL}}/img/unwatch-icon.png" alt="Unwatch" />
</button>
<input type="hidden" name="nojs" value="true" />
{% for pk in packages_ids %}
<input type="hidden" name="packages[]" value="{{ pk }}" />
{% endfor %}
</form>