Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Bug Details Page; Revision 7 #2263

Merged
merged 13 commits into from
Jun 10, 2024
9 changes: 6 additions & 3 deletions blt/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
UserIssueViewSet,
UserProfileViewSet,
)
from website.views import ( # TODO IssueView,; TODO: REMOVE like_issue2 etc
from website.views import ( # TODO(b) IssueView,; TODO(b): REMOVE like_issue2 etc
AllIssuesView,
CompanySettings,
ContributorStatsView,
Expand Down Expand Up @@ -86,6 +86,7 @@
google_callback,
like_issue2,
like_issue3,
resolve,
select_bid,
submit_pr,
subscribe_to_domains,
Expand Down Expand Up @@ -278,7 +279,7 @@
name="user_profile",
),
path(settings.ADMIN_URL + "/", admin.site.urls),
# TODO: REMOVE after _3 is ready
# TODO(b): REMOVE after _3 is ready
re_path(r"^like_issue/(?P<issue_pk>\d+)/$", website.views.like_issue, name="like_issue"),
re_path(
r"^dislike_issue/(?P<issue_pk>\d+)/$",
Expand All @@ -292,6 +293,8 @@
re_path(r"^like_issue3/(?P<issue_pk>\d+)/$", like_issue3, name="like_issue3"),
re_path(r"^dislike_issue3/(?P<issue_pk>\d+)/$", dislike_issue3, name="dislike_issue3"),
re_path(r"^flag_issue3/(?P<issue_pk>\d+)/$", flag_issue3, name="flag_issue3"),
# TODO(b) track this
re_path(r"^resolve/(?P<id>\w+)/$", resolve, name="resolve"),
re_path(r"^vote_count/(?P<issue_pk>\d+)/$", vote_count, name="vote_count"),
path("domain/<int:pk>/subscribe/", subscribe_to_domains, name="subscribe_to_domains"),
re_path(r"^save_issue/(?P<issue_pk>\d+)/$", website.views.save_issue, name="save_issue"),
Expand Down Expand Up @@ -319,7 +322,7 @@
),
# delete_comment
path("issue2/comment/delete/", website.views.delete_comment, name="delete_comment"),
# TODO: REMOVE after _3 is ready
# TODO(b): REMOVE after _3 is ready
re_path(r"^issue/(?P<slug>\w+)/$", IssueView.as_view(), name="issue_view"),
re_path(r"^issue2/(?P<slug>\w+)/$", IssueView2.as_view(), name="issue_view2"),
re_path(r"^issue3/(?P<slug>\w+)/$", IssueView3.as_view(), name="issue_view3"),
Expand Down
19 changes: 17 additions & 2 deletions website/templates/includes/_like_dislike_share.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class="z-10 hidden bg-white divide-y divide-gray-100 rounded-lg shadow w-44">
<ul class="py-2 m-2 rounded text-gray-700"
aria-labelledby="dropdownDefaultButton">
<span class="md:hidden flex flex-col">{% include "./_like_dislike_widget.html" %}</span>
<span class="md:hidden flex flex-col">{% include "./_like_dislike_widget.html" with device="mobile" %}</span>
<li>
<a href="https://twitter.com/intent/tweet?text=Bug Found on @{{ object.domain_title }} - {{ object.description }} Report: https://{% env 'FQDN' %}/issue/{{ object.id }}"
target="_blank"
Expand All @@ -39,7 +39,7 @@
{% endif %}
</ul>
</div>
<span class="max-sm:hidden">{% include "./_like_dislike_widget.html" %}</span>
<span class="max-sm:hidden">{% include "./_like_dislike_widget.html" with device="desktop" %}</span>
<script>
function copyClipboard() {
var textToCopy = "Bug Found on @{{ object.domain_title }} - {{ object.description }} Report: https://{% env 'FQDN' %}/issue/{{ object.id }}";
Expand Down Expand Up @@ -161,4 +161,19 @@

// Attach the click event handler
$('body').on('click', '.bookmark', bookmark_handler);
async function resolveIssue(){
var id = {{object.pk}};

const request = await fetch(`/resolve/${id}/`)
window.location.reload();
if(request.status == 200){
const jsonData = await request.json();
console.log(jsonData["issue_status"])
}else if (request.status == 403){
$.notify("Permission Denied", {
style: "custom",
className: "danger"
});
}
}
</script>
36 changes: 21 additions & 15 deletions website/templates/includes/_like_dislike_widget.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,7 @@
</button>
{% comment %} likes {% endcomment %}
{% if request.user.is_authenticated %}
<button name="{{ object.pk }}"
data-tooltip-target="tooltip-bottom-{{ object.pk }}-like"
data-tooltip-placement="bottom"
type="submit"
id="like_unlike"
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
type="button">
<button name="{{ object.pk }}" {% comment %} {{device}} is passed by _like_dislike_share.html {% endcomment %} data-tooltip-target="tooltip-bottom-{{ device }}-like" data-tooltip-placement="bottom" type="submit" id="like_unlike" class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 " type="button">
<span id="likes" class="flex items-end">
{{ likes }} &nbsp;
{% if isLiked %}
Expand All @@ -45,7 +39,7 @@
</span>
</button>
{% else %}
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-like"
<button data-tooltip-target="tooltip-bottom-{{ device }}-like"
data-tooltip-placement="bottom"
onclick="window.location.href='/accounts/login'"
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
Expand All @@ -66,7 +60,7 @@
{% comment %} dislike {% endcomment %}
{% if request.user.is_authenticated %}
<button name="{{ object.pk }}"
data-tooltip-target="tooltip-bottom-{{ object.pk }}-dislike"
data-tooltip-target="tooltip-bottom-{{ device }}-dislike"
data-tooltip-placement="bottom"
type="submit"
id="dislike-btn"
Expand Down Expand Up @@ -96,7 +90,7 @@
</span>
</button>
{% else %}
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-dislike"
<button data-tooltip-target="tooltip-bottom-{{ device }}-dislike"
data-tooltip-placement="bottom"
onclick="window.location.href='/accounts/login'"
class="dislike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 ">
Expand All @@ -116,7 +110,7 @@
{% comment %} report {% endcomment %}
{% if request.user.is_authenticated %}
<button name="{{ object.pk }}"
data-tooltip-target="tooltip-bottom-{{ object.pk }}-flags"
data-tooltip-target="tooltip-bottom-{{ device }}-flags"
data-tooltip-placement="bottom"
id="flag-unflag"
class="flag-unflag rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
Expand Down Expand Up @@ -145,7 +139,7 @@
</span>
</button>
{% else %}
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-flags"
<button data-tooltip-target="tooltip-bottom-{{ device }}-flags"
data-tooltip-placement="bottom"
onclick="window.location.href='/accounts/login'"
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
Expand All @@ -166,7 +160,7 @@
{% comment %} bookmark {% endcomment %}
{% if request.user.is_authenticated %}
<button name="{{ object.pk }}"
data-tooltip-target="tooltip-bottom-{{ object.pk }}-bookmark"
data-tooltip-target="tooltip-bottom-{{ device }}-bookmark"
data-tooltip-placement="bottom"
class="bookmark rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
type="button">
Expand All @@ -193,7 +187,7 @@
</span>
</button>
{% else %}
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-bookmark"
<button data-tooltip-target="tooltip-bottom-{{ device }}-bookmark"
data-tooltip-placement="bottom"
onclick="window.location.href='/accounts/login'"
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
Expand All @@ -212,7 +206,7 @@
</button>
{% endif %}
{% comment %} notification {% endcomment %}
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-notification"
<button data-tooltip-target="tooltip-bottom-{{ device }}-notification"
data-tooltip-placement="bottom"
class="relative inline-block shadow-sm rounded-xl transform-[0] font-bold text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4"
onclick="{% if user.is_authenticated %}subscribe_domain(){% else %}window.location.href=`{% url 'account_login' %}`{% endif %}"
Expand All @@ -233,3 +227,15 @@
</svg>
{% endif %}
</button>
{% comment %} resolve {% endcomment %}
{% if request.user.is_superuser or request.user == object.user %}
<button type="button"
onclick="resolveIssue()"
class="rounded-2xl h-auto border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-bold text-white bg-gradient-to-r from-purple-500 via-purple-600 to-purple-700 hover:bg-gradient-to-br focus:outline-none border-black-2 text-[#0.875rem] leading-4 p-4 ">
{% if status == "open" %}
Resolve
{% else %}
Open Issue
{% endif %}
</button>
{% endif %}
4 changes: 2 additions & 2 deletions website/templates/includes/_tooltip3.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="tooltip-bottom-{{ sno }}-{{ widget }}"
<div id="tooltip-bottom-{{ device }}-{{ widget }}"
role="tooltip"
class="absolute z-10 invisible inline-block px-3 py-2 font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
class="absolute z-10 inline-block px-3 py-2 font-medium text-white bg-gray-900 rounded-lg shadow-sm opacity-0 tooltip dark:bg-gray-700">
{{ text }}
<div class="tooltip-arrow" data-popper-arrow></div>
</div>
Loading
Loading