diff --git a/benchcoach/templates/base.html b/benchcoach/templates/base.html index 74d6118..e7acc17 100644 --- a/benchcoach/templates/base.html +++ b/benchcoach/templates/base.html @@ -28,8 +28,6 @@ - - {% endblock javascript %} diff --git a/config/settings/base.py b/config/settings/base.py index c1b3d3e..fbd12aa 100644 --- a/config/settings/base.py +++ b/config/settings/base.py @@ -272,5 +272,5 @@ SOCIALACCOUNT_FORMS = {"signup": "benchcoach.users.forms.UserSocialSignupForm"} # Your stuff... # ------------------------------------------------------------------------------ -INSTALLED_APPS += ["teamsnap", "instagen"] +INSTALLED_APPS += ["teamsnap", "instagen", "teamsnap.lineup"] SOCIALACCOUNT_PROVIDERS = {"teamsnap": {"SCOPE": ["read", "write"]}} diff --git a/teamsnap/lineup/__init__.py b/teamsnap/lineup/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/teamsnap/lineup/apps.py b/teamsnap/lineup/apps.py new file mode 100644 index 0000000..01c53a2 --- /dev/null +++ b/teamsnap/lineup/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class LineupConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "teamsnap.lineup" diff --git a/teamsnap/lineup/forms.py b/teamsnap/lineup/forms.py new file mode 100644 index 0000000..efe9623 --- /dev/null +++ b/teamsnap/lineup/forms.py @@ -0,0 +1,48 @@ +from django import forms +from django.forms import formset_factory + + +class LineupEntryForm(forms.Form): + member = None + availability = None + lineup_entry = None + + event_lineup_entry_id = forms.Field(required=False) + event_lineup_id = forms.Field(required=False) + event_id = forms.Field() + member_id = forms.Field() + position_only = forms.BooleanField(initial=False, required=False) + sequence = forms.IntegerField(required=False) + label = forms.ChoiceField( + required=False, + choices=[ + ("", "--"), + ("P", "P"), + ("C", "C"), + ("1B", "1B"), + ("2B", "2B"), + ("3B", "3B"), + ("SS", "SS"), + ("LF", "LF"), + ("CF", "CF"), + ("RF", "RF"), + ("DH", "DH"), + ("DR", "DR"), + ("EH", "EH"), + ], + widget=forms.Select(attrs={"onchange": "positionSelectChanged(this);"}), + ) + + +LineupEntryFormset = formset_factory( + LineupEntryForm, can_delete=True, can_order=True, extra=0 +) + + +class EventChooseForm(forms.Form): + event_id = forms.ChoiceField() + + +LineupEntryFormset = formset_factory( + LineupEntryForm, can_delete=True, can_order=True, extra=0 +) diff --git a/teamsnap/lineup/migrations/__init__.py b/teamsnap/lineup/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/benchcoach/static/js/project.js b/teamsnap/lineup/static/lineup/js/lineup.js similarity index 97% rename from benchcoach/static/js/project.js rename to teamsnap/lineup/static/lineup/js/lineup.js index 5d43766..9687854 100644 --- a/benchcoach/static/js/project.js +++ b/teamsnap/lineup/static/lineup/js/lineup.js @@ -8,8 +8,6 @@ function positionSelectChanged(elem) { function colorPositions() { for (bcLineup of document.getElementsByClassName("benchcoach-lineup")) { var player_rows = bcLineup.querySelectorAll('tr'); - // player_rows.push.apply(player_rows, document.getElementsByClassName('benchcoach-lineup').querySelectorAll('tr')); - // player_rows.push.apply(player_rows, document.getElementsByClassName('benchcoach-bench').querySelectorAll('tr')); var label_value_array = [] player_rows.forEach(function (player_row, index) { if (player_row.querySelector('[name$="label"]')) { @@ -30,9 +28,7 @@ function colorPositions() { } position_status.classList.add('text-danger') } - // console.dir(position_status) }) - // console.dir(label_value_array) } } diff --git a/teamsnap/lineup/static/lineup/teamsnap.svg b/teamsnap/lineup/static/lineup/teamsnap.svg new file mode 100644 index 0000000..1565893 --- /dev/null +++ b/teamsnap/lineup/static/lineup/teamsnap.svg @@ -0,0 +1 @@ + diff --git a/teamsnap/templates/lineup/multiple_choose.html b/teamsnap/lineup/templates/lineup/multiple_choose.html similarity index 100% rename from teamsnap/templates/lineup/multiple_choose.html rename to teamsnap/lineup/templates/lineup/multiple_choose.html diff --git a/teamsnap/templates/lineup/multiple_edit.html b/teamsnap/lineup/templates/lineup/multiple_edit.html similarity index 98% rename from teamsnap/templates/lineup/multiple_edit.html rename to teamsnap/lineup/templates/lineup/multiple_edit.html index 006fd4d..02fdf06 100644 --- a/teamsnap/templates/lineup/multiple_edit.html +++ b/teamsnap/lineup/templates/lineup/multiple_edit.html @@ -35,13 +35,12 @@ - {% endblock %} {% block inline_javascript %} {{ block.super }} - + - -{% endblock %} diff --git a/teamsnap/templates/lineup/multiple_choose_2.html b/teamsnap/templates/lineup/multiple_choose_2.html deleted file mode 100644 index a21bccf..0000000 --- a/teamsnap/templates/lineup/multiple_choose_2.html +++ /dev/null @@ -1,45 +0,0 @@ -{% extends "base.html" %}{% load static %} -{% block title %} {{ title }}{% endblock %} - -{% csrf_token %} - -{% block page_heading %} -