enonic / app-contentstudio

Content Studio of Enonic XP
GNU General Public License v3.0
10 stars 4 forks source link

Improve item-set/option-set labels to support dynamic labels #36

Open jsi opened 5 years ago

jsi commented 5 years ago

@abdavid commented on Mon Dec 10 2018

It can get pretty confusing when working with large schemas that has multiple item-sets or even nested item-sets that labels default to (apparently) a sub label or the nearest TextLine.

Example: image-2018-11-19-15-47-29-903

In the attached screenshot there is metadata (one or more products) in each item-set that is unique in the sense that if the label would be able to reflect what data is in the set and present this in the label in a structured way.

I was thinking something like this;

<item-set name="steps">
                    <label>${heading} ${validFor}</label>
                    <expanded>false</expanded>
                    <items>

                        <input type="ContentSelector" name="validFor">
                            <label>Gyldig for disse produktene</label>
                            <occurrences minimum="1" maximum="0"/>
                            <config>
                                <allowContentType>${app}:product</allowContentType>
                                <allowPath>${site}</allowPath>
                            </config>
                        </input>

                        <input type="TextLine" name="heading">
                            <label>Heading</label>
                            <occurrences minimum="0" maximum="1"/>
                        </input>

                        <input type="TextLine" name="subHeading">
                            <label>Sub heading</label>
                            <occurrences minimum="0" maximum="1"/>
                        </input>

                        <input type="HtmlArea" name="subText">
                            <label>Sub Text</label>
                            <occurrences minimum="0" maximum="1"/>
                        </input>
             <items/>
<item-set/>

@alansemenov commented on Wed Jan 09 2019

@abdavid Hi and thanks for your suggestion. We are aware that the logic of setting item-set title is not optimal, but it's the best we can come up with at this moment.

As of now, title is generated dynamically on the client-side, based on the value from the first input inside the item-set's form. Implementing your suggestion would be difficult, mainly because input names in the DOM are not the same as in the schema, so pointing to for example ${validFor} would be pointless since it won't find a target input by this name.

We will discuss this issue internally to see if we can improve current behaviour.

sigdestad commented 5 years ago

Thanks for the input here. We will be looking into this task in details, maybe the new JS expressions can be used for this purpose. Similar to what we are trying out with XP7 display-name-expressions...