Comments (7)
I'd like to take this issue on, thank you!
from human-essentials.
Sure!
from human-essentials.
I was wondering if the existing example I should use on all submit-ish buttons lives in the users/registrations/edit.html.erb file? I know it was mentioned the submit button in distributions somewhere, but I couldn’t find it. Here’s what I found in the registrations edit.html.erb file:
<%= _button_to({ text: "Save", icon: "floppy-o", type: "success", align: "pull-right" }, disabled: true) %>
with the respective test in the spec/system/account_system_spec.rb file:
expect(page).to have_button('Save', disabled: true)
I was wondering if otherwise I can use the disable_with feature turbo provides to disable the button and for it to have a little transition saying “processing” or “please wait…“. This means I would:
-
changing the form.submit to form.button in view pages
-
add span class show when enabled
-
add span class show when disabled
-
upon the second click, it will show “processing” or something like that
-
use css to hide and show the spans
-
use the same test to check if it works: expect(page).to have_button('Save', disabled: true)
-
Resource to this method is here at the 9:00 min mark
Would love to get input on which would be the best way forward for this. Thanks!!
from human-essentials.
If you're using disable_with, why do you need all the rest of it? Check something like this https://stackoverflow.com/a/76288769/5199431 - there should be a really easy way to accomplish this.
from human-essentials.
Hi there, I'd like to pick this up if its free?
I've been looking at the existing code to understand the scope:
app/helpers/ui_helper.rb
has a submit_button that disables double-clicking with disable_with
:
def submit_button(options = {}, data = {})
disable_text = options[:disable_text] || "Saving"
_button_to({ text: "Save", icon: "floppy-o", type: "success", align: "pull-right" }.merge(options), data: { disable_with: disable_text }.merge(data), name: options[:name] || 'button')
end
(btw in the hotwire cookbook presentation it's mentioned to use turbo_submits_with
rather than disable_with
, but maybe this project is on a slightly older version of turbo?)
Then I looked at how many forms are used across the project, which seems to be using simple_form_for
(is this a safe assumption to make that all forms are built with simple_form_for
) -> 59
Then searched for occurrences of submit_button
helper -> 51
Is the scope of this task to find the 8 forms that aren't using the submit_button
helper and convert them to use that?
For example, app/views/product_drives/_form.html.erb
is not using the button helper, rather it has:
<%= f.button :submit, :class => 'diaper-drive-submit btn btn-primary', :id => 'product_drive_submit' %>
OR
Are there other kinds of buttons that don't occur within a form, and all those also need to be fixed as well?
Another thought: If there's a lot of forms to fix, the PR could get large, would it be useful to submit smaller, multiple PRs that fix one form at a time?
from human-essentials.
The background on this is that we had several cases where we were getting a lot of double-clicks that resulted in the same action affecting the database twice. So we're mostly concerned with things that have that potential -- There's no significant problem if someone pushes a "view" button twice, for example, or even an "Edit", "Deactivate" or "Restore" button, so those would be lower priority.
There might be an issue if someone double-clicks a "Delete".
I would expect a problem as possible on any save, of course. I could see problems from any of the following if double-click is not blocked: "Fulfill Request", "Submit for Approval", "Approve", any of the buttons that say "Invite", "Request Recertification", "Transfer"... We should probably block it on regenerating the annual report -- though it would just slow it down, probably.
from human-essentials.
Note: Daniela is going to do #3990 first.
from human-essentials.
Related Issues (20)
- [PACKS] #5 Add custom request units (if any) to the confirmation email for partner requests. HOT 1
- [PACKS] # 6 Add custom request units to partner's request list HOT 7
- [PACKS] # 7 Show custom request units in banks' request view
- [PACKS] #8 New / Edit Distribution for the banks shows custom request units, if applicable
- [PACKS] # 9 Distribution printout for banks includes custom request units, if applicable
- [PACKS] #10 Add custom request units to Request export
- [PACKS] 11: Add ability to print all outstanding requests as pick-lists
- [PACKS] #12 Item view should include all fields (including new custom request units) HOT 4
- [PACKS] #13 Calcuate Product Totals
- Bank Request View -- only show fulfillment column if partner has default location
- Account requests and org websites HOT 2
- [BUG]: rspec tests fail in fresh virtual machine dev environments
- Bug: Inventory levels by date with read_events enabled doesn't work before snapshot
- Remove the ability for the superuser to delete users
- Add number of disposable diapers purchased to annual report HOT 2
- Storage Location on purchase and donation should default to the Default Intake Location
- [BUG] if you have an error in defining a kit, the information you entered is not preserved. It should be.
- Distribution, New. Add Another Item should be activated when storage location chosen, after error.
- Clean up distribution print
- Autoscrolling when adding new items in donations/distributions/purchases HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from human-essentials.