Skip to content

Commit

Permalink
Merge pull request #1116 from BCStudentSoftwareDevTeam/1115-Event-Att…
Browse files Browse the repository at this point in the history
…achment-Filenames

1115 event attachment filenames
  • Loading branch information
bledsoef authored Jan 19, 2024
2 parents b4d1ecd + 822675c commit 7a30058
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/static/js/displayFilesMacro.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
$(document).ready(function(){
$("a.fileName").tooltip()
$(".removeAttachment").on("click", function(){
let fileId= $(this).data("id")
let deleteLink = $(this).data("delete-url")
Expand Down
3 changes: 2 additions & 1 deletion app/templates/admin/createEvent.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@
{% if filepaths %}
<div class="form-group mb-5">
{% from 'displayFilesMacro.html' import displayFiles %}
{{ displayFiles(filepaths, 'Event Attachments', '/deleteEventFile', '{{course.id}}') }}
<!-- {{eventData.id}} -->
{{ displayFiles(filepaths, 'Event Attachments', '/deleteEventFile', eventData.id, (eventData.id|string) + "/") }}
</div>
{% endif %}
</div>
Expand Down
7 changes: 4 additions & 3 deletions app/templates/displayFilesMacro.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% macro displayFiles(filepaths, titleName, deleteLink, databaseId) %}
{% macro displayFiles(filepaths, titleName, deleteLink, databaseId, prefixToRemove="") %}
<table>
<tr>
<td class="py-2"><strong>Display</strong></td>
Expand All @@ -19,8 +19,9 @@
{% endif %}
</td>
<td class="py-2 px-3" >
{% set filename = key[:8] + "..." + key[-10:] if key|length > 25 else key %}
<a class="mr-5 fileName" data-filename='{{ key }}' href="{{ value[0] }}" target="_blank">{{ filename }}</a>
{% set filename = key.removeprefix(prefixToRemove) %}
{% set shortname = filename[:8] + "..." + filename[-10:] if filename|length > 25 else filename %}
<a class="mr-5 fileName" data-filename='{{ filename }}' href="{{ value[0] }}" target="_blank" data-toggle="tooltip" data-placement="top" title="{{filename}}" aria-labelledby="{{filename}}">{{ shortname }}</a>
</td>
<td style="text-align:center">
<button
Expand Down

0 comments on commit 7a30058

Please sign in to comment.