Skip to content

Commit ab2d000

Browse files
Merge pull request #2361 from OWASP-BLT/CodeWithBishal-patch-1
button with text
2 parents 1c27002 + 5b47b34 commit ab2d000

File tree

1 file changed

+61
-43
lines changed

1 file changed

+61
-43
lines changed

website/templates/includes/_like_dislike_widget.html

Lines changed: 61 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{% comment %} views {% endcomment %}
22
<button disabled
3-
class="like_unlike border-[1px] rounded-2xl 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 "
3+
class="like_unlike border-[1px] rounded-2xl shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[1.3rem] leading-4 p-4 "
44
type="button">
5-
<span id="likes" class="flex items-end">
6-
{{ object.views }} &nbsp;
5+
<span id="likes" class="flex flex-row gap-2 items-center">
6+
{{ object.views }}
7+
<span>Views</span>
78
<svg xmlns="http://www.w3.org/2000/svg"
89
viewBox="0 0 562 352"
910
height="16px"
@@ -14,15 +15,10 @@
1415
</button>
1516
{% comment %} likes {% endcomment %}
1617
{% if request.user.is_authenticated %}
17-
<button name="{{ object.pk }}"
18-
data-tooltip-target="tooltip-bottom-{{ object.pk }}-like"
19-
data-tooltip-placement="bottom"
20-
type="submit"
21-
id="like_unlike"
22-
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 "
23-
type="button">
24-
<span id="likes" class="flex items-end">
25-
{{ likes }} &nbsp;
18+
<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-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 " type="button">
19+
<span id="likes" class="flex flex-row gap-2 items-center">
20+
{{ likes }}
21+
<span>Likes</span>
2622
{% if isLiked %}
2723
{% include "./_tooltip3.html" with text="Unlike" sno=object.pk widget="like" %}
2824
<svg xmlns="http://www.w3.org/2000/svg"
@@ -45,10 +41,10 @@
4541
</span>
4642
</button>
4743
{% else %}
48-
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-like"
44+
<button data-tooltip-target="tooltip-bottom-{{ device }}-like"
4945
data-tooltip-placement="bottom"
5046
onclick="window.location.href='/accounts/login'"
51-
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 "
47+
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
5248
type="button">
5349
<span id="likes" class="flex items-end">
5450
{{ likes }} &nbsp;
@@ -66,14 +62,15 @@
6662
{% comment %} dislike {% endcomment %}
6763
{% if request.user.is_authenticated %}
6864
<button name="{{ object.pk }}"
69-
data-tooltip-target="tooltip-bottom-{{ object.pk }}-dislike"
65+
data-tooltip-target="tooltip-bottom-{{ device }}-dislike"
7066
data-tooltip-placement="bottom"
7167
type="submit"
7268
id="dislike-btn"
73-
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"
69+
class="dislike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4"
7470
type="button">
75-
<span id="dislikes" class="flex items-end">
76-
{{ dislikes }} &nbsp;
71+
<span id="dislikes" class="flex flex-row gap-2 items-center">
72+
{{ dislikes }}
73+
<span>Dislikes</span>
7774
{% if dislikes %}
7875
{% include "./_tooltip3.html" with text="Undo Dislike" sno=object.pk widget="dislike" %}
7976
<svg xmlns="http://www.w3.org/2000/svg"
@@ -96,10 +93,10 @@
9693
</span>
9794
</button>
9895
{% else %}
99-
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-dislike"
96+
<button data-tooltip-target="tooltip-bottom-{{ device }}-dislike"
10097
data-tooltip-placement="bottom"
10198
onclick="window.location.href='/accounts/login'"
102-
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 ">
99+
class="dislike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 ">
103100
<span id="dislikes" class="flex items-end">
104101
{{ dislikes }} &nbsp;
105102
{% include "./_tooltip3.html" with text="Login to Dislike" sno=object.pk widget="dislike" %}
@@ -116,13 +113,14 @@
116113
{% comment %} report {% endcomment %}
117114
{% if request.user.is_authenticated %}
118115
<button name="{{ object.pk }}"
119-
data-tooltip-target="tooltip-bottom-{{ object.pk }}-flags"
116+
data-tooltip-target="tooltip-bottom-{{ device }}-flags"
120117
data-tooltip-placement="bottom"
121118
id="flag-unflag"
122-
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 "
119+
class="flag-unflag rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
123120
type="button">
124-
<span id="flags" class="flex items-end">
125-
{{ flags }} &nbsp;
121+
<span id="flags" class="flex flex-row gap-2 items-center">
122+
{{ flags }}
123+
<span>Flag</span>
126124
{% if isFlagged %}
127125
{% include "./_tooltip3.html" with text="Undo Report" sno=object.pk widget="flags" %}
128126
<svg xmlns="http://www.w3.org/2000/svg"
@@ -145,10 +143,10 @@
145143
</span>
146144
</button>
147145
{% else %}
148-
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-flags"
146+
<button data-tooltip-target="tooltip-bottom-{{ device }}-flags"
149147
data-tooltip-placement="bottom"
150148
onclick="window.location.href='/accounts/login'"
151-
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 "
149+
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
152150
type="button">
153151
<span id="flags" class="flex items-end">
154152
{{ flags }} &nbsp;
@@ -166,13 +164,14 @@
166164
{% comment %} bookmark {% endcomment %}
167165
{% if request.user.is_authenticated %}
168166
<button name="{{ object.pk }}"
169-
data-tooltip-target="tooltip-bottom-{{ object.pk }}-bookmark"
167+
data-tooltip-target="tooltip-bottom-{{ device }}-bookmark"
170168
data-tooltip-placement="bottom"
171-
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 "
169+
class="bookmark rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
172170
type="button">
173-
<span id="bookmark" class="flex items-end">
171+
<span id="bookmark" class="flex flex-row gap-2 items-center">
174172
{% if bookmarked %}
175173
{% include "./_tooltip3.html" with text="Undo Bookmark" sno=object.pk widget="bookmark" %}
174+
<span>Bookmark</span>
176175
<svg xmlns="http://www.w3.org/2000/svg"
177176
viewBox="0 0 448 512"
178177
height="16px"
@@ -182,6 +181,7 @@
182181
</svg>
183182
{% else %}
184183
{% include "./_tooltip3.html" with text="Bookmark" sno=object.pk widget="bookmark" %}
184+
<span>Bookmark</span>
185185
<svg xmlns="http://www.w3.org/2000/svg"
186186
viewBox="0 0 384 512"
187187
height="16px"
@@ -193,10 +193,10 @@
193193
</span>
194194
</button>
195195
{% else %}
196-
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-bookmark"
196+
<button data-tooltip-target="tooltip-bottom-{{ device }}-bookmark"
197197
data-tooltip-placement="bottom"
198198
onclick="window.location.href='/accounts/login'"
199-
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 "
199+
class="like_unlike rounded-2xl border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4 "
200200
type="button">
201201
<span id="bookmark" class="flex items-end">
202202
{{ bookmark }} &nbsp;
@@ -212,24 +212,42 @@
212212
</button>
213213
{% endif %}
214214
{% comment %} notification {% endcomment %}
215-
<button data-tooltip-target="tooltip-bottom-{{ object.pk }}-notification"
215+
<button data-tooltip-target="tooltip-bottom-{{ device }}-notification"
216216
data-tooltip-placement="bottom"
217-
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"
217+
class="relative inline-block shadow-sm rounded-xl transform-[0] font-medium text-[#3e3446] bg-white border-black-2 text-[#0.875rem] leading-4 p-4"
218218
onclick="{% if user.is_authenticated %}subscribe_domain(){% else %}window.location.href=`{% url 'account_login' %}`{% endif %}"
219219
id="subscribe_domain_btn">
220220
{% if user.is_authenticated and subscribed_to_domain %}
221221
{% include "./_tooltip3.html" with text="Unsubscribe" sno=object.pk widget="notification" %}
222-
<svg viewBox="0 0 16 16" fill="currentColor" height="16px" width="16px">
223-
<path d="M10.533 14.07h3.466a.76.76 0 0 0 .58-.28.74.74 0 0 0 .19-.57l-.57-6.55a.13.13 0 0 0 0-.06A6.42 6.42 0 0 0 8 0a6.42 6.42 0 0 0-6.18 6.65v.06l-.57 6.55a.74.74 0 0 0 .19.57.76.76 0 0 0 .56.24h3.468A2.64 2.64 0 0 0 8 16a2.64 2.64 0 0 0 2.533-1.93Zm-1.654 0H7.121a1.13 1.13 0 0 0 1.758 0Zm4.32-1.5H2.8l.5-5.79v-.13A4.92 4.92 0 0 1 8 1.54a4.92 4.92 0 0 1 4.7 5.11v.19l.5 5.73Z">
224-
</path>
225-
</svg>
222+
<div class="flex flex-row gap-2 items-center">
223+
<span>Unsubscribe</span>
224+
<svg viewBox="0 0 16 16" fill="currentColor" height="16px" width="16px">
225+
<path d="M10.533 14.07h3.466a.76.76 0 0 0 .58-.28.74.74 0 0 0 .19-.57l-.57-6.55a.13.13 0 0 0 0-.06A6.42 6.42 0 0 0 8 0a6.42 6.42 0 0 0-6.18 6.65v.06l-.57 6.55a.74.74 0 0 0 .19.57.76.76 0 0 0 .56.24h3.468A2.64 2.64 0 0 0 8 16a2.64 2.64 0 0 0 2.533-1.93Zm-1.654 0H7.121a1.13 1.13 0 0 0 1.758 0Zm4.32-1.5H2.8l.5-5.79v-.13A4.92 4.92 0 0 1 8 1.54a4.92 4.92 0 0 1 4.7 5.11v.19l.5 5.73Z">
226+
</path>
227+
<path d="M.801 16.5a.798.798 0 0 1-.563-.234.786.786 0 0 1 0-1.127L14.635.733a.798.798 0 0 1 1.127 0 .787.787 0 0 1 0 1.127L1.365 16.266A.84.84 0 0 1 .8 16.5Z">
228+
</path>
229+
</svg>
230+
</div>
226231
{% else %}
227232
{% include "./_tooltip3.html" with text="Subscribe" sno=object.pk widget="notification" %}
228-
<svg viewBox="0 0 16 16" fill="currentColor" height="16px" width="16px">
229-
<path d="M10.533 14.07h3.466a.76.76 0 0 0 .58-.28.74.74 0 0 0 .19-.57l-.57-6.55a.13.13 0 0 0 0-.06A6.42 6.42 0 0 0 8 0a6.42 6.42 0 0 0-6.18 6.65v.06l-.57 6.55a.74.74 0 0 0 .19.57.76.76 0 0 0 .56.24h3.468A2.64 2.64 0 0 0 8 16a2.64 2.64 0 0 0 2.533-1.93Zm-1.654 0H7.121a1.13 1.13 0 0 0 1.758 0Zm4.32-1.5H2.8l.5-5.79v-.13A4.92 4.92 0 0 1 8 1.54a4.92 4.92 0 0 1 4.7 5.11v.19l.5 5.73Z">
230-
</path>
231-
<path d="M.801 16.5a.798.798 0 0 1-.563-.234.786.786 0 0 1 0-1.127L14.635.733a.798.798 0 0 1 1.127 0 .787.787 0 0 1 0 1.127L1.365 16.266A.84.84 0 0 1 .8 16.5Z">
232-
</path>
233-
</svg>
233+
<div class="flex flex-row gap-2 items-center">
234+
<span>Sububscribe</span>
235+
<svg viewBox="0 0 16 16" fill="currentColor" height="16px" width="16px">
236+
<path d="M10.533 14.07h3.466a.76.76 0 0 0 .58-.28.74.74 0 0 0 .19-.57l-.57-6.55a.13.13 0 0 0 0-.06A6.42 6.42 0 0 0 8 0a6.42 6.42 0 0 0-6.18 6.65v.06l-.57 6.55a.74.74 0 0 0 .19.57.76.76 0 0 0 .56.24h3.468A2.64 2.64 0 0 0 8 16a2.64 2.64 0 0 0 2.533-1.93Zm-1.654 0H7.121a1.13 1.13 0 0 0 1.758 0Zm4.32-1.5H2.8l.5-5.79v-.13A4.92 4.92 0 0 1 8 1.54a4.92 4.92 0 0 1 4.7 5.11v.19l.5 5.73Z">
237+
</path>
238+
</svg>
239+
</div>
234240
{% endif %}
235241
</button>
242+
{% comment %} resolve {% endcomment %}
243+
{% if request.user.is_superuser or request.user == object.user %}
244+
<button type="button"
245+
onclick="resolveIssue()"
246+
class="rounded-2xl h-auto border-[1px] shadow-sm mb-3 cursor-pointer relative transform-[0] font-medium 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 ">
247+
{% if status == "open" %}
248+
Resolve
249+
{% else %}
250+
Open Issue
251+
{% endif %}
252+
</button>
253+
{% endif %}

0 commit comments

Comments
 (0)