Skip to content
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

Updated interface in Work Edit page to allow users to add and delete files #1042

Merged
merged 19 commits into from
Apr 4, 2023

Conversation

hectorcorrea
Copy link
Member

@hectorcorrea hectorcorrea commented Mar 31, 2023

There are three major changes on this PR:

  • Updated the work edit page to use DataTables so that files are paginated
  • Updated the UX to allow the user to add files to an existing work
  • Added the ability to delete an existing file from a work

Closes #1021
Closes #1010

Notice that I left a few TODOs in the code that point to an (existing) issue that needs to be addressed separately (#1041)

work-edit

Comment on lines -289 to -310

it "allows users to modify the order of the uploads", js: true do
expect(page).to have_content "Filename"
expect(page).to have_content "Created At"
expect(page).to have_content "Replace Upload"
expect(page).to have_content "Delete Upload"
expect(page).to have_css('.uploads-row[data-upload-key="0"]', count: 1)
expect(page).to have_css('.uploads-row[data-upload-key="1"]', count: 1)

source = page.find('.uploads-row[data-upload-key="0"]')
target = page.find('.uploads-row[data-upload-key="1"]')

# This is necessary to interact with the rendered JavaScript <table> rows
page.scroll_to(target)
sleep 1

source.drag_to(target)
sleep 1

dragged = page.find('.uploads-row[data-upload-key="0"]')
expect(dragged[:id]).to eq(source[:id])
end
Copy link
Member Author

Choose a reason for hiding this comment

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

I have no idea what this test was attempting to test...but we do not allow the user to re-order the display of files so I removed it.

@pulbot pulbot temporarily deployed to staging April 3, 2023 12:11 Inactive
Copy link
Member

@carolyncole carolyncole left a comment

Choose a reason for hiding this comment

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

@hectorcorrea I deployed this to staging and got errors when trying to delete files.
Screenshot 2023-04-03 at 8 36 36 AM

@hectorcorrea
Copy link
Member Author

@carolyncole thank you so much tip, the spaces where indeed the problem.

I've updated the code to use a safe value for the id of the HTML elements (based on the full path of the name) that prevents issue with any non-alphanumeric characters in the name.

Copy link
Member

@carolyncole carolyncole left a comment

Choose a reason for hiding this comment

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

@hectorcorrea now works for me. Thanks for updating it!

@carolyncole carolyncole merged commit 4b89664 into main Apr 4, 2023
@carolyncole carolyncole deleted the issue-1021-edit-two branch April 4, 2023 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants