aa-fleetfinder 0.1.0a12__py3-none-any.whl → 3.0.0b2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aa_fleetfinder-3.0.0b2.dist-info/METADATA +820 -0
- aa_fleetfinder-3.0.0b2.dist-info/RECORD +86 -0
- {aa_fleetfinder-0.1.0a12.dist-info → aa_fleetfinder-3.0.0b2.dist-info}/WHEEL +1 -2
- fleetfinder/__init__.py +19 -0
- fleetfinder/app_settings.py +20 -0
- fleetfinder/apps.py +22 -0
- fleetfinder/auth_hooks.py +58 -0
- fleetfinder/locale/cs_CZ/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/cs_CZ/LC_MESSAGES/django.po +296 -0
- fleetfinder/locale/de/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/de/LC_MESSAGES/django.po +306 -0
- fleetfinder/locale/django.pot +303 -0
- fleetfinder/locale/es/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/es/LC_MESSAGES/django.po +319 -0
- fleetfinder/locale/fr_FR/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/fr_FR/LC_MESSAGES/django.po +314 -0
- fleetfinder/locale/it_IT/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/it_IT/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/ja/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ja/LC_MESSAGES/django.po +303 -0
- fleetfinder/locale/ko_KR/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ko_KR/LC_MESSAGES/django.po +337 -0
- fleetfinder/locale/nl_NL/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/nl_NL/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/pl_PL/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/pl_PL/LC_MESSAGES/django.po +298 -0
- fleetfinder/locale/ru/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/ru/LC_MESSAGES/django.po +319 -0
- fleetfinder/locale/sk/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/sk/LC_MESSAGES/django.po +294 -0
- fleetfinder/locale/uk/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/uk/LC_MESSAGES/django.po +310 -0
- fleetfinder/locale/zh_Hans/LC_MESSAGES/django.mo +0 -0
- fleetfinder/locale/zh_Hans/LC_MESSAGES/django.po +319 -0
- fleetfinder/migrations/0001_initial.py +72 -0
- fleetfinder/migrations/0002_esi_error_handling_and_verbose_names.py +92 -0
- fleetfinder/migrations/0003_alter_fleet_fleet_commander_alter_fleet_groups_and_more.py +46 -0
- fleetfinder/migrations/__init__.py +0 -0
- fleetfinder/models.py +95 -0
- fleetfinder/providers.py +32 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.css +31 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.min.css +2 -0
- fleetfinder/static/fleetfinder/css/fleetfinder.min.css.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.js +86 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-dashboard.min.js.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.js +154 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder-fleet-details.min.js.map +1 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.js +23 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.min.js +2 -0
- fleetfinder/static/fleetfinder/js/fleetfinder.min.js.map +1 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.css +477 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css +2 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/css/slimselect.min.css.map +1 -0
- fleetfinder/static/fleetfinder/libs/slim-select/2.6.0/js/slimselect.min.js +1 -0
- fleetfinder/tasks.py +554 -0
- fleetfinder/templates/fleetfinder/base.html +43 -0
- fleetfinder/templates/fleetfinder/bundles/css/fleetfinder-css.html +3 -0
- fleetfinder/templates/fleetfinder/bundles/css/slim-select-css.html +3 -0
- fleetfinder/templates/fleetfinder/bundles/js/fleetfinder-js.html +9 -0
- fleetfinder/templates/fleetfinder/bundles/js/slim-select-js.html +3 -0
- fleetfinder/templates/fleetfinder/create-fleet.html +42 -0
- fleetfinder/templates/fleetfinder/dashboard.html +53 -0
- fleetfinder/templates/fleetfinder/edit-fleet.html +42 -0
- fleetfinder/templates/fleetfinder/fleet-details.html +102 -0
- fleetfinder/templates/fleetfinder/join-fleet.html +68 -0
- fleetfinder/templates/fleetfinder/modals/kick-fleet-member.html +46 -0
- fleetfinder/templates/fleetfinder/partials/body/form-fleet-details.html +50 -0
- fleetfinder/templates/fleetfinder/partials/footer/app-translation-footer.html +11 -0
- fleetfinder/templates/fleetfinder/partials/header/header-nav-left.html +9 -0
- fleetfinder/templates/fleetfinder/partials/header/header-nav-right.html +18 -0
- fleetfinder/templatetags/__init__.py +3 -0
- fleetfinder/templatetags/fleetfinder.py +33 -0
- fleetfinder/tests/__init__.py +41 -0
- fleetfinder/tests/test_access.py +74 -0
- fleetfinder/tests/test_auth_hooks.py +79 -0
- fleetfinder/tests/test_settings.py +38 -0
- fleetfinder/tests/test_tasks.py +1116 -0
- fleetfinder/tests/test_templatetags.py +65 -0
- fleetfinder/tests/test_user_agent.py +88 -0
- fleetfinder/tests/test_views.py +1184 -0
- fleetfinder/tests/utils.py +58 -0
- fleetfinder/urls.py +45 -0
- fleetfinder/views.py +631 -0
- aa_fleetfinder-0.1.0a12.dist-info/METADATA +0 -50
- aa_fleetfinder-0.1.0a12.dist-info/RECORD +0 -5
- aa_fleetfinder-0.1.0a12.dist-info/top_level.txt +0 -1
- {aa_fleetfinder-0.1.0a12.dist-info → aa_fleetfinder-3.0.0b2.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{% extends "fleetfinder/base.html" %}
|
|
2
|
+
|
|
3
|
+
{% load aa_i18n %}
|
|
4
|
+
{% load i18n %}
|
|
5
|
+
|
|
6
|
+
{% block aa_fleetfinder_body %}
|
|
7
|
+
<div class="card card-default border-0">
|
|
8
|
+
<div class="card-header card-default">
|
|
9
|
+
<div class="card-title mb-0">
|
|
10
|
+
{% translate "Fleets available to you" %}
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="card-body">
|
|
15
|
+
<div class="table-responsive">
|
|
16
|
+
<table class="table table-striped table-hover table-vertical-middle" id="table_available-fleets" style="width: 100%;">
|
|
17
|
+
<thead>
|
|
18
|
+
<tr>
|
|
19
|
+
<th>{% translate "Fleet commander" %}</th>
|
|
20
|
+
<th>{% translate "Fleet name" %}</th>
|
|
21
|
+
<th>{% translate "Created at" %}</th>
|
|
22
|
+
<th class="text-end"><!-- {% translate "Join" %} --></th>
|
|
23
|
+
</tr>
|
|
24
|
+
</thead>
|
|
25
|
+
|
|
26
|
+
<tbody></tbody>
|
|
27
|
+
</table>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
{% endblock %}
|
|
32
|
+
|
|
33
|
+
{% block extra_css %}
|
|
34
|
+
{% include "bundles/datatables-css-bs5.html" %}
|
|
35
|
+
{% include "fleetfinder/bundles/css/fleetfinder-css.html" %}
|
|
36
|
+
{% endblock %}
|
|
37
|
+
|
|
38
|
+
{% block extra_javascript %}
|
|
39
|
+
{% include "bundles/datatables-js-bs5.html" %}
|
|
40
|
+
{% include "bundles/moment-js.html" with locale=True %}
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
const aaFleetFinderSettingsOverride = {
|
|
44
|
+
dataTables: {
|
|
45
|
+
url: {
|
|
46
|
+
dashboard: '{% url "fleetfinder:ajax_dashboard" %}'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
{% include "fleetfinder/bundles/js/fleetfinder-js.html" with view="dashboard" %}
|
|
53
|
+
{% endblock %}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{% extends "fleetfinder/base.html" %}
|
|
2
|
+
|
|
3
|
+
{% load i18n %}
|
|
4
|
+
|
|
5
|
+
{% block page_title %}
|
|
6
|
+
{% translate "Edit fleet" as page_title %}
|
|
7
|
+
{{ page_title|title }} » {% translate "Fleet Finder" %}
|
|
8
|
+
{% endblock %}
|
|
9
|
+
|
|
10
|
+
{% block aa_fleetfinder_body %}
|
|
11
|
+
<div class="card card-primary border-0">
|
|
12
|
+
<div class="card-header card-default">
|
|
13
|
+
<div class="card-title mb-0">
|
|
14
|
+
{% translate "Edit fleet" %}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="card-body container">
|
|
19
|
+
<div class="row">
|
|
20
|
+
<div class="align-self-center">
|
|
21
|
+
{% include "fleetfinder/partials/body/form-fleet-details.html" with name=fleet.name origin="edit" groups=fleet.groups.all %}
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
{% endblock %}
|
|
27
|
+
|
|
28
|
+
{% block extra_css %}
|
|
29
|
+
{% include "fleetfinder/bundles/css/slim-select-css.html" %}
|
|
30
|
+
{% include "fleetfinder/bundles/css/fleetfinder-css.html" %}
|
|
31
|
+
{% endblock %}
|
|
32
|
+
|
|
33
|
+
{% block extra_javascript %}
|
|
34
|
+
{% include "fleetfinder/bundles/js/slim-select-js.html" %}
|
|
35
|
+
|
|
36
|
+
<script>
|
|
37
|
+
new SlimSelect({
|
|
38
|
+
select: '#groups',
|
|
39
|
+
hideSelectedOption: true
|
|
40
|
+
});
|
|
41
|
+
</script>
|
|
42
|
+
{% endblock %}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
{% extends "fleetfinder/base.html" %}
|
|
2
|
+
|
|
3
|
+
{% load aa_i18n %}
|
|
4
|
+
{% load i18n %}
|
|
5
|
+
|
|
6
|
+
{% block page_title %}
|
|
7
|
+
{% translate "Fleet details" %} » {% translate "Fleet Finder" %}
|
|
8
|
+
{% endblock %}
|
|
9
|
+
|
|
10
|
+
{% block aa_fleetfinder_body %}
|
|
11
|
+
{% include "framework/header/page-header.html" with title=fleet.name subtitle=fleet.fleet_commander.character_name %}
|
|
12
|
+
|
|
13
|
+
<div class="alert alert-warning d-none" id="fleetfinder-fleet-details-warning"></div>
|
|
14
|
+
|
|
15
|
+
<div class="row">
|
|
16
|
+
<div class="col-lg-6 col-lg-push-6">
|
|
17
|
+
<div class="card card-primary">
|
|
18
|
+
<div class="card-header">
|
|
19
|
+
<div class="card-title mb-0">
|
|
20
|
+
{% translate "Fleet composition" %}
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<div class="card-body">
|
|
25
|
+
<div class="table-responsive">
|
|
26
|
+
<table class="table table-striped table-hover table-vertical-middle w-100" id="table-fleet-composition">
|
|
27
|
+
<thead>
|
|
28
|
+
<tr>
|
|
29
|
+
<th>{% translate "Ship class" %}</th>
|
|
30
|
+
<th>{% translate "Count" %}</th>
|
|
31
|
+
</tr>
|
|
32
|
+
</thead>
|
|
33
|
+
|
|
34
|
+
<tbody></tbody>
|
|
35
|
+
</table>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
|
|
41
|
+
<div class="col-lg-6 col-lg-pull-6">
|
|
42
|
+
<div class="card card-primary">
|
|
43
|
+
<div class="card-header">
|
|
44
|
+
<div class="card-title mb-0">
|
|
45
|
+
{% translate "Fleet members" %}
|
|
46
|
+
</div>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<div class="card-body">
|
|
50
|
+
<div class="table-responsive">
|
|
51
|
+
<table class="table table-striped table-hover table-vertical-middle w-100" id="table-fleet-members">
|
|
52
|
+
<thead>
|
|
53
|
+
<tr>
|
|
54
|
+
<th>{% translate "Name" %}</th>
|
|
55
|
+
<th>{% translate "Ship class" %}</th>
|
|
56
|
+
<th>{% translate "System" %}</th>
|
|
57
|
+
<th><!-- {% translate "Action" %} --></th>
|
|
58
|
+
</tr>
|
|
59
|
+
</thead>
|
|
60
|
+
|
|
61
|
+
<tbody></tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
|
|
69
|
+
{% include "fleetfinder/modals/kick-fleet-member.html" %}
|
|
70
|
+
{% endblock %}
|
|
71
|
+
|
|
72
|
+
{% block extra_css %}
|
|
73
|
+
{% include "bundles/datatables-css-bs5.html" %}
|
|
74
|
+
{% include "fleetfinder/bundles/css/fleetfinder-css.html" %}
|
|
75
|
+
{% endblock %}
|
|
76
|
+
|
|
77
|
+
{% block extra_javascript %}
|
|
78
|
+
{% include "bundles/datatables-js-bs5.html" %}
|
|
79
|
+
|
|
80
|
+
{% translate "Fleet boss" as l10nFleetBoss %}
|
|
81
|
+
{% translate "Kick member from fleet" as l10nKickMemberFromFleet %}
|
|
82
|
+
{% translate "An unknown error occurred." as l10nUnknownError %}
|
|
83
|
+
|
|
84
|
+
<script>
|
|
85
|
+
const aaFleetFinderSettingsOverride = {
|
|
86
|
+
dataTables: {
|
|
87
|
+
url: {
|
|
88
|
+
fleetDetails: '{% url "fleetfinder:ajax_fleet_details" fleet.fleet_id %}',
|
|
89
|
+
kickFleetMember: '{% url "fleetfinder:ajax_fleet_kick_member" fleet.fleet_id %}'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
l10n: {
|
|
93
|
+
fleetBoss: '{{ l10nFleetBoss|escapejs }}',
|
|
94
|
+
kickMemberFromFleet: '{{ l10nKickMemberFromFleet|escapejs }}',
|
|
95
|
+
unknownError: '{{ l10nUnknownError|escapejs }}'
|
|
96
|
+
},
|
|
97
|
+
csrfToken: '{{ csrf_token }}'
|
|
98
|
+
};
|
|
99
|
+
</script>
|
|
100
|
+
|
|
101
|
+
{% include "fleetfinder/bundles/js/fleetfinder-js.html" with view="fleet-details" %}
|
|
102
|
+
{% endblock %}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{% extends "fleetfinder/base.html" %}
|
|
2
|
+
|
|
3
|
+
{% load i18n %}
|
|
4
|
+
|
|
5
|
+
{% block page_title %}
|
|
6
|
+
{% translate "Join fleet" as page_title %}
|
|
7
|
+
{{ page_title|title }} » {% translate "Fleet Finder" %}
|
|
8
|
+
{% endblock %}
|
|
9
|
+
|
|
10
|
+
{% block aa_fleetfinder_body %}
|
|
11
|
+
<div class="card card-primary border-0">
|
|
12
|
+
<div class="card-header">
|
|
13
|
+
<div class="card-title mb-0">
|
|
14
|
+
{% translate "Fleet invitation" %}
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="card-body container">
|
|
19
|
+
<div class="row">
|
|
20
|
+
<div class="align-self-center">
|
|
21
|
+
<p>
|
|
22
|
+
{% translate "Please ensure you don't have any CSPA charges set on your characters, as this will prevent fleet invites from being sent." %}
|
|
23
|
+
<br>
|
|
24
|
+
{% translate "You can select multiple characters to invite them all at once." %}
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
<p>
|
|
28
|
+
{% translate "The selected characters will receive a fleet invite in-game, which they can accept to join the fleet." %}
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
<form class="form-signin" role="form" action="" method="POST">
|
|
32
|
+
{% csrf_token %}
|
|
33
|
+
|
|
34
|
+
<div class="mb-3">
|
|
35
|
+
<label for="character_ids" class="mb-1">{% translate "Please select the characters you want to invite:" %}</label>
|
|
36
|
+
|
|
37
|
+
<select class="multiselect-ui" multiple="multiple" name="character_ids" id="character_ids">
|
|
38
|
+
{% for character in characters %}
|
|
39
|
+
<option value="{{ character.character_id }}" >{{ character.character_name }}</option>
|
|
40
|
+
{% endfor %}
|
|
41
|
+
</select>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<button class="btn btn-primary btn-block" style="margin-top: 10px;" type="submit">
|
|
45
|
+
{% translate "Send fleet invites" %}
|
|
46
|
+
</button>
|
|
47
|
+
</form>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
</div>
|
|
52
|
+
{% endblock %}
|
|
53
|
+
|
|
54
|
+
{% block extra_css %}
|
|
55
|
+
{% include "fleetfinder/bundles/css/slim-select-css.html" %}
|
|
56
|
+
{% include "fleetfinder/bundles/css/fleetfinder-css.html" %}
|
|
57
|
+
{% endblock %}
|
|
58
|
+
|
|
59
|
+
{% block extra_javascript %}
|
|
60
|
+
{% include "fleetfinder/bundles/js/slim-select-js.html" %}
|
|
61
|
+
|
|
62
|
+
<script>
|
|
63
|
+
new SlimSelect({
|
|
64
|
+
select: '#character_ids',
|
|
65
|
+
hideSelectedOption: true
|
|
66
|
+
});
|
|
67
|
+
</script>
|
|
68
|
+
{% endblock %}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{% load bootstrap %}
|
|
2
|
+
{% load i18n %}
|
|
3
|
+
|
|
4
|
+
<!-- kick fleet member modal -->
|
|
5
|
+
<div class="modal fade" id="kick-fleet-member" tabindex="-1" role="dialog" aria-hidden="true">
|
|
6
|
+
<div class="modal-dialog modal-dialog-centered" role="document">
|
|
7
|
+
<div class="modal-content">
|
|
8
|
+
<div class="modal-header">
|
|
9
|
+
<div class="modal-title fs-5">
|
|
10
|
+
{% translate "Kick member from fleet" %}
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% translate 'Close' %}"></button>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<div class="modal-body">
|
|
17
|
+
<p>
|
|
18
|
+
{% translate "Are you sure you want to kick this member from the fleet?" %}
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p>
|
|
22
|
+
<strong id="kick-fleet-member-character-name"></strong>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p class="aa-callout aa-callout-danger modal-kick-fleet-member-error d-none">
|
|
26
|
+
<i class="fa-solid fa-triangle-exclamation"></i>
|
|
27
|
+
{% translate "Error" %}
|
|
28
|
+
<br>
|
|
29
|
+
<span class="modal-kick-fleet-member-error-message"></span>
|
|
30
|
+
</p>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="modal-footer">
|
|
34
|
+
<button id="modal-button-cancel-kick-fleet-member" type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">
|
|
35
|
+
<i class="fa-regular fa-hand"></i>
|
|
36
|
+
{% translate "Cancel" %}
|
|
37
|
+
</button>
|
|
38
|
+
|
|
39
|
+
<button id="modal-button-confirm-kick-fleet-member" type="button" class="btn btn-success btn-sm">
|
|
40
|
+
<i class="fa-solid fa-check"></i>
|
|
41
|
+
{% translate "Confirm" %}
|
|
42
|
+
</button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{% load i18n %}
|
|
2
|
+
|
|
3
|
+
<form class="form-signin" role="form" action="{% url 'fleetfinder:save_fleet' %}" method="POST">
|
|
4
|
+
{% csrf_token %}
|
|
5
|
+
|
|
6
|
+
<input type="hidden" name="character_id" id="character_id" value="{{ character_id }}">
|
|
7
|
+
<input type="hidden" name="origin" id="origin" value="{{ origin }}">
|
|
8
|
+
|
|
9
|
+
<div class="mb-3">
|
|
10
|
+
<label for="name" class="control-label">{% translate "Fleet name" %}</label>
|
|
11
|
+
<input type="text" class="form-control" name="name" id="name" {% if name %}value="{{ name }}"{% endif %}>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="mb-3">
|
|
15
|
+
<label for="groups" style="margin-bottom: 0;">{% translate "Select groups" %}</label>
|
|
16
|
+
|
|
17
|
+
<select name="groups" id="groups" multiple>
|
|
18
|
+
{% for group in auth_groups %}
|
|
19
|
+
{% if groups %}
|
|
20
|
+
{% if group in groups %}
|
|
21
|
+
<option value="{{ group.group_id }}" selected>{{ group }}</option>
|
|
22
|
+
{% else %}
|
|
23
|
+
<option value="{{ group.group_id }}">{{ group }}</option>
|
|
24
|
+
{% endif %}
|
|
25
|
+
{% else %}
|
|
26
|
+
<option value="{{ group.group_id }}">{{ group }}</option>
|
|
27
|
+
{% endif %}
|
|
28
|
+
{% endfor %}
|
|
29
|
+
</select>
|
|
30
|
+
|
|
31
|
+
<p class="help-block text-muted small">
|
|
32
|
+
{% translate "Only selected groups will have access to the fleet. If no groups are selected the fleet will be available to all who have access to this module." %}
|
|
33
|
+
</p>
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
{# <div class="mb-3">#}
|
|
37
|
+
{# <label for="motd" class="control-label">{% translate "Fleet MOTD" %}</label>#}
|
|
38
|
+
{##}
|
|
39
|
+
{# <div>#}
|
|
40
|
+
{# <textarea class="form-control" name="motd" id="motd" rows="10">{% if motd %}{{ motd }}{% endif %}</textarea>#}
|
|
41
|
+
{# </div>#}
|
|
42
|
+
{# </div>#}
|
|
43
|
+
|
|
44
|
+
<div class="mb-3">
|
|
45
|
+
<input type="checkbox" style="margin-right: 5px;" class="form-check-input" name="free_move" id="free_move" {% if fleet.is_free_move %}checked{% endif %}>
|
|
46
|
+
<label for="free_move" class="form-check-label">{% translate "Enable free move" %}</label>
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
<button class="btn btn-primary btn-block" type="submit">{% translate "Submit" %}</button>
|
|
50
|
+
</form>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{% load i18n %}
|
|
2
|
+
|
|
3
|
+
<div class="app-translation-footer text-muted">
|
|
4
|
+
<p class="small">
|
|
5
|
+
{% translate "Do you want to help translate this app into your language or improve the existing translation?" %}
|
|
6
|
+
-
|
|
7
|
+
<a href="https://weblate.ppfeufer.de/engage/alliance-auth-apps/" target="_blank" rel="noopener noreferer">
|
|
8
|
+
{% translate "Join our team of translators!" %}
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{% load navactive %}
|
|
2
|
+
{% load i18n %}
|
|
3
|
+
|
|
4
|
+
<li class="nav-item">
|
|
5
|
+
<a class="nav-link {% navactive request 'fleetfinder:dashboard' %}" href="{% url 'fleetfinder:dashboard' %}">
|
|
6
|
+
{% translate "Available fleets" as navigation_item %}
|
|
7
|
+
{{ navigation_item|title }}
|
|
8
|
+
</a>
|
|
9
|
+
</li>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{% load i18n %}
|
|
2
|
+
|
|
3
|
+
{% if perms.fleetfinder.manage_fleets %}
|
|
4
|
+
{% translate "Create fleet" as navigation_item %}
|
|
5
|
+
|
|
6
|
+
<li class="nav-item">
|
|
7
|
+
<a class="nav-link py-lg-0" href="{% url 'fleetfinder:create_fleet' %}">
|
|
8
|
+
<span class="btn btn-success btn-add-bulletin d-none d-lg-inline-block">
|
|
9
|
+
{{ navigation_item|title }}
|
|
10
|
+
</span>
|
|
11
|
+
|
|
12
|
+
<span class="d-inline-block d-lg-none">
|
|
13
|
+
<i class="fa-solid fa-plus me-2"></i>
|
|
14
|
+
{{ navigation_item|title }}
|
|
15
|
+
</span>
|
|
16
|
+
</a>
|
|
17
|
+
</li>
|
|
18
|
+
{% endif %}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Versioned static URLs to break browser caches when changing the app version
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Django
|
|
6
|
+
from django.template.defaulttags import register
|
|
7
|
+
|
|
8
|
+
# Alliance Auth
|
|
9
|
+
from allianceauth.services.hooks import get_extension_logger
|
|
10
|
+
|
|
11
|
+
# Alliance Auth (External Libs)
|
|
12
|
+
from app_utils.logging import LoggerAddTag
|
|
13
|
+
|
|
14
|
+
# AA Fleet Finder
|
|
15
|
+
from fleetfinder import __title__
|
|
16
|
+
|
|
17
|
+
logger = LoggerAddTag(my_logger=get_extension_logger(__name__), prefix=__title__)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@register.filter
|
|
21
|
+
def get_item(dictionary: dict | None, key: str) -> str | None:
|
|
22
|
+
"""
|
|
23
|
+
Little helper: get a key from a dictionary
|
|
24
|
+
|
|
25
|
+
:param dictionary:
|
|
26
|
+
:param key:
|
|
27
|
+
:return:
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
if dictionary is None:
|
|
31
|
+
return None
|
|
32
|
+
|
|
33
|
+
return dictionary.get(key, None)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Initializing our tests
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Standard Library
|
|
6
|
+
import socket
|
|
7
|
+
|
|
8
|
+
# Django
|
|
9
|
+
from django.test import TestCase
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class SocketAccessError(Exception):
|
|
13
|
+
"""Error raised when a test script accesses the network"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class BaseTestCase(TestCase):
|
|
17
|
+
"""Variation of Django's TestCase class that prevents any network use.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
|
|
21
|
+
.. code-block:: python
|
|
22
|
+
|
|
23
|
+
class TestMyStuff(BaseTestCase):
|
|
24
|
+
def test_should_do_what_i_need(self): ...
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def setUpClass(cls):
|
|
30
|
+
cls.socket_original = socket.socket
|
|
31
|
+
socket.socket = cls.guard
|
|
32
|
+
return super().setUpClass()
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def tearDownClass(cls):
|
|
36
|
+
socket.socket = cls.socket_original
|
|
37
|
+
return super().tearDownClass()
|
|
38
|
+
|
|
39
|
+
@staticmethod
|
|
40
|
+
def guard(*args, **kwargs):
|
|
41
|
+
raise SocketAccessError("Attempted to access network")
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test checks for access to fleetfinder
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Standard Library
|
|
6
|
+
from http import HTTPStatus
|
|
7
|
+
|
|
8
|
+
# Django
|
|
9
|
+
from django.contrib.auth.models import Group
|
|
10
|
+
from django.urls import reverse
|
|
11
|
+
|
|
12
|
+
# AA Fleet Finder
|
|
13
|
+
from fleetfinder.tests import BaseTestCase
|
|
14
|
+
from fleetfinder.tests.utils import create_fake_user
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestAccess(BaseTestCase):
|
|
18
|
+
"""
|
|
19
|
+
Testing module access
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
@classmethod
|
|
23
|
+
def setUpClass(cls) -> None:
|
|
24
|
+
"""
|
|
25
|
+
Set up groups and users
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
super().setUpClass()
|
|
29
|
+
|
|
30
|
+
cls.group = Group.objects.create(name="Superhero")
|
|
31
|
+
|
|
32
|
+
# User cannot access fleetfinder
|
|
33
|
+
cls.user_1001 = create_fake_user(
|
|
34
|
+
character_id=1001, character_name="Peter Parker"
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
# User can access fleetfinder
|
|
38
|
+
cls.user_1002 = create_fake_user(
|
|
39
|
+
character_id=1002,
|
|
40
|
+
character_name="Bruce Wayne",
|
|
41
|
+
permissions=["fleetfinder.access_fleetfinder"],
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def test_has_no_access(self):
|
|
45
|
+
"""
|
|
46
|
+
Test that a user without access gets a 302
|
|
47
|
+
|
|
48
|
+
:return:
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
# given
|
|
52
|
+
self.client.force_login(user=self.user_1001)
|
|
53
|
+
|
|
54
|
+
# when
|
|
55
|
+
res = self.client.get(path=reverse(viewname="fleetfinder:dashboard"))
|
|
56
|
+
|
|
57
|
+
# then
|
|
58
|
+
self.assertEqual(first=res.status_code, second=HTTPStatus.FOUND)
|
|
59
|
+
|
|
60
|
+
def test_has_access(self):
|
|
61
|
+
"""
|
|
62
|
+
Test that a user with access gets to see it
|
|
63
|
+
|
|
64
|
+
:return:
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
# given
|
|
68
|
+
self.client.force_login(user=self.user_1002)
|
|
69
|
+
|
|
70
|
+
# when
|
|
71
|
+
res = self.client.get(path=reverse(viewname="fleetfinder:dashboard"))
|
|
72
|
+
|
|
73
|
+
# then
|
|
74
|
+
self.assertEqual(first=res.status_code, second=HTTPStatus.OK)
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test auth_hooks
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Standard Library
|
|
6
|
+
from http import HTTPStatus
|
|
7
|
+
|
|
8
|
+
# Django
|
|
9
|
+
from django.urls import reverse
|
|
10
|
+
|
|
11
|
+
# AA Fleet Finder
|
|
12
|
+
from fleetfinder.tests import BaseTestCase
|
|
13
|
+
from fleetfinder.tests.utils import create_fake_user
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class TestHooks(BaseTestCase):
|
|
17
|
+
"""
|
|
18
|
+
Test the app hook into allianceauth
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
@classmethod
|
|
22
|
+
def setUpClass(cls) -> None:
|
|
23
|
+
"""
|
|
24
|
+
Set up groups and users
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
super().setUpClass()
|
|
28
|
+
|
|
29
|
+
# User cannot access
|
|
30
|
+
cls.user_1001 = create_fake_user(
|
|
31
|
+
character_id=1001, character_name="Peter Parker"
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
# User can access
|
|
35
|
+
cls.user_1002 = create_fake_user(
|
|
36
|
+
character_id=1002,
|
|
37
|
+
character_name="Bruce Wayne",
|
|
38
|
+
permissions=["fleetfinder.access_fleetfinder"],
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
cls.html_menu = f"""
|
|
42
|
+
<li class="d-flex flex-wrap m-2 p-2 pt-0 pb-0 mt-0 mb-0 me-0 pe-0">
|
|
43
|
+
<i class="nav-link fa-solid fa-users fa-fw align-self-center me-3 "></i>
|
|
44
|
+
<a class="nav-link flex-fill align-self-center me-auto" href="{reverse(viewname='fleetfinder:dashboard')}">
|
|
45
|
+
Fleet Finder
|
|
46
|
+
</a>
|
|
47
|
+
</li>
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def test_render_hook_success(self):
|
|
51
|
+
"""
|
|
52
|
+
Test should show the link to the app in the navigation to user with access
|
|
53
|
+
|
|
54
|
+
:return:
|
|
55
|
+
:rtype:
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
self.client.force_login(user=self.user_1002)
|
|
59
|
+
|
|
60
|
+
response = self.client.get(path=reverse(viewname="authentication:dashboard"))
|
|
61
|
+
|
|
62
|
+
self.assertEqual(first=response.status_code, second=HTTPStatus.OK)
|
|
63
|
+
self.assertContains(response=response, text=self.html_menu, html=True)
|
|
64
|
+
|
|
65
|
+
def test_render_hook_fail(self):
|
|
66
|
+
"""
|
|
67
|
+
Test should not show the link to the app in the
|
|
68
|
+
navigation to user without access
|
|
69
|
+
|
|
70
|
+
:return:
|
|
71
|
+
:rtype:
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
self.client.force_login(user=self.user_1001)
|
|
75
|
+
|
|
76
|
+
response = self.client.get(path=reverse(viewname="authentication:dashboard"))
|
|
77
|
+
|
|
78
|
+
self.assertEqual(first=response.status_code, second=HTTPStatus.OK)
|
|
79
|
+
self.assertNotContains(response=response, text=self.html_menu, html=True)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Test the settings
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
# Django
|
|
6
|
+
from django.test import override_settings
|
|
7
|
+
|
|
8
|
+
# AA Fleet Finder
|
|
9
|
+
from fleetfinder.app_settings import debug_enabled
|
|
10
|
+
from fleetfinder.tests import BaseTestCase
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class TestSettings(BaseTestCase):
|
|
14
|
+
"""
|
|
15
|
+
Test the settings
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
@override_settings(DEBUG=True)
|
|
19
|
+
def test_debug_enabled_with_debug_true(self) -> None:
|
|
20
|
+
"""
|
|
21
|
+
Test debug_enabled with DEBUG = True
|
|
22
|
+
|
|
23
|
+
:return:
|
|
24
|
+
:rtype:
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
self.assertTrue(debug_enabled())
|
|
28
|
+
|
|
29
|
+
@override_settings(DEBUG=False)
|
|
30
|
+
def test_debug_enabled_with_debug_false(self) -> None:
|
|
31
|
+
"""
|
|
32
|
+
Test debug_enabled with DEBUG = False
|
|
33
|
+
|
|
34
|
+
:return:
|
|
35
|
+
:rtype:
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
self.assertFalse(debug_enabled())
|