Skip to content

Commit

Permalink
Merge pull request #158 from zediious/0.4.5.2
Browse files Browse the repository at this point in the history
Changes for 0.4.5.2
  • Loading branch information
zediious authored Apr 25, 2024
2 parents 8edbc83 + 0c659fe commit e220ab9
Show file tree
Hide file tree
Showing 21 changed files with 241 additions and 71 deletions.
8 changes: 4 additions & 4 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
EMAIL_BACKEND: str = 'django.core.mail.backends.console.EmailBackend'

EMAIL_USE_TLS: bool = True
EMAIL_HOST: str = str(getenv('EMAIL_HOST'))
EMAIL_PORT: int = int(getenv('EMAIL_PORT'))
EMAIL_HOST_USER: str = str(getenv('EMAIL_HOST_USER'))
EMAIL_HOST_PASSWORD: str = str(getenv('EMAIL_HOST_PASSWORD'))
EMAIL_HOST: str = str(getenv('EMAIL_HOST')) if str(getenv('EMAIL_HOST')) != '' else '[email protected]'
EMAIL_PORT: int = int(getenv('EMAIL_PORT')) if getenv('EMAIL_PORT') != '' else 587
EMAIL_HOST_USER: str = str(getenv('EMAIL_HOST_USER')) if str(getenv('EMAIL_HOST_USER')) != '' else 'Test'
EMAIL_HOST_PASSWORD: str = str(getenv('EMAIL_HOST_PASSWORD')) if str(getenv('EMAIL_HOST_PASSWORD')) != '' else ''

# Database
DATABASES: dict = {}
Expand Down
3 changes: 2 additions & 1 deletion raptorWeb/authprofiles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,8 @@ def get_context_data(self, **kwargs: dict[str, Any]) -> dict[str, Any]:
context.update(
{
"base_user_url": BASE_USER_URL,
"user_filter_form": user_filter_form
"user_filter_form": user_filter_form,
"form_data": form_data
}
)
return context
Expand Down
4 changes: 2 additions & 2 deletions raptorWeb/donations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
context = super().get_context_data(**kwargs)

site_info: SiteInformation = SiteInformation.objects.get_or_create(pk=1)[0]
bought_package = DonationPackage.objects.get(name=str(self.kwargs['package']))
bought_package = DonationPackage.objects.get(pk=str(self.kwargs['package']))

context['buying_package'] = bought_package
context['base_user_url'] = BASE_USER_URL
Expand Down Expand Up @@ -180,7 +180,7 @@ def post(self, request: HttpRequest, *args: tuple, **kwargs: dict) -> HttpRespon
return HttpResponseRedirect('/donations/failure/invalidusername')

try:
bought_package = DonationPackage.objects.get(name=str(self.kwargs['package']))
bought_package = DonationPackage.objects.get(pk=str(self.kwargs['package']))

except DonationPackage.DoesNotExist:
return HttpResponseRedirect('/')
Expand Down
3 changes: 3 additions & 0 deletions raptorWeb/gameservers/context_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ def server_settings_to_context(request: HttpResponse) -> dict:
current_servers = Server.objects.filter(archived=False)

return {"server_query_enabled": site_info.enable_server_query,
"server_online_message": site_info.server_online_message,
"server_offline_message": site_info.server_offline_message,
"server_maintenance_message": site_info.server_maintenance_message,
"server_pagination_count": site_info.server_pagination_count,
"total_server_count": current_servers.count(),
"current_enabled_servers": current_servers}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Generated by Django 4.2.7 on 2024-04-25 17:05

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("raptormc", "0070_siteinformation_paypal_enabled_and_more"),
]

operations = [
migrations.AddField(
model_name="siteinformation",
name="server_maintenance_message",
field=models.CharField(
default="Server is in maintenance mode!",
help_text="Text shown in tooltip while hovering over a server in Maintenance Mode's status icon.",
max_length=500,
verbose_name="Server Maintenace Message",
),
),
migrations.AddField(
model_name="siteinformation",
name="server_offline_message",
field=models.CharField(
default="Server is offline!",
help_text="Text shown in tooltip while hovering over an offline server status icon.",
max_length=500,
verbose_name="Server Offline Message",
),
),
migrations.AddField(
model_name="siteinformation",
name="server_online_message",
field=models.CharField(
default="Server is online!",
help_text="Text shown in tooltip while hovering over an online server status icon.",
max_length=500,
verbose_name="Server Online Message",
),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Generated by Django 4.2.7 on 2024-04-25 17:13

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("raptormc", "0071_siteinformation_server_maintenance_message_and_more"),
]

operations = [
migrations.AlterField(
model_name="siteinformation",
name="server_maintenance_message",
field=models.CharField(
blank=True,
default="Server is in maintenance mode!",
help_text="Text shown in tooltip while hovering over a server in Maintenance Mode's status icon.",
max_length=500,
null=True,
verbose_name="Server Maintenace Message",
),
),
migrations.AlterField(
model_name="siteinformation",
name="server_offline_message",
field=models.CharField(
blank=True,
default="Server is offline!",
help_text="Text shown in tooltip while hovering over an offline server status icon.",
max_length=500,
null=True,
verbose_name="Server Offline Message",
),
),
migrations.AlterField(
model_name="siteinformation",
name="server_online_message",
field=models.CharField(
blank=True,
default="Server is online!",
help_text="Text shown in tooltip while hovering over an online server status icon.",
max_length=500,
null=True,
verbose_name="Server Online Message",
),
),
]
30 changes: 30 additions & 0 deletions raptorWeb/raptormc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,36 @@ class SiteInformation(models.Model):
default=True
)

server_online_message = models.CharField(
verbose_name='Server Online Message',
help_text=('Text shown in tooltip while hovering over an online server status icon. '
'If left blank, no tooltip will appear.'),
default='Server is online!',
max_length=500,
blank=True,
null=True
)

server_offline_message = models.CharField(
verbose_name='Server Offline Message',
help_text=('Text shown in tooltip while hovering over an offline server status icon. '
'If left blank, no tooltip will appear.'),
default='Server is offline!',
max_length=500,
blank=True,
null=True
)

server_maintenance_message = models.CharField(
verbose_name='Server Maintenance Message',
help_text=("Text shown in tooltip while hovering over a server in maintenance mode's status icon. "
"If left blank, no tooltip will appear."),
default='Server is in maintenance mode!',
max_length=500,
blank=True,
null=True
)

collapse_network_rules_when_accessing_server_rules = models.BooleanField(
verbose_name="Collapse Network Rules section if accessing Rules page from a Server modal link.",
help_text=("If this is un-checked, the Network Rules section on the Rules page will NOT be "
Expand Down
4 changes: 2 additions & 2 deletions raptorWeb/raptormc/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _get_package_routes():
for package in all_packages:
current_routes.append(
Route(
name=f'donations/checkout/{slugify(package.name)}',
name=f'donations/checkout/{slugify(package.pk)}',
route_type="package",
package=package,
)
Expand Down Expand Up @@ -203,7 +203,7 @@ def _get_main_routes():
return {
"og_package": route.package,
"og_color": site_info.main_color,
"og_url": f"{WEB_PROTO}://{DOMAIN_NAME}/donations/checkout{slugify(route.package.name)}",
"og_url": f"{WEB_PROTO}://{DOMAIN_NAME}/donations/checkout{slugify(route.package.pk)}",
"og_image": f"{site_avatar_url}",
"og_title": f"{site_info.brand_name} | {route.package.name}",
"og_desc": strip_tags(route.package.package_description)
Expand Down
8 changes: 8 additions & 0 deletions raptorWeb/raptormc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,14 @@ def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse:

def get_context_data(self, **kwargs: dict[str, Any]) -> dict[str, Any]:
context: dict[str, Any] = super().get_context_data(**kwargs)
get_data = self.request.GET
if get_data.get('username'):
context['filtered_username'] = self.request.GET.get('username')
if get_data.get('is_staff'):
context['filtered_is_staff'] = self.request.GET.get('is_staff')
if get_data.get('page'):
context['filtered_page'] = self.request.GET.get('page')

return get_or_create_informative_text(
context=context,
informative_text_names=["User Information"])
Expand Down
2 changes: 1 addition & 1 deletion raptorWeb/static/css/raptormc.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion raptorWeb/static/css/raptormc.css.map

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions raptorWeb/static/css/raptormc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ body {
position: relative;
}

.loadingSpinnerMain {
width: 25%;
position: relative;
}

.htmxLink:hover {
cursor:pointer;
}
Expand Down Expand Up @@ -173,6 +178,14 @@ body {
animation-duration: 0.6s;
}

.fade-in-main {
opacity: 1;
animation-name: fadeInOpacity;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-duration: 0.2s;
}

.btn-discord {
--bs-btn-font-weight: 600;
--bs-btn-color: var(--bs-white);
Expand Down
2 changes: 1 addition & 1 deletion raptorWeb/templates/authprofiles/raptoruser_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{% include "raptormc/404.html" %}
{% else %}

<div class="container">
<div class="container fade-in-main">
{% if user.is_authenticated and user.username == object.username %}
{% comment %} Display Profile Editing functions if user is authenticated
and visiting their own profile. {% endcomment %}
Expand Down
25 changes: 18 additions & 7 deletions raptorWeb/templates/authprofiles/raptoruser_list.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{% load static %}
{% load django_bootstrap5 %}

<div id="user_list_container" class="container-flex">
<div id="user_list_container" class="container-flex fade-in-main">
{% comment %} User list filter form {% endcomment %}
<div class="d-flex justify-content-center">
<div>
<form id="user_list_filter_form" class="form p-3 text-white htmxLink"
enctype="multipart/form-data"
hx-get="{% url 'authprofiles:all_user_profile' %}"
Expand All @@ -13,7 +13,10 @@
>
{% csrf_token %}
<button type="submit" disabled style="display: none" aria-hidden="true"></button>
{% bootstrap_form user_filter_form %}
<div class="d-flex justify-content-evenly align-items-center">
{% bootstrap_field user_filter_form.is_staff %}
{% bootstrap_field user_filter_form.username %}
</div>

</form>
</div>
Expand All @@ -22,14 +25,18 @@
<span class="step-links">
{% if page_obj.has_previous %}
<a role="button" class="btn btn-secondary"
hx-get="{% url 'authprofiles:all_user_profile' %}?page=1"
hx-get="{% url 'authprofiles:all_user_profile' %}?page=1
&is_staff={{ form_data.is_staff }}&username={{ form_data.username }}"
hx-target="#user_list_container"
hx-push-url="{{base_user_url}}?page=1"
>
&laquo; First
</a>
<a role="button" class="btn btn-secondary"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.previous_page_number }}"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.previous_page_number }}
&is_staff={{ form_data.is_staff }}&username={{ form_data.username }}"
hx-target="#user_list_container"
hx-push-url="{{base_user_url}}?page={{ page_obj.previous_page_number }}"
>
Previous
</a>
Expand All @@ -41,14 +48,18 @@

{% if page_obj.has_next %}
<a role="button" class="btn btn-secondary"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.next_page_number }}"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.next_page_number }}
&is_staff={{ form_data.is_staff }}&username={{ form_data.username }}"
hx-target="#user_list_container"
hx-push-url="{{base_user_url}}?page={{ page_obj.next_page_number }}"
>
Next
</a>
<a role="button" class="btn btn-secondary"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.paginator.num_pages }}"
hx-get="{% url 'authprofiles:all_user_profile' %}?page={{ page_obj.paginator.num_pages }}
&is_staff={{ form_data.is_staff }}&username={{ form_data.username }}"
hx-target="#user_list_container"
hx-push-url="{{base_user_url}}?page={{ page_obj.paginator.num_pages }}"
>
Last &raquo;
</a>
Expand Down
Loading

0 comments on commit e220ab9

Please sign in to comment.