Skip to content

Commit

Permalink
fix tournament form
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 8, 2015
1 parent b18a82d commit aeb78f8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
27 changes: 1 addition & 26 deletions app/views/tournament/form.scala.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,7 @@
@import config._

@moreJs = {
<script>
$(function() {
var $check = $('#tournament #isprivate');
var $time = $('#tournament tr.time td');
var $minutes = $('#tournament tr.minutes td');
function showPrivate() {
if ($check.prop('checked')) {
$time.html($('#tournament .private_time').html());
$minutes.html($('#tournament .private_minutes').html());
} else {
$time.html($('#tournament .public_time').html());
$minutes.html($('#tournament .public_minutes').html());
}
};
$check.on('change', showPrivate);
showPrivate();

var $variant = $('#tournament tr.variant select');
var $position = $('#tournament tr.position');
function showPosition() {
$position.show($variant.val() == 1);
};
$variant.on('change', showPosition);
showPosition();
})
</script>
@jsTag("tournamentForm.js")
}

@tournament.layout(
Expand Down
24 changes: 24 additions & 0 deletions public/javascripts/tournamentForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$(function() {
var $check = $('#tournament #isprivate');
var $time = $('#tournament tr.time td');
var $minutes = $('#tournament tr.minutes td');
function showPrivate() {
if ($check.prop('checked')) {
$time.html($('#tournament .private_time').html());
$minutes.html($('#tournament .private_minutes').html());
} else {
$time.html($('#tournament .public_time').html());
$minutes.html($('#tournament .public_minutes').html());
}
};
$check.on('change', showPrivate);
showPrivate();

var $variant = $('#tournament tr.variant select');
var $position = $('#tournament tr.position');
function showPosition() {
$position.toggle($variant.val() == 1);
};
$variant.on('change', showPosition);
showPosition();
});

0 comments on commit aeb78f8

Please sign in to comment.