Skip to content

Update visual indicator for CSV downloads#5495

Open
awwaiid wants to merge 6 commits into
mainfrom
dist-download-started
Open

Update visual indicator for CSV downloads#5495
awwaiid wants to merge 6 commits into
mainfrom
dist-download-started

Conversation

@awwaiid

@awwaiid awwaiid commented Feb 22, 2026

Copy link
Copy Markdown
Collaborator

Experimental change to download button (on distributions for now) to show a toast notification that the download is being processed/downloading. It disappears after 5 seconds.

There is a second PR upcoming that applies this to all CSV download buttons, but the scope for this PR is to look at the pattern first and apply it only to the Distributions csv export.

@awwaiid awwaiid changed the title Dist download started Update visual indicator for CSV downloads Feb 22, 2026

@dorner dorner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

couple comments - also, we should have a test for this, no? :) Or does the existing one cover it?

def handle_csv_export
return unless params[:export_csv]

session[:trigger_csv_download] = true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we not just use flash for this?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yep! Fixed

@@ -0,0 +1,5 @@
<% if session.delete(:trigger_csv_download) %>
<% csv_url = "#{request.path}.csv#{"?#{request.query_string}" if request.query_string.present?}" %>
<iframe src="<%= csv_url %>" class="d-none"></iframe>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Let's add a comment here as to why we're doing this, because it's kind of weird 😛

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

For sure, added

@awwaiid

awwaiid commented Feb 28, 2026

Copy link
Copy Markdown
Collaborator Author

@dorner Yeah good call -- I added both a request spec for the flow and a system spec since this has a dash of js.

@awwaiid awwaiid requested a review from dorner February 28, 2026 21:09
@janeewheatley

janeewheatley commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

This passes functional testing.

@awwaiid

awwaiid commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator Author

One more thing -- see if we can trigger the download with javascript instead of the iframe.

@dorner

dorner commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

@awwaiid awwaiid self-assigned this Mar 15, 2026
@github-actions github-actions Bot added the stale label Apr 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Automatically unassigned after 7 days of inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants