Skip to content

Commit 6ec0335

Browse files
committed
Move profile image instructions to a modal popup
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 188bce2 commit 6ec0335

1 file changed

Lines changed: 91 additions & 16 deletions

File tree

fedcode/templates/user_profile.html

Lines changed: 91 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,73 @@
1919
tbody tr:nth-child(even):hover {
2020
background-color: #d3d3d3 !important;
2121
}
22+
23+
.image-container {
24+
position: relative;
25+
text-align: center;
26+
}
27+
28+
/* Camera icon styling */
29+
.edit-button {
30+
position: absolute;
31+
bottom: -5%;
32+
left: 70%;
33+
transform: translateX(-50%);
34+
background-color: #ffffffc6;
35+
color: #252525;
36+
border-radius: 50%;
37+
padding: 10px;
38+
cursor: pointer;
39+
visibility: hidden;
40+
border-color: #ffffffc6;
41+
}
42+
43+
.image-container:hover .edit-button {
44+
visibility: visible;
45+
}
46+
47+
.modal {
48+
display: none;
49+
position: fixed;
50+
z-index: 1050;
51+
left: 0;
52+
top: 0;
53+
width: 100%;
54+
height: 100%;
55+
background-color: #000000b3;
56+
justify-content: center;
57+
align-items: center;
58+
}
59+
60+
.modal-content {
61+
background: #ffffff;
62+
padding: 20px;
63+
border-radius: 5px;
64+
max-width: 500px;
65+
width: 80%;
66+
}
67+
68+
.modal.is-active {
69+
display: flex;
70+
}
2271
</style>
2372
{% endblock %}
2473

2574
{% block content %}
2675
<div class="columns">
2776
<div class="column box content is-offset-1">
28-
<figure class="image is-128x128 mb-2" style="margin: auto">
29-
<img class="is-rounded" src="{{ person.avatar }}?size=200">
30-
</figure>
31-
<p class="is-size-5 has-text-centered">
32-
<a href="#">@{{ person.user.username }}</a>
33-
</p>
34-
<p class="is-size-6 has-text-centered">
35-
We use
36-
<a href="https://gravatar.com" target="_blank" rel="noopener noreferrer">
37-
gravatar.com
77+
<div class="image-container is-centered">
78+
<figure class="image is-128x128 mb-2" style="margin: auto">
79+
<img class="is-rounded" src="{{ person.avatar }}?size=200" alt="Profile Picture">
80+
</figure>
81+
<button class="edit-button" onclick="openModal()">
3882
<span class="icon is-small">
39-
<i class="fas fa-external-link-alt fa-xs"></i>
83+
<i class="fas fa-camera"></i>
4084
</span>
41-
</a>
42-
to create your profile picture using your email address — {{ person.user.email }}
85+
</button>
86+
</div>
87+
<p class="is-size-5 has-text-centered">
88+
<a href="#">@{{ person.user.username }}</a>
4389
</p>
4490
<nav class="level">
4591
<div class="level-item has-text-centered">
@@ -50,18 +96,16 @@
5096
</div>
5197
<div class="level-item has-text-centered">
5298
<div>
53-
<p class="heading">reputation</p>
99+
<p class="heading">Reputation</p>
54100
<p class="title">{{ person.reputation_value }}</p>
55101
</div>
56102
</div>
57103
</nav>
58-
59104
<p class="is-size-6 has-text-centered">{{ person.summary }}</p>
60105
<p class="is-size-6 has-text-centered">
61106
<a href="{% url 'user-edit' person.user.username %}"><button type="submit"
62107
class="button is-link">Update</button></a>
63108
</p>
64-
65109
</div>
66110
<div class="column is-8 ml-3 mr-6">
67111
<div class="box">
@@ -118,4 +162,35 @@
118162
</nav>
119163
</div>
120164
</div>
165+
166+
<!-- Popup modal -->
167+
<div class="modal" id="modal">
168+
<div class="modal-content">
169+
<p class="is-size-6 has-text-centered">
170+
We use
171+
<a href="https://gravatar.com" target="_blank" rel="noopener noreferrer">
172+
gravatar.com
173+
<span class="icon is-small">
174+
<i class="fas fa-external-link-alt fa-xs"></i>
175+
</span>
176+
</a>
177+
to create your profile picture using your email address — {{ person.user.email }}
178+
</p>
179+
<div class="has-text-centered mt-3">
180+
<button class="button is-info" onclick="closeModal()">Close</button>
181+
</div>
182+
</div>
183+
</div>
184+
{% endblock %}
185+
186+
{% block scripts %}
187+
<script>
188+
function openModal() {
189+
document.getElementById("modal").classList.add("is-active");
190+
}
191+
192+
function closeModal() {
193+
document.getElementById("modal").classList.remove("is-active");
194+
}
195+
</script>
121196
{% endblock %}

0 commit comments

Comments
 (0)