Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (83 sloc) 2.9 KB
{% extends "template.html" %}
{% block title %}Puzzles {{ puzzles.display_query }}{% endblock %}
{% block jqueryready %}
$('input#new-puzzle-add').attr('disabled','disabled');
$('input#new-puzzle-title').keyup(function() {
if ($('input#new-puzzle-title').val() == "") {
$('input#new-puzzle-add').attr('disabled','disabled');
} else {
$('input#new-puzzle-add').removeAttr('disabled');
}
});
{% endblock %}
{% block content %}
<h3 class="puzzles_header">Puzzles {{ puzzles.describe_query }}</h3>
<form action="{% url PuzzleCreateHandler %}" method="post">
<table class="puzzle_table">
<tr class="legend">
<th class="puzzle_name">Puzzle</th>
{% for family in families %}
<th class="family_{{family.key.name}}">{{ family.key.name }}</th>
{% endfor %}
<th class="tags">Tags</th>
{% for meta in puzzles.show_metas %}
<th class="meta_{{meta}}">{{ meta }}</th>
{% endfor %}
</tr>
{% for puzzle in puzzles %}
<tr class="{{ puzzle.tags_as_css_classes }} {% cycle puzzle_display_0,puzzle_display_1 %}">
<td class="puzzle_name">
<a href="{% url PuzzleHandler puzzle.key.id %}">{{ puzzle.title|escape }}</a>
</td>
{% for family__option in puzzle.ordered_families %}
<td class="tag_{{ family__option.0.key.name }}_{{ family__option.1}}">
{% if family__option.1 %}
<a href="{% url PuzzleListHandler family__option.2 %}"
>{{ family__option.1 }}</a>
{% endif %}
&nbsp;
</td>
{% endfor %}
<td class="generic_tags">
{% for tag in puzzle.generic_tags %}
<span class="tag_{{tag}}">
<a href="{% url PuzzleListHandler tag %}">{{ tag }}</a>
</span>
{% endfor %}
&nbsp;
</td>
{% for meta in puzzles.show_meta_fields %}
<td class="meta_{{meta}}">
{{ puzzle..meta|escape|urlize }}
&nbsp;
</td>
{% endfor %}
</tr>
{% endfor %}
<tr class="add_puzzle_row">
<td class="puzzle_name">
<input type="text" name="title" id="new-puzzle-title" autocomplete="off"/>
</td>
{% for family in families %}
<td class="tag_{{ family.key.name }}">
<select name="tag_{{ family.key.name }}">
<option></option>
{% for option in family.options %}
<option>{{ option }}</option>
{% endfor %}
</select>
</td>
{% endfor %}
<td class="generic_tags">
<input type="text" name="tags" />
</td>
{% for meta in puzzles.show_meta_fields %}
<td class="meta_{{ meta }}">
<input type="text" name="{{ meta }}" />
</td>
{% endfor %}
</tr>
</table>
<input type="submit" value="add puzzle" class="add_puzzle" id="new-puzzle-add" />
</form>
{% endblock content %}