diff --git a/bfportal/bfportal/templates/base.html b/bfportal/bfportal/templates/base.html
index 4720edb..384b60b 100644
--- a/bfportal/bfportal/templates/base.html
+++ b/bfportal/bfportal/templates/base.html
@@ -48,6 +48,8 @@
{% block preload_media %}{% endblock %}
+
+
{% block extra_css %}
{# Override this in templates to add extra stylesheets #}
{% endblock %}
@@ -95,11 +97,12 @@
+
{% block header %}
{% include nav_tmpl|default:'navbar.html' %}
{% endblock %}
-
+
{% block extra_content %}
{% include_block page.extra_content %}
@@ -126,6 +129,7 @@
+
@@ -239,6 +243,48 @@
})
}
)
+ async function copyDivToClipboard(elem) {
+ const container_div = $(elem);
+ if (container_div.attr('data-copy-state') === "normal"){ // only run when the inner html is set correctly
+ const old_html = container_div.html(),
+ state_class = "bg-bf2042-5 hover:bg-bf2042-5";
+
+ container_div.attr('data-copy-state', "copy");
+ await navigator.clipboard.writeText(container_div.attr('data-copy')).then(
+ () =>{
+ container_div.addClass(state_class);
+ container_div.text("Copied")
+ setTimeout(function () {
+ container_div.fadeOut(200, function () {
+ container_div.html(old_html).fadeIn(1000);
+ container_div.attr('data-copy-state', "normal")
+ })
+ container_div.removeClass(state_class);
+ }, 1000);
+ }, () => {
+ console.log("Copy Failed");
+ container_div.attr('data-copy-state', "normal")
+ }
+ )
+ }
+ }
+ document.addEventListener('keydown', function(e) {
+ if(e.key === "Escape"){
+ hidePopUps();
+ }
+ });
+ function hidePopUps() {
+ $('#popUpBackground, .popup').fadeOut(100)
+ }
+ function showPopUp(id) {
+ const popup = $(document.getElementById(id))
+ if (popup) {
+ $(`#popUpBackground`).fadeIn(100);
+ popup.fadeIn();
+ popup.css('display', 'flex');
+ }
+ }
+
{% block extra_js %}
{# Override this in templates to add extra javascript #}
diff --git a/bfportal/bfportal/templates/footer.html b/bfportal/bfportal/templates/footer.html
index 56e4df9..d2aaac7 100644
--- a/bfportal/bfportal/templates/footer.html
+++ b/bfportal/bfportal/templates/footer.html
@@ -1,6 +1,5 @@
{% load static %}
-
-
-
{{ page.title }}
- {% if page.bugged %}
+ {% if page.bugged or page.broken or page.xp_farm %}
-
Experience bugged
+
+ {% if page.bugged %}
+ Experience Bugged
+ {% elif page.broken %}
+ Experience Broken
+ {% elif pagt.xp_farm %}
+ XP Farm
+ {% endif %}
+
{% endif %}
@@ -92,9 +130,12 @@
-
-
+
{% endblock content %}
{% block extra_js %}
@@ -235,11 +289,13 @@
function show(element) {
$(element).show(200).css('display', 'flex').css('flex-direction', 'row')
}
+
function hideSnipper() {
- tagsSpinner.each(function (){
+ tagsSpinner.each(function () {
$(this).hide()
})
}
+
showMapButton.on('click touch', function () {
const $this = $(this);
if ($this.attr('shown') === "false") {
@@ -318,7 +374,7 @@
root.appendChild(img);
root.appendChild(infoContainer);
mapRotation.append(root);
- tagsSpinner.each(function (){
+ tagsSpinner.each(function () {
$(this).hide()
})
})
@@ -335,22 +391,48 @@
})
})
- function report(report_type) {
- const csrftoken = getCookie('csrftoken');
- if(csrftoken){
- fetch(`/api/report/${report_type}/?id={{ page.id }}`,{
- method: 'post',
- mode: "cors",
- cache: "no-cache",
- headers: {
- 'X-CSRFToken': csrftoken,
- }
- }).then(resp => {
- console.log(resp.status)
- })
+ function report(report_type) {
+
+ const csrftoken = getCookie('csrftoken'),
+ menuHider = $('#reportMenuHider'),
+ reportSuccessfulItem = $('#reportSuccessfulItem');
+
+ if (csrftoken) {
+ menuHider.fadeIn();
+ fetch(`/api/report/${report_type}/?id={{ page.id }}`, {
+ method: 'post',
+ mode: "cors",
+ cache: "no-cache",
+ headers: {
+ 'X-CSRFToken': csrftoken,
+ },
+ redirect: "error"
+ }).then(resp => {
+ menuHider.fadeOut()
+ if(resp.status === 200){
+ //menuHider.hide(200);
+ reportSuccessfulItem.text('Reported Successfully')
+ reportSuccessfulItem.show('slide', {direction: "up"}, 200);
+ console.log(`Report type ${report_type} successful for {{ page.title }}`)
+ } else {
+ throw Error("Not logged in")
+ }
+
+ }).catch((error) => {
+ menuHider.fadeOut();
+ reportSuccessfulItem.text("Please Log in..")
+ reportSuccessfulItem.show('slide', {direction: "up"}, 200);
+ })
+ } else {
+ reportSuccessfulItem.text("Please Log in..")
+ reportSuccessfulItem.show('slide', {direction: "up"}, 200);
+ }
+
+ setTimeout(function () {
+ reportSuccessfulItem.hide('slide', {direction: "up"}, 200);
+ }, 1000)
}
- }
{#https://api.gametools.network/bf2042/playground/?playgroundid=45e436e0-4cf7-11ec-be7b-76c50778a53a#}
{##}
diff --git a/bfportal/core/templates/core/experiences_listing.html b/bfportal/core/templates/core/experiences_listing.html
index f1c84f2..0b076a0 100644
--- a/bfportal/core/templates/core/experiences_listing.html
+++ b/bfportal/core/templates/core/experiences_listing.html
@@ -22,11 +22,19 @@
/>
- {% if post.bugged %}
+ {% if post.bugged or post.broken or post.xp_farm %}
-
-
Experience Bugged
+
+
+ {% if post.bugged %}
+ Experience Bugged
+ {% elif post.broken %}
+ Experience Broken
+ {% elif post.xp_farm %}
+ XP Farm
+ {% endif %}
+
{% endif %}
{% with post.liked_by.all.count as like_count %}
@@ -71,9 +79,9 @@
{% if post.category|lower == "prefab" %}
Copy
@@ -81,9 +89,9 @@
{% if post.code|length %}
@@ -201,31 +209,5 @@
}
card.addEventListener("click", handleClick);
});
-
- async function copyDivToClipboard(elem) {
- const container_div = $(elem);
- if (container_div.attr('copy-state') === "normal"){ // only run when the inner html is set correctly
- const old_html = container_div.html(),
- state_class = "bg-bf2042-5 hover:bg-bf2042-5";
-
- container_div.attr('copy-state', "copy");
- await navigator.clipboard.writeText(container_div.attr('copy-data')).then(
- () =>{
- container_div.addClass(state_class);
- container_div.text("Copied")
- setTimeout(function () {
- container_div.fadeOut(200, function () {
- container_div.html(old_html).fadeIn(1000);
- container_div.attr('copy-state', "normal")
- })
- container_div.removeClass(state_class);
- }, 1000);
- }, () => {
- console.log("Copy Failed");
- container_div.attr('copy-state', "normal")
- }
- )
- }
- }
{% endif %}
diff --git a/bfportal/core/templates/core/profile_page.html b/bfportal/core/templates/core/profile_page.html
index b573aff..dcc0c1e 100644
--- a/bfportal/core/templates/core/profile_page.html
+++ b/bfportal/core/templates/core/profile_page.html
@@ -12,29 +12,31 @@
{% with account=accounts.discord.0 %}
- {% if account.extra_data.avatar %}
-
- {% else %}
-
- {% endif %}
+ {% if account.extra_data.avatar %}
+
+ {% else %}
+
+ {% endif %}
- {{ account.extra_data.username }}
#{{ account.extra_data.discriminator }}
+ {{ account.extra_data.username }}
+ #{{ account.extra_data.discriminator }}
{% if account.extra_data.id in owners %}
{% else %}
{% if requested_user.is_superuser %}
-
+
{% elif requested_user|check_group:"Moderators" %}
-
+
{% endif %}
{% endif %}
@@ -42,30 +44,64 @@
Account Create on
-
{{ user.date_joined|date:"d M Y"}}
+
{{ user.date_joined|date:"d M Y" }}
Likes Earned
-
{{earned_likes}}
-
- {% if latest_post %}
-
-
- {% endif %}
+ {% if latest_post %}
+
+
+
Posted On
+
{{ latest_post.first_published_at|date:"d M Y" }}
+
+ {% endif %}
{% endwith %}
{% endif %}
- {% include 'core/experiences_listing.html'%}
+ {% if posts|length %}
+
+
+ Submitted Experiences
+
+
+ {% include 'core/experiences_listing.html' %}
+
+
+ {% endif %}
+
+ {% with requested_user.profile.liked.all as posts %}
+ {% if posts|length %}
+
+
+ Liked Experiences
+
+
+ {% include 'core/experiences_listing.html' with disable_filters_and_pagination=True no_js=True %}
+
+
+ {% endif %}
+ {% endwith %}
+
{% endblock %}
diff --git a/bfportal/core/templates/core/submit_experience_page.html b/bfportal/core/templates/core/submit_experience_page.html
index 53f673f..5f92fa2 100644
--- a/bfportal/core/templates/core/submit_experience_page.html
+++ b/bfportal/core/templates/core/submit_experience_page.html
@@ -140,7 +140,7 @@
{% if field.html_name != "description" %}
{% render_field field class="w-full bg-card-bg h-9 text-white px-2 rounded border-0 hover:bg-[#1f1f1f] focus:ring-1 focus:ring-bf2042-4 disabled:bg-[#1f1f1f] placeholder:font-medium placeholder:text-sm" placeholder=field.label|title autocomplete="off" %}
{% else %}
- {% render_field field class="w-1/2 min-h-fit bg-card-bg text-white px-2 rounded border-0 hover:bg-[#1f1f1f] focus:ring-0 disabled:bg-[#1f1f1f] placeholder:font-medium placeholder:text-sm" placeholder=field.label|title autocomplete="off" %}
+ {% render_field field class="min-w-[50%] min-h-fit bg-card-bg text-white px-2 rounded border-0 hover:bg-[#1f1f1f] focus:ring-0 disabled:bg-[#1f1f1f] placeholder:font-medium placeholder:text-sm" placeholder=field.label|title autocomplete="off" %}
{% endif %}
diff --git a/bfportal/core/templates/markdownx/widget.html b/bfportal/core/templates/markdownx/widget.html
index 13ae746..51159a3 100644
--- a/bfportal/core/templates/markdownx/widget.html
+++ b/bfportal/core/templates/markdownx/widget.html
@@ -1,4 +1,4 @@
-
+
{% include 'django/forms/widgets/textarea.html' %}
diff --git a/bfportal/core/wagtail_hooks.py b/bfportal/core/wagtail_hooks.py
index 08f3890..9ad174a 100644
--- a/bfportal/core/wagtail_hooks.py
+++ b/bfportal/core/wagtail_hooks.py
@@ -11,8 +11,24 @@ class ExperiencePageAdmin(ModelAdmin):
model = ExperiencePage
menu_order = 1
- list_display = ("title", "get_owner", "live", "last_updated_at")
- list_filter = ("trending", "bugged", "category", "sub_categories", "tags")
+ list_display = (
+ "title",
+ "get_owner",
+ "live",
+ "last_updated_at",
+ "get_bugged_reports",
+ "get_broken_reports",
+ "get_xp_farm_reports",
+ )
+ list_filter = (
+ "trending",
+ "bugged",
+ "broken",
+ "xp_farm",
+ "category",
+ "sub_categories",
+ "tags",
+ )
search_fields = ("title", "code")
def get_owner(self, page: ExperiencePage):
@@ -26,9 +42,9 @@ def get_owner(self, page: ExperiencePage):
return format_html(
"""
-
-
-
{}
+
+
+
{}
""",
src,
@@ -44,6 +60,24 @@ def last_updated_at(self, page: ExperiencePage):
return page.first_published_at
return page.last_published_at
+ def get_bugged_reports(self, page: ExperiencePage):
+ """Returns the amount of bugged reports"""
+ return page.bugged_report.all().count()
+
+ get_bugged_reports.short_description = "Bug Report Count"
+
+ def get_broken_reports(self, page: ExperiencePage):
+ """Returns the amount of broken reports"""
+ return page.broken_report.all().count()
+
+ get_broken_reports.short_description = "Broken Report Count"
+
+ def get_xp_farm_reports(self, page: ExperiencePage):
+ """Returns the amount of XP FARM reports"""
+ return page.broken_report.all().count()
+
+ get_xp_farm_reports.short_description = "XP Farm Report Count"
+
def get_queryset(self, request):
"""Returns the queryset that contains all ExperiencePages by the request.user."""
qs = super().get_queryset(request)
diff --git a/bfportal/theme/static_src/tailwind.config.js b/bfportal/theme/static_src/tailwind.config.js
index f4e5f83..fa94979 100644
--- a/bfportal/theme/static_src/tailwind.config.js
+++ b/bfportal/theme/static_src/tailwind.config.js
@@ -51,6 +51,7 @@ module.exports = {
'bg-light' : '#656565',
'default' : '#121212',
'card-bg' : '#262626',
+ 'card-bg-dark': '#1C1C1C',
'hover-bg-light': '#373b3d',
'accent-bg' : '#303030',
'discord-dark': "#303434",