Skip to content

Use cotton attachment card everywhere an attachment is shown#4892

Merged
wes-otf merged 3 commits into
mainfrom
use-cotton-attachment-card-everywhere
Jun 24, 2026
Merged

Use cotton attachment card everywhere an attachment is shown#4892
wes-otf merged 3 commits into
mainfrom
use-cotton-attachment-card-everywhere

Conversation

@wes-otf

@wes-otf wes-otf commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Closes #4891. I found myself duplicating the logic that was in templates/stream_forms/includes/file_field.html into the cotton templates. With the push we've made to cotton lately, it felt more logical to wrap that logic all into one component and have a uniform display for attachments throughout Hypha.

This also handles for missing attachments in comments & invoices as well as the existing submission & reports.

Test Steps

  • Ensure that missing attachments are properly displayed for submissions/comments/reports/invoices
  • Ensure all attachments display uniformly across Hypha and the attachment card works as expected

@wes-otf wes-otf requested a review from frjo June 23, 2026 15:33
@wes-otf wes-otf added the Type: Minor Minor change, used in release drafter label Jun 23, 2026
def size(self):
if not self.exists:
# Prevent an error for when a file doesn't exist
return 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having this return 0 allows for editing of things like reports when the attachment has been deleted instead of it erroring out because it can't find the file

@wes-otf wes-otf changed the title Use cotton attachment card everywhere an attachment is show Use cotton attachment card everywhere an attachment is shown Jun 23, 2026

@frjo frjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two minor things to look at, otherwise a solid improvement.

Comment thread hypha/apply/stream_forms/templates/stream_forms/render_file_field.html Outdated
Comment thread hypha/templates/cotton/card_attachment.html Outdated
@wes-otf wes-otf requested a review from frjo June 24, 2026 14:53
@wes-otf

wes-otf commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Both should be resolved! Thanks for the flags @frjo!

@wes-otf wes-otf merged commit 4a598a2 into main Jun 24, 2026
6 checks passed
@frjo frjo added the Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). label Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Enhancement This is an improvement of an existing thing (not a new thing, which would be a feature). Type: Minor Minor change, used in release drafter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show an error when an attachment can't be found

2 participants