Skip to content

Commit

Permalink
#73
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHook059 committed Jan 7, 2016
1 parent 86403b6 commit d39199e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
44 changes: 29 additions & 15 deletions hecs/themes/templates/blank.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,35 @@
{% block body %}
<form action="/blank" method="post">
{% csrf_token %}
{% for mark in marks %}
<div class="pad">
{{ mark.0 }}
<select name="{{ mark.0 }}">
{% for i in lst %}
{% if i == mark.1 %}
<option selected>{{ i }}</option>
{% else %}
<option>{{ i }}</option>
{% endif %}
{% endfor %}
</select>
<br>
<div class="home_hex_container">
<div class="hexagon hex_left hex_link hex_button">
<div class="hexagon_button_text">
<br>
<input type="submit" value="Отправить" class="hexagon_button_text">
</div>
</div>
{% endfor %}
<input type="submit" value="Отправить" class="button">
<div class="hexagon divisibleby"></div>
{% for row_id, row in rows %}
{% for col_id, theme, c, solved in row %}
{% if theme == None %}
<div class="hexagon {% if col_id == 0 and row_id|divisibleby:"2" %} hex_left {% endif %}"></div>
{% else %}
<div class="hexagon hex_{{ theme.color }}
{% if col_id == 0 and row_id|divisibleby:"2" %} hex_left {% endif %}
{% if solved %} hex_solved {% endif %}">
<div class="hexagon_text"><table><tr><td>{{ theme.name }}<br><select name="{{ theme.name }}">
{% for i in lst %}
{% if i == c %}
<option selected>{{ i }}</option>
{% else %}
<option>{{ i }}</option>
{% endif %}
{% endfor %}
</select></td></tr></table></div></div>
{% endif %}
{% endfor %}
{% endfor %}

</div>
</form>
{% endblock %}
24 changes: 15 additions & 9 deletions hecs/themes/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,24 @@ def blank_page(request):

return redirect('/')

marks = []
marks = {}

for form in forms:
mark = (form.theme.name, form.result)
marks.append(mark)
marks[form.theme.name] = form.result
themes.remove(form.theme)

themes = Theme.objects.all()
rows = []
for row in range(HOMEPAGE_ROWS):
rows.append([row, [[col, None, 0] for col in range(HOMEPAGE_COLS)]])
for theme in themes:
mark = (theme.name, '')
marks.append(mark)
try:
rows[theme.x][1][theme.y][1] = theme
rows[theme.x][1][theme.y][2] = marks[theme.name]
except IndexError:
pass
rows[0][1] = rows[0][1][2:]

marks.sort()
return render(request, 'blank.html', {'marks': marks,
'lst': ['', '1', '2', '3', '4', '5'],
'id': user.id})
return render(request, 'blank.html', {'lst': ['', '1', '2', '3', '4', '5'],
'id': user.id,
'rows': rows})

0 comments on commit d39199e

Please sign in to comment.