Skip to content

Added name_starts_with_yaml_object edit field and result field - fixes #1269 - #1358

Open
philayres wants to merge 1 commit into
consected:developfrom
hmsrc:name_starts_with_yaml_object-1269
Open

Added name_starts_with_yaml_object edit field and result field - fixes #1269#1358
philayres wants to merge 1 commit into
consected:developfrom
hmsrc:name_starts_with_yaml_object-1269

Conversation

@philayres

Copy link
Copy Markdown
Contributor

Summary

Implements an edit field and result field for name_starts_with_yaml_object.

Edit field

Adds common_templates/edit_fields/_name_starts_with_yaml_object.html.erb, which renders a YAML CodeMirror editor (following the existing pattern used by the JSON edit fields) for yaml_object_* fields backed by a text/varchar column.

Dynamic::FieldEditAs::Handler resolves yaml_object_* fields backed by text/varchar columns to a new yaml_object edit_as field type, handled by Dynamic::FieldEditAs::YamlObject, which validates that submitted text parses as a YAML Hash/Array (raising FphsException otherwise) and persists the original YAML text as-is.

Result field

common_templates/_common_template_result_fields.html.erb parses the stored YAML text via the yaml_parse Handlebars helper and renders it through the existing typeof object structured/collapsible view used for JSON object fields.

Testing

  • Unit specs for Dynamic::FieldEditAs::Handler and Dynamic::FieldEditAs::YamlObject
  • View specs for the new edit field partial and the result field Handlebars condition
  • Jasmine specs for the CodeMirror setup helper and the yaml_parse Handlebars helper
  • System spec covering create/edit of a dynamic model field through the CodeMirror editor

Part of #1251.

Fixes #1269

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.

Implement name_starts_with_yaml_object edit field and result field

1 participant