Introduce helper for delete/destroy buttons#640
Introduce helper for delete/destroy buttons#640Jonnah151 wants to merge 2 commits intobamnet:mainfrom
Conversation
Summary of ChangesHello @Jonnah151, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Rails helper to standardize the creation of delete and destroy buttons throughout the application. By centralizing this common UI pattern, it aims to improve code consistency, reduce duplication, and simplify future maintenance. The Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a reusable destroy_button helper, which is a great step towards standardizing UI components for destructive actions. The implementation is solid, and it's correctly applied in the screens/show view. The suggestion in the helper to improve consistency and accessibility for buttons with custom content has been kept as it aligns with general best practices. The related changes in the view, which add authorization checks and improve formatting, are also valuable improvements.
app/helpers/destroy_button_helper.rb
Outdated
| method: :delete, | ||
| class: button_class, | ||
| form: form_options, | ||
| title: title) do |
There was a problem hiding this comment.
When a block is provided, the title attribute is set to the title parameter, which can be nil. If a block is used to render an icon-only button and no explicit title is passed, the button will lack a tooltip, which is detrimental to accessibility. The non-block version of this helper correctly falls back to using label for the title. The same logic should be applied here for consistency and improved accessibility.
title: (title || label)) do|
P.S. AFAICT these test failures are unrelated to your work. I'll try to address them in #641. If you rebase after that merges I'm hoping the tests pass here. |
thanks |
|
It looks like this has test failures related to the new button. You should be able to use |
This PR introduces a reusable destroy_button helper to standardize delete/destroy buttons and confirmation dialogs across the application.
Fixes #549