-
-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Bug Details Page - Task 2 (#1982)
- Loading branch information
1 parent
d0efe7a
commit f77f227
Showing
12 changed files
with
712 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{% if request.user.is_authenticated %} | ||
<button type="submit" | ||
name="{{ object.pk }}" | ||
class="bookmark md:w-1/2 lg:w-auto rounded-2xl shadow-md p-5 bg-[#842adb4d] mb-3 cursor-pointer"> | ||
{% if bookmarked %} | ||
<i class="fa-solid fa-bookmark text-3xl text-black"></i> | ||
{% else %} | ||
<i class="fa-regular fa-bookmark text-3xl text-black"></i> | ||
{% endif %} | ||
</button> | ||
{% else %} | ||
<button disabled | ||
class="md:w-1/2 lg:w-auto rounded-2xl shadow-md p-5 bg-[#842adb4d] mb-3 cursor-pointer"> | ||
<i class="fa-regular fa-bookmark text-3xl text-black"></i> | ||
</button> | ||
{% endif %} | ||
<script> | ||
function bookmark_handler(e){ | ||
e.preventDefault(); | ||
var issue_pk = $(this).attr('name'); | ||
$.ajax({ | ||
type: 'GET', | ||
url: '/save_issue/' + issue_pk + '/', | ||
data: {}, | ||
success: function (data) { | ||
if (data === "REMOVED"){ | ||
$('.bookmark i').removeClass('fa-solid'); | ||
$('.bookmark i').addClass('fa-regular'); | ||
$.notify("Bookmark Removed!", { | ||
style: "custom", | ||
className: "success" | ||
}); | ||
} | ||
else{ | ||
$('.bookmark i').removeClass('fa-regular'); | ||
$('.bookmark i').addClass('fa-solid'); | ||
$.notify("Bookmark Added!", { | ||
style: "custom", | ||
className: "success" | ||
}); | ||
} | ||
}, | ||
error: function (e) { | ||
$.notify("Some error occurred!", { | ||
style: "custom", | ||
className: "danger" | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
// Attach the click event handler | ||
$('body').on('click', '.bookmark', bookmark_handler); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{% if request.user.is_authenticated %} | ||
<div id="dislike-container"> | ||
<button name="{{ object.pk }}" | ||
type="submit" | ||
class="dislike md:w-1/2 lg:w-auto rounded-2xl shadow-md p-5 bg-[#8faa8757] mb-3 cursor-pointer"> | ||
{{ dislikes }} | ||
{% if isDisliked %} | ||
<i class="fa-solid fa-thumbs-down text-3xl text-black"></i> | ||
{% else %} | ||
<i class="fa-regular fa-thumbs-down text-3xl text-black"></i> | ||
{% endif %} | ||
</button> | ||
</div> | ||
{% else %} | ||
<button disabled | ||
class="md:w-1/2 lg:w-auto rounded-2xl shadow-md p-5 bg-[#8faa8757] mb-3 cursor-pointer"> | ||
{{ dislikes }} <i class="fa-regular fa-thumbs-down text-3xl text-black"></i> | ||
</button> | ||
{% endif %} | ||
<script> | ||
function dislike_handler(e){ | ||
e.preventDefault(); | ||
var issue_pk = $(this).attr('name'); | ||
$.ajax({ | ||
type: 'GET', | ||
url: '/dislike_issue3/' + issue_pk + '/', | ||
data: {}, | ||
success: function (data) { | ||
$('.dislike').remove(); | ||
$("#dislike-container").append(data); | ||
}, | ||
}); | ||
$('body').off('click', '.dislike', dislike_handler); | ||
} | ||
$('body').on('click', '.dislike', dislike_handler); | ||
</script> |
Oops, something went wrong.