Skip to content

Allow embedded_block in report to use a URL with /edit - fixes #325#870

Merged
philayres merged 4 commits intoconsected:developfrom
hmsrc:embedded-block-edit-mode-325
Jan 23, 2026
Merged

Allow embedded_block in report to use a URL with /edit - fixes #325#870
philayres merged 4 commits intoconsected:developfrom
hmsrc:embedded-block-edit-mode-325

Conversation

@philayres
Copy link
Contributor

Summary

This PR implements GitHub issue #325 - allowing embedded_block in reports to open records in edit mode when the URL ends with /edit.

Changes

Ruby Helper (app/helpers/report_results/reports_common_result_cell.rb)

  • Modified cell_content_for_embedded_block to detect URLs ending with /edit
  • Adds data-edit-mode="true" attribute to the target div for edit URLs

JavaScript (app/assets/javascripts/app/_fpa_ajax_processors_reports.js)

  • Modified report_embed_dynamic_block postprocessor to check data-edit-mode attribute
  • When edit mode is enabled, automatically clicks the edit button to open the form
  • Sets up ajax:success handler to close the modal after a successful save

Bug Fix (app/assets/javascripts/app/_fpa.js)

  • Fixed modal stacking issue where modal was getting was-in class instead of in

Test Coverage

  • 11 unit tests in reports_common_result_cell_spec.rb - all pass
  • 4 system tests in report_embedded_block_spec.rb - all pass:
    • Dynamic model show mode (existing behavior)
    • Dynamic model edit mode (new feature)
    • Dynamic model edit mode with save (closes modal)
    • Activity log edit mode (new feature)

Usage

To use the edit mode feature in a report, configure the column to show as embedded_block with a URL ending in /edit:

SELECT
  '/masters/' || master_id || '/dynamic_model/my_table/' || id || '/edit' AS edit_link
FROM my_table
column_options:
  show_as:
    edit_link: embedded_block

Fixes #325

- Ruby: Extracted parse_embedded_block_url and build_embedded_block_html private methods
- JavaScript: Added JSDoc comments and extracted setup_edit_mode function
- Unit tests: Added shared examples for URL parsing tests
- System tests: Added helper methods and shared examples for cleaner test organization
@philayres philayres merged commit bbe3dad into consected:develop Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow embedded_block in report to use a URL with /edit

1 participant