[chronojump-server] Added new default images and solved organization image display



commit e2387453e43909c323c1e83a51d527df64a5c07d
Author: Max Ros i Morejon <mros33 gmail com>
Date:   Mon Apr 8 13:35:10 2019 +0200

    Added new default images and solved organization image display

 .../chronojump_networks/organizations/api/views.py |   4 ++--
 .../chronojump_networks/organizations/models.py    |   4 ++--
 .../chronojump_networks/static/images/ClubLogo.png | Bin 8366 -> 0 bytes
 .../static/images/default_player.png               | Bin 0 -> 16466 bytes
 .../static/images/logo_club.png                    | Bin 0 -> 7576 bytes
 .../chronojump_networks/static/images/player.svg   |  22 ---------------------
 .../organizations/groups/group_players_list.html   |   6 +++++-
 .../templates/organizations/gyms/gym_detail.html   |   6 +++++-
 .../organizations/organization_detail.html         |   2 ++
 .../players/add_edit_player_form.html              |   2 +-
 .../organizations/players/players_list.html        |  10 +++++++---
 .../chronojump_networks/templates/pages/index.html |   2 +-
 .../templates/results/results_list.html            |   6 +++++-
 13 files changed, 30 insertions(+), 34 deletions(-)
---
diff --git a/chronojumpserver-django/chronojump_networks/organizations/api/views.py 
b/chronojumpserver-django/chronojump_networks/organizations/api/views.py
index d243656..4d61d6a 100644
--- a/chronojumpserver-django/chronojump_networks/organizations/api/views.py
+++ b/chronojumpserver-django/chronojump_networks/organizations/api/views.py
@@ -126,7 +126,7 @@ class PlayerListView(ListCreateAPIView):
             photo = data['image'][0]
         except KeyError:
             print("no photo")
-            newimage = '../static/images/player.svg'
+            newimage = '../static/images/default_player.png'
         else:
             print("yes photo")
             photo = data['image'][0]
@@ -163,7 +163,7 @@ class PlayerListView(ListCreateAPIView):
             try:
                 photo = data['image'][0]
             except KeyError:
-                o.image = '../static/images/player.svg'
+                o.image = '../static/images/default_player.png'
             else:
                 photo = data['image'][0]
                 new_photo = photo.name + '_' + str(int(time()))
diff --git a/chronojumpserver-django/chronojump_networks/organizations/models.py 
b/chronojumpserver-django/chronojump_networks/organizations/models.py
index b0af43c..ab1aae4 100644
--- a/chronojumpserver-django/chronojump_networks/organizations/models.py
+++ b/chronojumpserver-django/chronojump_networks/organizations/models.py
@@ -105,7 +105,7 @@ class Organization(ChronojumpBaseModel):
 
     name = models.CharField(max_length=50)
     country = models.CharField(max_length=20, null=True, blank=True)
-    image = models.FileField(upload_to='organizations', blank=True)
+    image = models.FileField(upload_to='organizations', blank=True, 
default='chronojump_networks/static/images/logo_club.png')
     responsible = models.OneToOneField(User,
                                     on_delete=models.SET_NULL,
                                     blank=True,
@@ -219,7 +219,7 @@ class Player(ChronojumpBaseModel):
     height = models.FloatField(default=0)
     weight = models.FloatField(default=0)
     rfid = models.CharField(max_length=23, unique=True)
-    image = models.FileField(upload_to='players', null=True, blank=True, 
default='chronojump_networks/static/images/player.svg')
+    image = models.FileField(upload_to='players', null=True, blank=True, 
default='chronojump_networks/static/images/player.png')
     is_available = models.BooleanField(default=True)
     number = models.IntegerField(null=True,blank=True)
 
diff --git a/chronojumpserver-django/chronojump_networks/static/images/default_player.png 
b/chronojumpserver-django/chronojump_networks/static/images/default_player.png
new file mode 100644
index 0000000..8e8426f
Binary files /dev/null and b/chronojumpserver-django/chronojump_networks/static/images/default_player.png 
differ
diff --git a/chronojumpserver-django/chronojump_networks/static/images/logo_club.png 
b/chronojumpserver-django/chronojump_networks/static/images/logo_club.png
new file mode 100644
index 0000000..43c81b9
Binary files /dev/null and b/chronojumpserver-django/chronojump_networks/static/images/logo_club.png differ
diff --git 
a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html 
b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
index ce68fe3..bc64fc6 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
@@ -16,7 +16,11 @@
 
 <div class="page-header row">
   <div class="col-sm-9">
-    <img src="/media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" height="48px" 
style="margin-top:12px;margin-right:10px;"/>
+    {% if user.organization.image %}
+        <img src="../../../media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% else %}
+        <img src="../../../static/images/logo_club.png" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% endif %}
     <h1 class="display-4">{{group.name}}  <small class="text-muted" style="font-size:32px">{% trans 'Players 
and tasks' %}</small></h1>
   </div>
   <div class="col-sm-3">
diff --git a/chronojumpserver-django/chronojump_networks/templates/organizations/gyms/gym_detail.html 
b/chronojumpserver-django/chronojump_networks/templates/organizations/gyms/gym_detail.html
index bae3f51..81c2e33 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/gyms/gym_detail.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/gyms/gym_detail.html
@@ -16,7 +16,11 @@
 
 <div class="page-header row">
   <div class="col-sm-9">
-    <!--<img src="/media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;"/>-->
+    {% if user.organization.image %}
+        <img src="../../../media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% else %}
+        <img src="../../../static/images/logo_club.png" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% endif %}
     <h1 class="display-4">{{gym.name}}  <small class="text-muted" style="font-size:32px">{% trans 'Stations 
and exercises' %}</small></h1>
   </div>
   <div class="col-sm-3">
diff --git a/chronojumpserver-django/chronojump_networks/templates/organizations/organization_detail.html 
b/chronojumpserver-django/chronojump_networks/templates/organizations/organization_detail.html
index 1d412a8..8183709 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/organization_detail.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/organization_detail.html
@@ -12,6 +12,8 @@
       <h2>{{ object.name }}</h2>
       {% if object.image %}
         <img src="/media/{{ object.image }}" alt="Logo Club"/>
+      {% else %}
+        <img src="../static/images/logo_club.png" alt="Logo Club"/>
       {% endif %}
       <ul>
       {% for coach in object.coaches.all %}
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 d30acc8..383fc38 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
@@ -18,7 +18,7 @@
                                        <div class="row">
           <div class="col-sm-4">
                         <div class="form-group">
-                            <img id="imgView" src="{% static 'images/player.svg' %}" alt="player_image" 
style="width:100%;
+                            <img id="imgView" src="{% static 'images/default_player.png' %}" 
alt="player_image" style="width:100%;
                             height:100%; object-fit: contain">
                         </div>
                                                <div class="form-group col-sm-4">
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 efaf79d..12e2aa8 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
@@ -16,7 +16,11 @@
 
 <div class="page-header row">
   <div class="col-sm-9">
-    <img src="/media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" height="48px" 
style="margin-top:12px;margin-right:10px;"/>
+    {% if user.organization.image %}
+        <img src="../../media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% else %}
+        <img src="../../static/images/logo_club.png" class="img-fluid float-left" width="48px" height="48px" 
style="margin-top:12px;margin-right:10px;" />
+    {% endif %}
     <h1 class="display-4">{% trans 'Players list' %}</h1>
   </div>
 
@@ -82,7 +86,7 @@
                                        var src = value;
                                } else {
                                        // Otherwise show the default player icon
-                                       var src = 'chronojump_networks/static/images/player.svg';
+                                       var src = 'chronojump_networks/static/images/default_player.png';
                                }
                                var html = '<img src="' + src + '" class="img-fluid rounded" width="32px" 
height="32px"/>';
                                return html;
@@ -224,7 +228,7 @@
       $('#number').val('');
       $('#input_rfid').val('');
       $('#id_image').val(null);
-      $("#imgView").attr("src", 'http://localhost:8000/static/images/player.svg');
+      $("#imgView").attr("src", 'http://localhost:8000/static/images/default_player.png');
     }
     
     $('#btn_read_rfid').click(function() {
diff --git a/chronojumpserver-django/chronojump_networks/templates/pages/index.html 
b/chronojumpserver-django/chronojump_networks/templates/pages/index.html
index 0bec00b..5731321 100644
--- a/chronojumpserver-django/chronojump_networks/templates/pages/index.html
+++ b/chronojumpserver-django/chronojump_networks/templates/pages/index.html
@@ -49,7 +49,7 @@
           {% if user.organization.image %}
               <img src="../media/{{ user.organization.image }}" class="img-fluid" height="80px" />
           {% else %}
-              <img src="../static/images/ClubLogo.png" class="img-fluid" height="80px" />
+              <img src="../static/images/logo_club.png" class="img-fluid" height="80px" />
           {% endif %}
       </div>
       <div class="col-md-8" >
diff --git a/chronojumpserver-django/chronojump_networks/templates/results/results_list.html 
b/chronojumpserver-django/chronojump_networks/templates/results/results_list.html
index 47ff685..ce7e23b 100644
--- a/chronojumpserver-django/chronojump_networks/templates/results/results_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/results/results_list.html
@@ -17,7 +17,11 @@
 
 <div class="page-header row">
   <div class="col-sm-9">
-    <img src="/media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" height="48px" 
style="margin-top:12px;margin-right:10px;"/>
+    {% if user.organization.image %}
+        <img src="../media/{{ user.organization.image }}" class="img-fluid float-left" width="48px" 
height="48px" style="margin-top:12px;margin-right:10px;" />
+    {% else %}
+        <img src="../static/images/logo_club.png" class="img-fluid float-left" width="48px" height="48px" 
style="margin-top:12px;margin-right:10px;" />
+    {% endif %}
     <h1 class="display-4">{% trans 'Results' %}  <small class="text-muted" style="font-size:32px">{% trans 
'List' %}</small></h1>
   </div>
   <div class="col-sm-3">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]