Skip to content

Commit 5b6068c

Browse files
author
mominur-helios
committed
make view options modal popup
1 parent 2c998d2 commit 5b6068c

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

core/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,5 @@
171171

172172
LOGIN_REDIRECT_URL = '/'
173173
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
174+
175+
X_FRAME_OPTIONS = 'SAMEORIGIN'

home/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def get_breadcrumbs(request):
4141
for component in path_components:
4242
url += f'{os.sep}{component}'
4343
if component == "file-manager":
44-
component = "root"
44+
component = "media"
4545
breadcrumbs.append({'name': component, 'url': url})
4646

4747
return breadcrumbs

templates/pages/file-manager.html

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
{% if forloop.last %}
2929
<li class="breadcrumb-item active" aria-current="page">{{ breadcrumb.name }}</li>
3030
{% else %}
31-
<li class="breadcrumb-item"><a href="{{ breadcrumb.url }}">{{ breadcrumb.name }}</a></li>
31+
{% if breadcrumb.name|lower == 'media' %}
32+
<li class="breadcrumb-item active" aria-current="page">{{ breadcrumb.name }}</li>
33+
{% else %}
34+
<li class="breadcrumb-item"><a href="{{ breadcrumb.url }}">{{ breadcrumb.name }}</a></li>
35+
{% endif %}
3236
{% endif %}
3337
{% endfor %}
3438
</ol>
@@ -60,7 +64,7 @@
6064
</ul>
6165
</div>
6266
<div class="col-lg-9 border py-2">
63-
<div class="d-flex justify-content-end mb-3">
67+
<div class="d-flex justify-content-start mb-3">
6468
<label for="fileInput">
6569
<i class="fa-solid fa-upload text-primary fs-3"></i>
6670
</label>
@@ -84,21 +88,9 @@
8488
<td>{{ file.filename|file_extension|cut:"."|upper }}</td>
8589
<td>
8690
<div class="d-flex align-items-center actions">
87-
{% if file.file|file_extension in ".csv, .txt" %}
88-
<a href="/media/{{ file.file }}">
89-
<i title="View" class="fa-solid fa-eye text-primary"></i>
90-
</a>
91-
{% elif file.file|file_extension == '.pdf' %}
92-
<object data="/media/{{ file.file }}" type="application/pdf">
93-
<a href="/media/{{ file.file }}">
94-
<i title="View" class="fa-solid fa-eye text-primary"></i>
95-
</a>
96-
</object>
97-
{% else %}
98-
<span data-bs-toggle="modal" data-bs-target="#file-{{forloop.counter}}">
99-
<i title="View" class="fa-solid fa-eye text-primary"></i>
100-
</span>
101-
{% endif %}
91+
<span data-bs-toggle="modal" data-bs-target="#file-{{forloop.counter}}">
92+
<i title="View" class="fa-solid fa-eye text-primary"></i>
93+
</span>
10294
<div class="dot-separator mx-2"></div>
10395
<span>
10496
<a href="{% url 'download_file' file.file|encoded_file_path %}">
@@ -115,7 +107,7 @@
115107
<!-- Modal -->
116108
<div class="modal fade" id="file-{{forloop.counter}}" data-bs-backdrop="static" data-bs-keyboard="false"
117109
tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
118-
<div class="modal-dialog modal-dialog-centered modal-lg">
110+
<div class="modal-dialog modal-dialog-centered modal-xl">
119111
<div class="modal-content">
120112
<div class="modal-header">
121113
<h1 class="modal-title fs-5" id="staticBackdropLabel">{{ file.filename }}</h1>
@@ -125,11 +117,13 @@ <h1 class="modal-title fs-5" id="staticBackdropLabel">{{ file.filename }}</h1>
125117
</div>
126118
<div class="modal-body">
127119
{% if file.filename|file_extension in ".jpg, .png, .gif" %}
128-
<img class="w-100" src="/media/{{ file.file }}" alt="df">
120+
<img height="700px" class="w-100" src="/media/{{ file.file }}" alt="df">
129121
{% elif file.filename|file_extension in ".mp4, .webm, .ogg" %}
130-
<video class="w-100" height="240" controls>
122+
<video class="w-100" height="700" controls>
131123
<source src="/media/{{ file.file }}" type="video/mp4">
132124
</video>
125+
{% elif file.filename|file_extension in ".pdf, .txt" %}
126+
<iframe src="/media/{{ file.file }}" width="100%" height="700px"></iframe>
133127
{% endif %}
134128
</div>
135129
</div>

0 commit comments

Comments
 (0)