-
Notifications
You must be signed in to change notification settings - Fork 118
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
Add markdown widget for interactive app forms #3767
Conversation
I'm not sure about this implementation. Given that we have to That said - I get why you did it. We can't just add another property like |
I made an attempt at improving it somewhat, although the core idea remains the same. |
It seems to me like we need catch the output here and maybe prepend it. Something like this in rendered = case widget
when 'select'
form.select(attrib.id, attrib.select_choices(hide_excludable: hide_excludable), field_options, attrib.html_options)
when 'resolution_field'
# ...
end
# may not even need the if block because nil won't render anything anyhow.
if attrib.header.nil?
rendered
else
header = OodAppkit.markdown.render(attrib.header.to_s).html_safe
"#{header}#{rendered}"
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like it's been some time since you opened this. Is this still on-going? It seems I left a comment, but I haven't seen any updates. Are you waiting on me for something?
e90533b
to
76ecb11
Compare
Sorry for stalling this, some other tasks came up and I kept postponing this. Only thing that might need more consideration would be how it interacts with the dynamic JS, e.g. data-hide-*. Right now, the header is always visible, which is fine in our case at least. In theory it could be useful to hide the header as well if all the form elements under that category/header are hidden, but in our case I don't see it ever being hidden. |
Allows providing a header for elements in Markdown format that is rendered before the element.
36d9181
to
1b0ad78
Compare
apps/dashboard/app/helpers/batch_connect/session_contexts_helper.rb
Outdated
Show resolved
Hide resolved
8b8ef6b
to
d18b9b6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll add a test around sanitize
shortly while it's on my mind.
Allows inserting arbitrary Markdown into the app forms through the form.yml files.
The largest use case for us, which I've also seen others request on Discourse (e.g. here and here), would be use this to create headings/sections in the app form.
For example, the following form YML:
would produce the following form:

This is not fully ready for merging (e.g. missing tests), but I'm submitting this to check whether this could be a potential solution/approach to this feature. Potentially fixes #1806.
I added
serialize?
for SmartAttributes since it would make sense to not store the value of this in anyuser_defined_context.json
or saved settings file (bc_saved_settings
), but.select(&:serialize?)
should probably be refactored into a function if this approach is fine.