Skip to content
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

Enhancement: Edit line list metadata in place #864

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

joshsadam
Copy link
Contributor

What does this PR do and why?

Describe in detail what your merge request does and why.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other pull requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

PR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

@joshsadam joshsadam self-assigned this Dec 11, 2024
@joshsadam joshsadam added the enhancement New feature or request label Dec 11, 2024
@joshsadam joshsadam changed the title Feature: Edit line list metadata in place Enhancement: Edit line list metadata in place Dec 11, 2024
…nd form improvements

- Added a new `update_field` action in the SamplesController to handle field updates.
- Updated the `check_editable` method to pass the current value to the edit form.
- Modified the `_edit_field_form` partial to include hidden fields for original value and format.
- Updated routes to include the new `update_field` patch route for samples.
- Improved the HTML structure of the edit field form for better integration with Turbo Streams.
…f sample fields

- Added `EditableCell` component to streamline the rendering of editable table cells.
- Refactored `table_component.html.erb` to utilize the new `EditableCell` for cleaner code and improved maintainability.
- Updated `samples_controller.rb` to render Turbo Stream updates for editable fields.
- Introduced `inline_edit_controller.js` to manage focus and submission of inline edit forms.
- Enhanced `_edit_field_form.html.erb` to integrate with the new inline editing functionality.
- Created `_editable_table_field.html.erb` partial to encapsulate editable cell rendering logic.
- Replaced direct update call with a new service object for handling metadata updates.
- Enhanced the update process to better manage field updates and original values.
- Improved code readability and maintainability by encapsulating update logic within a dedicated service.
…error handling and code organization

- Introduced private methods to encapsulate logic for setting field variables and updating sample fields.
- Enhanced error handling by rendering appropriate responses based on sample validation errors.
- Improved code readability and maintainability by organizing the update process into dedicated methods.
…ction

- Updated the styling of the submit button in the EditableCell component for improved visual consistency.
- Refactored the update_field action in SamplesController to streamline the update process using a single service call.
- Improved the HTML structure of the edit field form to enhance integration with Turbo Streams and maintain a consistent user experience.
- Introduced a new test case to verify the functionality of editing a sample field.
- The test navigates to the sample's edit page, interacts with the metadata toggle, and checks for the correct display of the sample's metadata.
- Ensures that the edit field button is functional and properly integrated with the existing sample editing features.
…and update_field actions

- Added `check_editable` method in SamplesController to verify field editability and render appropriate forms.
- Introduced `update_field` action to handle updates for sample fields, utilizing a dedicated service for processing.
- Created `_edit_field_form.html.erb` partial for inline editing, including necessary hidden fields for seamless updates.
- Added `_editable_table_field.html.erb` partial to encapsulate editable cell rendering logic.
- Updated routes to include new paths for `check_editable` and `update_field` actions.
- Enhanced `_table.html.erb` to integrate the new editable functionality, improving user experience with Turbo Streams.
…d field visibility

- Modified the test in `samples_test.rb` to assert the presence of the sample's metadata value directly.
- Changed the interaction from clicking an edit field button to clicking a button that directly represents the sample's value, enhancing the test's accuracy and clarity.
- Added an assertion to verify that the field is correctly displayed after the interaction, ensuring the test covers the expected behavior of the inline editing feature.
…iginal value handling

- Added `original` value support in `inline_edit_controller.js` to store the initial input value.
- Implemented `cancel` method to revert changes on Escape key press, improving user experience.
- Updated `_edit_field_form.html.erb` and `_edit_field_form.html.erb` to pass original value to the inline edit controller.
- Modified input field actions to include cancel functionality, allowing users to easily discard edits.
@joshsadam joshsadam force-pushed the feature/linelist-medata-edit branch from 0393c62 to bb00771 Compare December 13, 2024 02:31
…lidation

- Introduced `field_editable?` method to determine if a field is editable based on its provenance.
- Enhanced the model's capability to manage user-specific metadata, improving the inline editing functionality.
- Renamed test to clarify it checks inline editing of a sample metadata field.
- Added assertions to verify the presence of metadata toggle label and correct sample values in the table.
- Enhanced test coverage for inline editing interactions, ensuring accurate representation of sample data.
- Updated `EditableCell` component to remove the `check_editable_url` parameter, streamlining the initialization process.
- Refactored `SamplesController` to eliminate `check_editable` and `update_field` actions, consolidating field update logic into the `metadata/fields_controller`.
- Introduced new `editable` and `update_value` actions in `fields_controller` to handle inline editing more effectively.
- Removed obsolete partials related to inline editing and updated views to reflect the new structure.
- Enhanced Turbo Stream responses for editable fields, improving user experience during inline edits.
…e editing

- Modified assertions in `samples_test.rb` to check for button elements instead of table cell text for sample metadata values.
- Ensured that the test accurately reflects the current inline editing functionality by verifying the presence of buttons for sample values.
…iting

- Modified assertions in `samples_test.rb` to check for button elements instead of table cell text for sample metadata values.
- Ensured the test accurately reflects the current inline editing functionality by verifying the presence of buttons for sample values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant