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 >
4448 role ="button "
4549 aria-expanded ="false "
4650 aria-controls ="collapse{{directory.id}} "
51+ onclick ="window.location.href = '{% url 'file_manager' directory.path|urlencode %}'; "
4752 >
4853 {{ directory.name }}
4954 </ a >
5257 {% else %}
5358 < li >
5459 < i class ="fa-solid fa-folder "> </ i >
55- < a href ="{% url 'file_manager' directory.path %} "> {{ directory.name }}</ a >
60+ < a href ="{% url 'file_manager' directory.path|urlencode %} "> {{ directory.name }}</ a >
5661 </ li >
5762 {% endif %}
5863 {% endfor %}
5964 </ ul >
6065 </ div >
6166 < div class ="col-lg-9 border py-2 ">
67+ < div class ="d-flex justify-content-start mb-3 ">
68+ < label for ="fileInput ">
69+ < i class ="fa-solid fa-upload text-primary fs-3 "> </ i >
70+ </ label >
71+ < form method ="post " action ="{% url 'upload_file' %} " id ="upload-file " enctype ="multipart/form-data ">
72+ {% csrf_token %}
73+ < input type ="hidden " name ="directory " value ="{{ selected_directory }} ">
74+ < input id ="fileInput " class ="d-none " onchange ="submitForm() " type ="file " name ="file " required >
75+ </ form >
76+ </ div >
6277 {% if files %}
6378 < div class ="table-responsive ">
6479 < table class ="table ">
7388 < td > {{ file.filename|file_extension|cut:"."|upper }}</ td >
7489 < td >
7590 < div class ="d-flex align-items-center actions ">
76- {% if file.file|file_extension in ".csv, .txt" %}
77- < a href ="/media/{{ file.file }} ">
78- < i title ="View " class ="fa-solid fa-eye text-primary "> </ i >
79- </ a >
80- {% elif file.file|file_extension == '.pdf' %}
81- < object data ="/media/{{ file.file }} " type ="application/pdf ">
82- < a href ="/media/{{ file.file }} ">
83- < i title ="View " class ="fa-solid fa-eye text-primary "> </ i >
84- </ a >
85- </ object >
86- {% else %}
87- < span data-bs-toggle ="modal " data-bs-target ="#file-{{forloop.counter}} ">
88- < i title ="View " class ="fa-solid fa-eye text-primary "> </ i >
89- </ span >
90- {% 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 >
9194 < div class ="dot-separator mx-2 "> </ div >
9295 < span >
9396 < a href ="{% url 'download_file' file.file|encoded_file_path %} ">
104107 <!-- Modal -->
105108 < div class ="modal fade " id ="file-{{forloop.counter}} " data-bs-backdrop ="static " data-bs-keyboard ="false "
106109 tabindex ="-1 " aria-labelledby ="staticBackdropLabel " aria-hidden ="true ">
107- < div class ="modal-dialog modal-dialog-centered modal-lg ">
110+ < div class ="modal-dialog modal-dialog-centered modal-xl ">
108111 < div class ="modal-content ">
109112 < div class ="modal-header ">
110113 < h1 class ="modal-title fs-5 " id ="staticBackdropLabel "> {{ file.filename }}</ h1 >
@@ -114,11 +117,13 @@ <h1 class="modal-title fs-5" id="staticBackdropLabel">{{ file.filename }}</h1>
114117 </ div >
115118 < div class ="modal-body ">
116119 {% if file.filename|file_extension in ".jpg, .png, .gif" %}
117- < img class ="w-100 " src ="/media/{{ file.file }} " alt ="df ">
120+ < img height =" 700px " class ="w-100 " src ="/media/{{ file.file }} " alt ="df ">
118121 {% elif file.filename|file_extension in ".mp4, .webm, .ogg" %}
119- < video class ="w-100 " height ="240 " controls >
122+ < video class ="w-100 " height ="700 " controls >
120123 < source src ="/media/{{ file.file }} " type ="video/mp4 ">
121124 </ video >
125+ {% elif file.filename|file_extension in ".pdf, .txt" %}
126+ < iframe src ="/media/{{ file.file }} " width ="100% " height ="700px "> </ iframe >
122127 {% endif %}
123128 </ div >
124129 </ div >
0 commit comments