[chronojump-server] Implemented a clear player image checkbox
- From: Max Ros i Morejon <maxros src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Implemented a clear player image checkbox
- Date: Fri, 12 Apr 2019 09:48:27 +0000 (UTC)
commit fed1c1950594d6f796829f8c7e3db570784b0727
Author: Max Ros i Morejon <mros33 gmail com>
Date: Fri Apr 12 11:47:38 2019 +0200
Implemented a clear player image checkbox
.../organizations/players/add_edit_player_form.html | 4 ++++
.../templates/organizations/players/players_list.html | 16 +++++++++++++---
2 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git
a/chronojumpserver-django/chronojump_networks/templates/organizations/players/add_edit_player_form.html
b/chronojumpserver-django/chronojump_networks/templates/organizations/players/add_edit_player_form.html
index 383fc38..ce4d3aa 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/players/add_edit_player_form.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/players/add_edit_player_form.html
@@ -21,6 +21,10 @@
<img id="imgView" src="{% static 'images/default_player.png' %}"
alt="player_image" style="width:100%;
height:100%; object-fit: contain">
</div>
+ <div>
+ <input id="chkId" type="checkbox" name="clearImg" value="ClearImg">
+ <label for="chkId">Clear image</label>
+ </div>
<div class="form-group col-sm-4">
<p>
<input id="id_image" type="file" class="" name="image"
enctype='multipart/form-data'>
diff --git a/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
b/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
index 12e2aa8..a42d1a0 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
@@ -228,7 +228,8 @@
$('#number').val('');
$('#input_rfid').val('');
$('#id_image').val(null);
- $("#imgView").attr("src", 'http://localhost:8000/static/images/default_player.png');
+ $('#imgView').prop("src", 'http://localhost:8000/static/images/default_player.png');
+ $('#chkId').prop("checked", false);
}
$('#btn_read_rfid').click(function() {
@@ -264,10 +265,18 @@
})
$('#id_image').on('change', function() {
- //$("#imgView").attr("src", $('#id_image')[0].files[0]);
+ //$("#imgView").prop("src", $('#id_image')[0].files[0]);
image_changed = "True";
})
+ $('#chkId').on('change', function() {
+ if(this.checked) {
+ $('#id_image').val(null);
+ image_changed = "True";
+ console.log("canvi checked");
+ }
+ })
+
// Get all the values in the form into json object
function serializePlayer() {
console.log("id = " + $('#personId').val());
@@ -303,8 +312,9 @@
$('#number').val(player.number);
$('#input_rfid').val(player.rfid);
console.log(player.image);
- $('#imgView').attr("src", player.image);
+ $('#imgView').prop("src", player.image);
$('#id_image').val(player.image.name);
+ $('#chkId').prop("checked", false);
}
function putPlayer(player) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]