-
Notifications
You must be signed in to change notification settings - Fork 74
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
🔥 Remove remote.js
#4030
base: master
Are you sure you want to change the base?
🔥 Remove remote.js
#4030
Conversation
403499b
to
345918e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How can I verify this works fine?
345918e
to
eb78f3f
Compare
Great description @josemigallas ! But looking at the PR, does it mean that we keep maintaining this remote.js functionality? 😅 |
I was looking for a good example and started a bit of archeology... Read the updated description 😂 |
It's a WIP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Seems like a debug change needs to be removed though, before merging.
This has a side effect in some forms, well, I've seen one so far: Apparently, because of this style: porta/app/assets/stylesheets/provider/_finance.scss Lines 1 to 5 in 36eeb45
|
06c6cfd
to
5ec3e7e
Compare
Ah! Good catch. I certainly didn't look in the css |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only tested the invoices screen and works fine. The code looks good.
TL;DR
This was all along supported by rails!!!
Description
Intro
Welcome to 10 Sept, 2010. A world of Rails 2, committing changes without a PR and apparently... no UJS?.
https://github.com/3scale/system/commit/d40a74950775f34b28eeb455a56ace1f078504b6
remote.js
(previously belonged to threescale.application.js) emulates rails-ujs functionality by adding classremote
to forms and links. Instead of sending a synchronous html request, with page reload, they will expect an asynchronous javascript response from the controller.On 29th August 2010, rails 3.0 was released with the following new feature:
Using attribute [data-remote] in links and forms.
Why did the wise people of 2010 decide not to use UJS is unknown. But why we have been maintaining this up until 2025, being already a builtin functionality of rails is beyond reckoning.
Study case: Plan New Feature
By clicking "New Feature" a modal is opened with the following "remote" form:
Upon submission, the form will trigger an AJAX call to this method:
porta/app/controllers/api/features_controller.rb
Lines 21 to 31 in d74aa64
And then return:
porta/app/views/api/features/create.js.erb
Lines 1 to 6 in 25fa9bc
Which will update the current page without reloading:
When class
remote
is not present, a:js
response from the server will look like this in the browser:The Twisth
Replace class
remote
with propremote: true
and voilà, it behaves exactly the same.Verification
Check pre-existing forms and anchors with class
remote
.Places already found and verified (by @josemigallas):
app/views/api/pricing_rules/_pricing_rule.html.erb:10
app/views/finance/provider/invoices/_actions.html.erb