From ff57670a748ec15c0839089e2bf56bac97225e1b Mon Sep 17 00:00:00 2001 From: p0lygun Date: Sun, 16 Oct 2022 22:55:36 +0530 Subject: [PATCH 1/7] feat: polished after click state of report menu --- .../core/templates/core/experience_page.html | 71 +++++++++---------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/bfportal/core/templates/core/experience_page.html b/bfportal/core/templates/core/experience_page.html index 931023d..465ddf7 100644 --- a/bfportal/core/templates/core/experience_page.html +++ b/bfportal/core/templates/core/experience_page.html @@ -60,26 +60,17 @@ -
+
Experience Bugged - Experience Not Available - XP Farm - +
@@ -398,6 +389,23 @@ menuHider = $('#reportMenuHider'), reportSuccessfulItem = $('#reportSuccessfulItem'); + function handleAfterFadeOut(successful){ + if(successful){ + reportSuccessfulItem.text('Reported Successfully') + reportSuccessfulItem.removeClass("bg-bf2042-6") + reportSuccessfulItem.show('slide', {direction: "up"}, 200); + console.log(`Report type ${report_type} successful for {{ page.title }}`) + } else { + reportSuccessfulItem.text("Please Log in..") + reportSuccessfulItem.addClass("bg-bf2042-6") + reportSuccessfulItem.show('slide', {direction: "up"}, 200); + } + + setTimeout(function () { + reportSuccessfulItem.hide('slide', {direction: "up"}, 200); + }, 1000) + } + if (csrftoken) { menuHider.fadeIn(); fetch(`/api/report/${report_type}/?id={{ page.id }}`, { @@ -409,29 +417,20 @@ }, 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); - } + menuHider.fadeOut( + function () { + if(resp.status === 200){ + handleAfterFadeOut(true) + } else { + throw Error("Not logged in") + } + } + ) + }).catch((error) => {menuHider.fadeOut(function () { + handleAfterFadeOut(false) + })}) + } else {handleAfterFadeOut(false)} - setTimeout(function () { - reportSuccessfulItem.hide('slide', {direction: "up"}, 200); - }, 1000) } {#https://api.gametools.network/bf2042/playground/?playgroundid=45e436e0-4cf7-11ec-be7b-76c50778a53a#} From 7df0cef5879952d0525560cf95df1bc8ca369c20 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Mon, 17 Oct 2022 00:36:22 +0530 Subject: [PATCH 2/7] style: align side menu item to right --- .../core/templates/core/experience_page.html | 60 ++++++++++++------- 1 file changed, 37 insertions(+), 23 deletions(-) diff --git a/bfportal/core/templates/core/experience_page.html b/bfportal/core/templates/core/experience_page.html index 465ddf7..f025619 100644 --- a/bfportal/core/templates/core/experience_page.html +++ b/bfportal/core/templates/core/experience_page.html @@ -11,6 +11,7 @@ + {% if debug %}{% static "images/placeholder.png" %}{% else %}{% if page.cover_img_url %}{{ page.cover_img_url }}{% else %}{% static "images/placeholder.png" %}{% endif %}{% endif %}' alt="{{ page.slug }}" onerror='if(this.src !== "{% static "images/placeholder.png" %}") this.src="{% static "images/placeholder.png" %}";' @@ -27,6 +28,7 @@ width="32" height="32" src=" + {% if page|is_liked_by_user:request %}{% static 'svgs/card/heart_liked.svg' %}{% else %}{% static 'svgs/card/heart_not_liked.svg' %}{% endif %}" alt="" /> @@ -39,17 +41,23 @@
-
+
- + + + +

Share

- + + + +

Report

- Experience Bugged - Experience Not Available - XP Farm - - + {% with "w-full text-right text-white text-sm py-1 px-2 bg-card-bg hover:bg-hover-bg-light transition ease-in-out duration-200" as reportItemClass %} + Experience Bugged + Experience Not Available + XP Farm + + {% endwith %} +
@@ -257,12 +266,13 @@
+ {% with post.liked_by.all.count as like_count %} {% if post.bugged or post.broken or post.xp_farm %} -
+
+

@@ -37,8 +39,7 @@

{% endif %} - {% with post.liked_by.all.count as like_count %} -
+
{% if post|is_liked_by_user:request %} @@ -98,7 +99,7 @@ {% endif %} {% if post.exp_url|length %}

Editable - +

{% endif %} {% endif %} From 65aa0e2eaa0736f7abb95e46ef041f2dfb032939 Mon Sep 17 00:00:00 2001 From: p0lygun Date: Mon, 17 Oct 2022 02:12:19 +0530 Subject: [PATCH 4/7] feat: make fronted UI for chage state for a creator of a exp --- .../core/templates/core/experience_page.html | 44 ++++++++++++++++--- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/bfportal/core/templates/core/experience_page.html b/bfportal/core/templates/core/experience_page.html index f025619..cf87bb7 100644 --- a/bfportal/core/templates/core/experience_page.html +++ b/bfportal/core/templates/core/experience_page.html @@ -41,7 +41,7 @@
-
+
@@ -58,10 +58,24 @@ -

Report

+ + {% if page.owner == request.user %} +

Change State

+ {% if page.bugged_report.all|length %} + {{ page.bugged_report.all|length }} + {% endif %} + {% if page.broken_report.all|length %} + {{ page.broken_report.all|length }} + {% endif %} + + {% else %} + Report + {% endif %} + +