Skip to content

Commit 53d2ed4

Browse files
JisanAR03DonnieBLT
authored andcommitted
make flag button work able on new home page
1 parent c6855f9 commit 53d2ed4

File tree

2 files changed

+48
-47
lines changed

2 files changed

+48
-47
lines changed

website/templates/_bug.html

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -82,50 +82,4 @@
8282
</svg>
8383
</a>
8484
</div>
85-
</div>
86-
<script>
87-
function like_unlike_handler(e,issue_pk){
88-
e.preventDefault();
89-
var issue_pk = issue_pk;
90-
$.ajax({
91-
type: 'GET',
92-
url: '/like_issue2/' + issue_pk + '/',
93-
data: {},
94-
success: function (data) {
95-
// Toggle the color of the SVG
96-
var svg = $('#likeSvg' + issue_pk);
97-
var currentColor = svg.find('path').attr('fill');
98-
99-
if (currentColor === '#a11010') {
100-
// Change to default color
101-
svg.find('path').attr('fill', ''); // Set to default color
102-
} else {
103-
// Change to full red
104-
svg.find('path').attr('fill', '#a11010');
105-
}
106-
},
107-
});
108-
}
109-
function flag_unflag_handler(e,issue_pk){
110-
e.preventDefault();
111-
var issue_pk = issue_pk;
112-
$.ajax({
113-
type: 'GET',
114-
url: '/flag_issue2/' + issue_pk + '/',
115-
data: {},
116-
success: function (data) {
117-
// Toggle the color of the SVG
118-
var svg = $('#flagSvg' + issue_pk);
119-
var currentColor = svg.find('path').attr('fill');
120-
121-
if (currentColor === '#a11010') {
122-
// Change to default color
123-
svg.find('path').attr('fill', ''); // Set to default color
124-
} else {
125-
// Change to full red
126-
svg.find('path').attr('fill', '#a11010');
127-
}
128-
},
129-
});
130-
}
131-
</script>
85+
</div>

website/templates/new_home.html

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,53 @@
1313
{% include '_bug.html' %}
1414
{% endfor %}
1515
</div>
16+
17+
<script>
18+
function like_unlike_handler(e,issue_pk){
19+
e.preventDefault();
20+
var issue_pk = issue_pk;
21+
$.ajax({
22+
type: 'GET',
23+
url: '/like_issue2/' + issue_pk + '/',
24+
data: {},
25+
success: function (data) {
26+
// Toggle the color of the SVG
27+
var svg = $('#likeSvg' + issue_pk);
28+
var currentColor = svg.find('path').attr('fill');
29+
30+
if (currentColor === '#a11010') {
31+
// Change to default color
32+
svg.find('path').attr('fill', ''); // Set to default color
33+
} else {
34+
// Change to full red
35+
svg.find('path').attr('fill', '#a11010');
36+
}
37+
},
38+
});
39+
}
40+
function flag_unflag_handler(e,issue_pk){
41+
e.preventDefault();
42+
var issue_pk = issue_pk;
43+
$.ajax({
44+
type: 'GET',
45+
url: '/flag_issue2/' + issue_pk + '/',
46+
data: {},
47+
success: function (data) {
48+
// Toggle the color of the SVG
49+
var svg = $('#flagSvg' + issue_pk);
50+
var currentColor = svg.find('path').attr('fill');
51+
52+
if (currentColor === '#a11010') {
53+
// Change to default color
54+
svg.find('path').attr('fill', ''); // Set to default color
55+
} else {
56+
// Change to full red
57+
svg.find('path').attr('fill', '#a11010');
58+
}
59+
},
60+
});
61+
}
62+
</script>
1663
<div class="col-md-12">
1764
<div class="text-center">
1865
{% if bugs.has_previous %}

0 commit comments

Comments
 (0)