You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm investigating adding support for specifying the label to display in the advanced view list's collapsible header. For example, in the image below, I might like to replace "SKILL - 1" with "Ruby."
I'm planning to open a PR with the changes I make, so I want to try to make a change that you might merge upstream.
<% structure.each do |sk, sv| %>
<% if sv.is_a?(Hash) %>
<dt class='attribute-label administrate-field-jsonb-accordion'><%= sk.to_s.titleize %></dt>
<dd class='administrate-field-jsonb-panel'>
<dl class='administrate-field-jsonb-box'>
<% if data[sk].is_a?(Array) %> <% # <------------------ when is this branch triggered? %>
<%= render field.to_partial_path('array'),
field: field, structure: structure[sk], data: data[sk], label: sk.to_s.singularize.titleize %>
<% else %>
<% # ... %>
<% end %>
<dl>
</dd>
<% else %>
<% # ... %>
<% end %>
<% end %>
While iterating over the hash attributes, you check if sv.is_a?(Hash), then later in that same block you check if data[sk].is_a?(Array). It's not clear to me how this branch of code gets executed.
I don't see any examples in the README that have a hash value in the structure, and I don't see any tests at all. Would it be possible for you to provide an example configuration which would exercise this branch?
If I extend the API to support array header labels, I want to try my best to do it in a backwards compatible way. 👍
Thank you!
The text was updated successfully, but these errors were encountered:
Hello!
I'm investigating adding support for specifying the label to display in the advanced view list's collapsible header. For example, in the image below, I might like to replace "SKILL - 1" with "Ruby."
I'm planning to open a PR with the changes I make, so I want to try to make a change that you might merge upstream.
While investigating how I might add support for this, I noticed in this file
app/views/fields/jsonb/_hash.html.erb
:While iterating over the hash attributes, you check if
sv.is_a?(Hash)
, then later in that same block you check ifdata[sk].is_a?(Array)
. It's not clear to me how this branch of code gets executed.I don't see any examples in the README that have a hash value in the structure, and I don't see any tests at all. Would it be possible for you to provide an example configuration which would exercise this branch?
If I extend the API to support array header labels, I want to try my best to do it in a backwards compatible way. 👍
Thank you!
The text was updated successfully, but these errors were encountered: