[chronojump-server] Changed privilege for player creation
- From: Max Ros i Morejon <maxros src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Changed privilege for player creation
- Date: Fri, 28 Jun 2019 12:29:44 +0000 (UTC)
commit b4fb2126a182b4cb7894f49bfcff2e3b578fbc08
Author: Max Ros i Morejon <mros33 gmail com>
Date: Fri Jun 28 14:29:33 2019 +0200
Changed privilege for player creation
.../chronojump_networks/organizations/models.py | 7 +++
.../organizations/groups/group_players_list.html | 2 +-
.../organizations/players/players_list.html | 52 +++++++++++-----------
3 files changed, 34 insertions(+), 27 deletions(-)
---
diff --git a/chronojumpserver-django/chronojump_networks/organizations/models.py
b/chronojumpserver-django/chronojump_networks/organizations/models.py
index b78fec6..d33a53b 100644
--- a/chronojumpserver-django/chronojump_networks/organizations/models.py
+++ b/chronojumpserver-django/chronojump_networks/organizations/models.py
@@ -120,6 +120,13 @@ class User(AbstractUser):
groups = Group.objects.filter(id__in = res_list)
return groups
+ def groups_resp(self):
+ res_list = [r.id for r in self.groups_responsible.all()]
+ if res_list:
+ return True
+ else:
+ return False
+
#def sprint_stations_by_coach(self):
#group_list = [g.group.id for g in self.groups_by_coach.all()]
#group_organizations = Organization.objects.filter(groups__in = group_list)
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 30585bf..28d35de 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
@@ -390,7 +390,7 @@
$('#btnAddModifyTask').text("{% trans 'Add task' %}");
$('#taskModalForm').modal('show');
});
-
+
}
/* Datatable for add players */
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 495003a..f9e353b 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/players/players_list.html
@@ -109,7 +109,7 @@
"data": "weight",
title: "{% trans 'Weight' %}"
},
- {% if user.groups_responsible %}
+ {% if user.groups_resp %}
{
"type": "html",
orderable: false,
@@ -129,33 +129,33 @@
],
"dom": "<'row'<'col-sm-6'B><'col-sm-6'f>>rtip",
buttons: [
- {% if user.groups_responsible %}
- { /* Create Player button */
- text: "{% trans 'Create player' %}",
- className: "btn btn-primary",
- action: function( e, dt, node, config ) {
- newPlayerInitialOperations();
- // Set the title for new player task
- var title = "{% trans 'Create new player '%}";
- $('#playerModalTitle').text(title);
- $('#btnAddModifyPlayer').text("{% trans 'Create player' %}");
- $('#addPlayerModalForm').modal('show');
+ {% if user.groups_resp %}
+ { /* Create Player button */
+ text: "{% trans 'Create player' %}",
+ className: "btn btn-primary",
+ action: function( e, dt, node, config ) {
+ newPlayerInitialOperations();
+ // Set the title for new player task
+ var title = "{% trans 'Create new player '%}";
+ $('#playerModalTitle').text(title);
+ $('#btnAddModifyPlayer').text("{% trans 'Create player' %}");
+ $('#addPlayerModalForm').modal('show');
- }
- },
- { /* Remove Players Button */
- text: "{% trans 'Remove players' %}",
- className: "btn btn-danger disabled removePlayerBtn",
- action: function( e, dt, node, config ) {
- var player_ids = [];
- $.each($('.selectPlayerCheckbox:checked'), function(index, value) {
- var v = $(value);
- player_ids.push(v.attr('data-player-id'));
+ }
+ },
+ { /* Remove Players Button */
+ text: "{% trans 'Remove players' %}",
+ className: "btn btn-danger disabled removePlayerBtn",
+ action: function( e, dt, node, config ) {
+ var player_ids = [];
+ $.each($('.selectPlayerCheckbox:checked'), function(index, value) {
+ var v = $(value);
+ player_ids.push(v.attr('data-player-id'));
- });
- removePlayersFromGroup(player_ids);
- }
- }
+ });
+ removePlayersFromGroup(player_ids);
+ }
+ }
{% endif %}
],
initComplete: function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]