You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello there, I just "git cloned" the unpoly demo (Rails), and launched it on my computer, everything works properly.
Then I was curious : what if I remove entirely the JS? so I removed <%= javascript_include_tag 'application', defer: true %>
from the app layout.
From what I understand, "progressive enhancement" means the app should work even if the JS is not there.
When I click on "toggle done" for a task, a 500 error arise :
Started GET "/tasks/21/toggle_done" for ::1 at 2024-11-22 21:44:04 +0100
ActionController::RoutingError (No route matches [GET] "/tasks/21/toggle_done"):
Reproduction project
Very minimalist step to reproduce, just clone the demo and remove the JS from the app layout
Steps to reproduce the behavior:
git clone unpoly/unpoly-demo (rails version)
bundle install
go to app/views/layouts/application.erb and remove <%= javascript_include_tag 'application', defer: true %>
bin/rails s
Go to tasks list, and click on "done" on one of the task.
Bug
Expected behavior
if I understand correctly, I should see a toggled task, and no bug
Unpoly also makes an effort to design features in a way that there's a fallback story without JS for every feature. This will usually additional testing by the app developer, and developers may themselves decide whether to care about this use case.
I didn't test without JS for the demo because I wanted to show off the enhancements. Maybe after the 3.10 release I can make a pass over the demo code to ensure basic functionality remains available without JS.
click on "done" on one of the task.
When I click on "toggle done" for a task, a 500 error arise
These are links to make POST or PATCH requests. I was lazy and used an a[data-method], because that was easier for me to style, at the cost of requiring JavaScript. Rails actually comes with a button_to helper that produces non-GET-buttons by rendering a small form with a <input type="hidden" name="method" value="patch">, which works without JS.
Reacted by hpvd, David Boureau and Artemiy Solopov
Ok! I was wondering why we don't see more often this "form/button" pattern, but now this make sense. BTW thanks a ton @triskweline for this incredible project.
Activity
[-]Fully remove JS in the demo[/-][+]Demo app should degrade better without JS[/+]triskweline commentedon Nov 25, 2024
Unpoly also makes an effort to design features in a way that there's a fallback story without JS for every feature. This will usually additional testing by the app developer, and developers may themselves decide whether to care about this use case.
I didn't test without JS for the demo because I wanted to show off the enhancements. Maybe after the 3.10 release I can make a pass over the demo code to ensure basic functionality remains available without JS.
These are links to make POST or PATCH requests. I was lazy and used an
a[data-method], because that was easier for me to style, at the cost of requiring JavaScript. Rails actually comes with abutton_tohelper that produces non-GET-buttons by rendering a small form with a<input type="hidden" name="method" value="patch">, which works without JS.bdavidxyz commentedon Nov 25, 2024
Ok! I was wondering why we don't see more often this "form/button" pattern, but now this make sense. BTW thanks a ton @triskweline for this incredible project.