basic new event editing, know your role sucka
This commit is contained in:
parent
4bbc7c2cd3
commit
7a84097e84
@ -22,6 +22,7 @@
|
||||
.other { float: right; margin-right:11em; }
|
||||
.score-container { float: right; margin-right:20em;}
|
||||
.nav { font-size: 120%; padding: 4px 0px;}
|
||||
.matchform { border: 1px solid black; }
|
||||
</style>
|
||||
<link href="{% static "assets/css/bootstrap-responsive.css" %}" rel="stylesheet">
|
||||
|
||||
@ -78,6 +79,8 @@
|
||||
<script src="{% static "js/jquery.js" %}"></script>
|
||||
<script src="{% static "js/bootstrap-collapse.js" %}"></script>
|
||||
<script src="{% static "js/bootstrap-dropdown.js" %}"></script>
|
||||
{% block extrascript %} {% endblock %}
|
||||
|
||||
<!--
|
||||
<script src="assets/js/bootstrap-transition.js"></script>
|
||||
<script src="assets/js/bootstrap-alert.js"></script>
|
||||
|
@ -1,4 +1,42 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block extrascript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#addMatch').click(function() {
|
||||
var newform = '<div class="matchform"> \
|
||||
<h4>Match</h4> \
|
||||
<table class="table"> <tbody> \
|
||||
<tr> <th>team #1</th> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-1" value=""> </td> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-1" value=""> </td> \
|
||||
</tr> \
|
||||
<tr> <th>team #2</th> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-2" value=""> </td> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-2" value=""> </td> \
|
||||
</tr> \
|
||||
<tr> <th>team #3</th> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-3" value=""> </td> \
|
||||
<td><input type="text" class="span3" name="members-MATCH_NUM-3" value=""> </td> \
|
||||
</tr> \
|
||||
</tbody> </table> \
|
||||
<label>Outcome</label> <select name="outcome"> \
|
||||
{% for val, name in OUTCOMES %} <option value="{{val}}">{{name}}</option> {% endfor %} \
|
||||
</select> \
|
||||
<label>Winner</label> <input type="text" class="span3" name="winner"> \
|
||||
<label>Title</label> <select name="title"> <option value="">(none)</option> \
|
||||
{% for val, name in TITLES %} <option value="{{val}}"> {{name}}</option> {% endfor %} \
|
||||
</select> <br> \
|
||||
<label>Notes</label> <input type="text" class="span6" name="notes"> \
|
||||
<br> <button class="btn">Add Team</button> <button class="btn">Add Member</button> <button class="btn btn-danger">Delete Match</button> </div>';
|
||||
var num_matches = $('.matchform').length+1;
|
||||
$('#all-matches').append(newform.replace(/MATCH_NUM/g, num_matches));
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<form class="well form-inline" action="." method="post">
|
||||
<label>Show Name</label>
|
||||
@ -6,12 +44,11 @@
|
||||
<input type="text" class="span3" name="name" value="{{event.name}}"
|
||||
placeholder="RAW/Smackdown/PPV Name">
|
||||
<label>Date</label>
|
||||
<input type="text" class="span3" name="date" value="{{event.date}}"
|
||||
placeholder="YYYY-MM-DD">
|
||||
<input type="text" class="span3" name="date" value="{{event.date}}" placeholder="YYYY-MM-DD">
|
||||
<div id="all-matches">
|
||||
{% for match in event.matches %}
|
||||
<!-- match -->
|
||||
<hr>
|
||||
<h4>Match #{{forloop.counter}}</h4>
|
||||
<div class="matchform">
|
||||
<h4>Match</h4>
|
||||
<table class="table">
|
||||
<tbody>
|
||||
{% for team in match.teams %}
|
||||
@ -56,55 +93,11 @@
|
||||
<button class="btn">Add Team</button>
|
||||
<button class="btn">Add Member</button>
|
||||
<button class="btn btn-danger">Delete Match</button>
|
||||
<!-- /match -->
|
||||
</div>
|
||||
{% endfor %}
|
||||
<!-- match clean
|
||||
<hr>
|
||||
<h4>Match #2</h4>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>member #1</th>
|
||||
<th>member #2</th>
|
||||
<th>member #3</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>team #1</th>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>team #2</th>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>team #3</th>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
<td><input type="text" class="span3"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<label>Winner</label>
|
||||
<input type="text" class="span3">
|
||||
<label>Win Type</label>
|
||||
<select>
|
||||
<option>Pin</option>
|
||||
<option>Submission</option>
|
||||
<option>Disqualification</option>
|
||||
</select>
|
||||
<button class="btn">Add Team</button>
|
||||
<button class="btn">Add Member</button>
|
||||
<button class="btn btn-danger">Delete Match</button>
|
||||
/match clean -->
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn">Add Match</button>
|
||||
<button class="btn" id="addMatch">Add Match</button>
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Save Event" class="btn btn-primary"/>
|
||||
</div>
|
||||
|
@ -50,10 +50,13 @@ def edit_event(request, event):
|
||||
'teams': [],
|
||||
})
|
||||
|
||||
for k,v in request.POST.iterlists():
|
||||
for k, team in request.POST.iterlists():
|
||||
if k.startswith('members'):
|
||||
_, match, team = k.split('-')
|
||||
edict['matches'][int(match)-1]['teams'].append(v)
|
||||
_, match, _ = k.split('-')
|
||||
# remove empty strings from team
|
||||
team = [m for m in team if m]
|
||||
if team:
|
||||
edict['matches'][int(match)-1]['teams'].append(team)
|
||||
|
||||
event = Event.from_dict(edict)
|
||||
# score the event for all active leagues
|
||||
|
Loading…
Reference in New Issue
Block a user