[chronojump-server] Small changes



commit 922c18dd74c49b0b63e95cb5b51d5e244b9cda14
Author: Max Ros i Morejon <mros33 gmail com>
Date:   Wed Jul 10 13:41:32 2019 +0200

    Small changes

 .../organizations/groups/group_players_list.html   | 31 +++++++++++++++-------
 .../organizations/groups/groups_list.html          |  4 +--
 .../organizations/players/players_list.html        | 30 ++++++++++-----------
 .../templates/results/sprints_list.html            |  8 +++---
 chronojumpserver-django/config/settings/base.py    |  4 ++-
 5 files changed, 45 insertions(+), 32 deletions(-)
---
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 a92a861..eec082e 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
@@ -344,6 +344,7 @@
         
 
     $('.task-modify-link').on('click', function() {
+        console.log("1. Click a modify");
         var task_id = $(this).attr('data-task-id');
         var task_type = $(this).attr('data-task-type');
         console.log(task_id);
@@ -357,22 +358,24 @@
         $.ajax({
           url: task_url,
           success: function(task) {
+            console.log("2. Success");
             deserializeTask(task);
+            console.log("12. Ha tornat");
             $('#btnAddModifyTask').text("{% trans 'Update task' %}");
             $('#taskPercentMaxSpeed').prop("disabled", true);
             $('#taskPercentMaxSpeed').val('');
             $('#taskMaxSpeed').val('');
+            $('#gymSelect').val(task.gym);
+            $('#stationSelect').val(task.station);
+            $('#exerciseSelect').val(task.exercise);
+            console.log("exercise nou =" + $('#exerciseSelect').val());
             $('#taskModalForm').modal('show');
-            
           }
         })
 
         
         });
-        
-        $('.task-duplicate-link').on('click', function() {
-            console.log("Clicant duplicar botó");
-        });
+
     
          $('.task-delete-link').on('click', function() {
                //TODO: Ask for confirmation
@@ -569,6 +572,7 @@
 
     /* Load stations from the gym into selectStation control */
     function loadGymStations(gym_id) {
+    console.log("4. LoadGym");
       $('#stationSelect').find('option').remove().end();
 
       $.ajax({
@@ -591,6 +595,7 @@
             // Load exercises from first station loaded
             var station_id = $('#stationSelect option:first').val();
             $('#stationSelect').val(station_id);
+            console.log("5. Crida exercise");
             loadStationExercises(station_id);
           } else {
             // Disable task creation
@@ -620,6 +625,7 @@
         
     /* Load stations from the gym into selectStation control */
     function loadStationExercises(station_id) {
+    console.log("6. Exercise");
       $('#exerciseSelect').find('option').remove().end();
 
       $.ajax({
@@ -628,6 +634,7 @@
           'station_id': station_id
         },
         success: function(data) {
+        
           var count = 0;
                        $.each(data, function(i, item) {
                                count ++;
@@ -641,11 +648,15 @@
             // Load exercises from first station loaded
             $('#exerciseSelect').val($('#exerciseSelect option:first').val());
             console.log("exercise = " + $('#exerciseSelect').val());
+            console.log("7. MaxVel");
             get_maximum_mean_velocity();
           } else {
             // Disable task creation
             console.log("task creation disabled");
           }
+        },
+        error: function (request, status, error) {
+            alert(request.responseText);
         }
       });
     }
@@ -653,6 +664,7 @@
     
     /* Get max velocity when user selects station, exercice and resistance */
     function get_maximum_mean_velocity() {
+        console.log("8. Comença maxVel");
         var resistance = $('#taskLoad').val();
         var stationId = $('#stationSelect').val();
         var personId = $('#personId').val();
@@ -776,13 +788,12 @@
 
     // Dump values from task into Modal Form
     function deserializeTask(task) {
+      console.log("3. deserializeTask");
       console.log(task);
-
-      $('#gymSelect').val(task.gym);
       loadGymStations(task.gym);
-      $('#stationSelect').val(task.station);
+      console.log("9. Torna del stations");
       loadStationExercises(task.station);
-      $('#exerciseSelect').val(task.exercise);
+      console.log("10. Torna del exercises");
       $('#personId').val(task.person);
       $('#numSets').val(task.sets);
       $('#numReps').val(task.nreps);
@@ -795,7 +806,7 @@
       $('#lossByPower').val(task.lossByPower);
       $('#taskId').val(task.id);
       $('#coachId').val(task.coach);
-      
+      console.log("11. Acaba el deserializeTask");
     }
 
     function validateTask(task) {
diff --git a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/groups_list.html 
b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/groups_list.html
index d40c5c7..2daf925 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/groups_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/groups_list.html
@@ -64,8 +64,8 @@
         "dataSrc": ""
       },
       "order": [ 
-       [2, 'asc'],
-        [3, 'asc']
+       [1, 'asc'],
+        [2, 'asc']
       ],
       "columns": [
         {
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 c67599f..1266560 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
@@ -114,7 +114,7 @@
             "orderable":      false,
             "data":           null,
             "defaultContent": '',
-            title: "Player groups",
+            title: "{% trans 'Player groups' %}",
         },
         {% if user.groups_resp %}
             {
@@ -170,20 +170,20 @@
         enablePlayersTableFunctionality(); //TODO: CHECK if this is needed and implemented
       },
       "language": {
-       "lengthMenu": "{% trans 'Showing _MENU_ players per page' %}",
-       "zeroRecords": "{% trans 'There are no players in this group' %}",
-       "info": "{% trans 'Showing the players _START_ to _END_ of a total of _TOTAL_ players' %}",
-       "infoEmpty": "{% trans 'The search returns no results' %}",
-       "infoFiltered": "{% trans '(from a total of _MAX_ players)' %}",
-       "decimal": ",",
-       "thousands": ".",
-       "paginate": {
-               "first": '<i class="fa fa-fast-backward"></i>',
-               "last": '<i class="fa fa-fast-forward"></i>',
-               "next": '<i class="fa fa-forward"></i>',
-               "previous": '<i class="fa fa-backward"></i>'
-       },
-       "search": "{% trans 'Search:' %}"
+        "lengthMenu": "{% trans 'Showing _MENU_ players per page' %}",
+        "zeroRecords": "{% trans 'There are no players in this group' %}",
+        "info": "{% trans 'Showing the players _START_ to _END_ of a total of _TOTAL_ players' %}",
+        "infoEmpty": "{% trans 'The search returns no results' %}",
+        "infoFiltered": "{% trans '(from a total of _MAX_ players)' %}",
+        "decimal": ",",
+        "thousands": ".",
+        "paginate": {
+            "first": '<i class="fa fa-fast-backward"></i>',
+            "last": '<i class="fa fa-fast-forward"></i>',
+            "next": '<i class="fa fa-forward"></i>',
+            "previous": '<i class="fa fa-backward"></i>'
+        },
+        "search": "{% trans 'Search:' %}"
       }
     });
     
diff --git a/chronojumpserver-django/chronojump_networks/templates/results/sprints_list.html 
b/chronojumpserver-django/chronojump_networks/templates/results/sprints_list.html
index 3f30f7b..5b1a352 100644
--- a/chronojumpserver-django/chronojump_networks/templates/results/sprints_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/results/sprints_list.html
@@ -54,7 +54,7 @@
     <label for="playerSelect">{% trans 'Filter by player' %}</label>
     <select name="player" class="form-control" id="playerSelect">
       <option value="all">{% trans 'All players' %}
-      {% for player in user.players_by_coach %}
+      {% for player in user.players_by_coach|dictsort:"name.lower" %}
       <option value={{player.id}}>{{player.name}}</option>
       {% endfor %}
     </select>
@@ -195,7 +195,7 @@
                {
                        type: "html",
                        data: "distances",
-                       title: "{% trans 'Distancia' %}"
+                       title: "{% trans 'Distance' %}"
                },
                {
                        type: "num",
@@ -265,7 +265,7 @@
       buttons: [
         { text: "{% trans 'Export results' %}", className: "btn btn-primary",
                action: function( e, dt, node, config ) {
-                       var columns = ["{% trans 'Date' %}", "{% trans 'Player' %}", "{% trans 'Distancia' 
%}", "t1", "t2", "t3", "t4", "k", "VMax", "AMax", "FMax", "FMax"];
+                       var columns = ["{% trans 'Date' %}", "{% trans 'Player' %}", "{% trans 'Distance' 
%}", "t1", "t2", "t3", "t4", "k", "VMax", "AMax", "FMax", "FMax"];
 
                        var csv = columns.join(";") + "\n";
                        var today = new Date();
@@ -287,7 +287,7 @@
                                date.getYear().toString().substr(-2);
                                csv += dateStr + ";"
                                + data.person + ";"
-                    + data.distancia +";"
+                    + data.distances +";"
                     + data.t1.toString().replace(".", ",") + ";"
                     + data.t2.toString().replace(".", ",") + ";"
                     + data.t3.toString().replace(".", ",") + ";"
diff --git a/chronojumpserver-django/config/settings/base.py b/chronojumpserver-django/config/settings/base.py
index 96b41b4..b323f00 100644
--- a/chronojumpserver-django/config/settings/base.py
+++ b/chronojumpserver-django/config/settings/base.py
@@ -55,7 +55,7 @@ LANGUAGES = (
 )
 
 LOCALE_PATHS = [
-    str(ROOT_DIR.path('locale'))
+    str(ROOT_DIR.path('locale')),
 ]
 
 
@@ -237,4 +237,6 @@ REST_FRAMEWORK = {
     'DEFAULT_PERMISSION_CLASSES': (
         'rest_framework.permissions.IsAdminUser',
     ),
+    'DEFAULT_PAGINATION_CLASS': None,
+    'PAGE_SIZE': None
 }


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