When JavaScript is disabled on /admin/content/media, users are unable to use the '+ Add file' button.

On the non-JS version, the '+ Media browser' button is shown instead. However when clicking on it, the interface on /admin/content/media/browser#media-tab-library doesn't seem to work properly. There are 2 links on this page, Upload and Library, and neither seems to do anything. And after uploading an image on this page, one is redirected to a totally blank page (without header, footer, menu, or other site furnitures) showing just the Drupal message 'Status message The file [filename] was uploaded'.

What should happen: non-JS version should show the '+ Add file' button like with the JS one. And when clicked, it should go to a page for uploading file (don't need Library link), like in the iframe overlay on the JS-enabled version. When form is submitted, it should redirect to the /media/[id] page with the appropriate Drupal confirmation message.

Not being fussy here, but core functionality like this should not be reliant on JavaScript. Also fixing this will enable more flexibility for people to link directly to the 'Add File' page on a menu etc.

Comments

dave reid’s picture

I don't think the Media browser works at all without JavaScript. I really wish we had a .js-show class provided in core. We may need to apply it to this link and elsewhere.

idflood’s picture

robeano’s picture

Version: 7.x-1.0-beta5 » 7.x-2.x-dev
Assigned: Unassigned » robeano

I'm taking this one. For now, Media requires Javascript.

robeano’s picture

Status: Active » Needs review

Patched to hide the Add file link in admin/content/media.

I also added that JS is required in the help text.

Updates should be made to any documentation. The module's project page has been updated.

robeano’s picture

StatusFileSize
new2.07 KB

Patched to hide the Add file link in admin/content/media.

I also added that JS is required in the help text.

Updates should be made to any documentation. The module's project page has been updated.

(Uh...patch actually attached this time.)

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community

Since the project requires javascript, this patch removes the "add media" link completely from the admin/content/media page. I guess if users want to work without JS, they can add images to the filesystem and import.

robeano’s picture

Status: Reviewed & tested by the community » Fixed

Committed c78f55b

effulgentsia’s picture

Title: Media admin 'Add file' button does not work without JavaScript » Follow up to Media admin 'Add file' button does not work without JavaScript
Version: 7.x-2.x-dev » 7.x-1.x-dev
Assigned: robeano » Unassigned
Status: Fixed » Needs review
Issue tags: -D7 stable release blocker
StatusFileSize
new2.77 KB

#5/#7 broke the following:
- If you have permission to 'import media', then you don't see that action link on admin/content/media, because the js code replaces it.
- If you don't have permission to 'import media', then you don't get an 'add file' link either, because no <ul> container gets rendered for the js code to insert into.

Here's a patch against 1.x with the fix.

dave reid’s picture

Assigned: Unassigned » dave reid

Assigning for review.

dave reid’s picture

Assigned: dave reid » Unassigned
devin carlson’s picture

Version: 7.x-1.x-dev » 7.x-2.x-dev
Status: Needs review » Closed (fixed)

Adding files is now possible without JavaScript in 7.x-2.x.

For 7.x-1.x, the Media project page lists "Javascript must be enabled in the user's browser" under requirements and I'm not so sure that having users wonder why there is no link to add media (because they have JS disabled) is less confusing then having users wonder why the add media form doesn't work.

Please reopen this issue if you think it is still valid for 7.x-1.x.