-
-
Notifications
You must be signed in to change notification settings - Fork 281
enhancement: preview file attachment without download #3681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
f688aa0
add open attachment without download
Nevelito 227ba54
fix standardrb spec
Nevelito 04add95
fix specs
Nevelito 3a5238d
fix standardrb spec fails
Nevelito ff44672
delete changes in yarn lock
Nevelito 88fc94c
request changes
Nevelito a759251
Merge branch 'main' into open_field_attachments
Paul-Bob ecc62c3
request changes
Nevelito 7597bbe
fix bug
Nevelito b99dbde
fix spec
Nevelito c22904d
fix spec
Nevelito e5f1ab6
fix spec
Nevelito 898f26b
tweak
Paul-Bob f77cfe3
Merge branch 'main' into open_field_attachments
Paul-Bob a94cc41
Merge branch 'main' into open_field_attachments
Paul-Bob 6a5e72b
fix spec bugs
Nevelito 02accc0
fix standardb fails
Nevelito 4360823
fix error in rails 7.1 and 8.0
Nevelito 96ce7c0
fix spec error
Nevelito 99438d1
Merge branch 'main' into open_field_attachments
Nevelito e851739
different test approach
Paul-Bob 1dea0ea
Merge branch 'main' into open_field_attachments
Paul-Bob 8047b66
wip
Paul-Bob 03cb3fe
Merge branch 'open_field_attachments' of github.com:Nevelito/avo into…
Paul-Bob ec842db
debug
Paul-Bob 310072c
debug
Paul-Bob 77908ed
mock representable?
Paul-Bob 2d4ef14
debug
Paul-Bob 70df76c
mock
Paul-Bob ae2a32b
debug
Paul-Bob c0d540d
mock order
Paul-Bob 2259d63
rm debugger
Paul-Bob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
app/components/avo/fields/common/files/view_type/grid_item_component.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require "rails_helper" | ||
|
||
RSpec.describe "OpenFieldAttachment", type: :system do | ||
let!(:user) { User.first } | ||
let!(:cv_file) { Rails.root.join("app", "assets", "pdfs", "cv_sample.pdf") } | ||
let(:path) { "/admin/resources/field_discovery_users/#{user.slug}" } | ||
|
||
before do | ||
user.cv.attach(io: File.open(cv_file), filename: "cv_sample.pdf", content_type: "application/pdf") | ||
end | ||
|
||
def test_open_field_attachment(path) | ||
visit path | ||
|
||
link = find('a[rel="noopener noreferrer"][target="_blank"]', visible: :all) | ||
expect(link).to be_present | ||
link.click | ||
|
||
expect(page.driver.browser.current_url).not_to include("download") | ||
expect(page.driver.browser.window_handles.length).to eq 2 | ||
end | ||
|
||
it "opens attachment in new window without download" do | ||
test_open_field_attachment(path) | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.