Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ThomasBrunbjerg 90 posts 182 karma points
    Aug 25, 2017 @ 07:22
    ThomasBrunbjerg
    0

    Making a custom property editor for handling content in list group

    I am working on making a property editor that allows the content editor to add "infoboxes" to a page, each of which contains a header and a list of textstrings.

    The desired output is something like this: http://i.imgur.com/SWH9lKX.png

    I already have the markup ready for the boxes, but it should be possible for the content editor to add new boxes with their own content.

    I was thinking of creating a new property editor for the header and the body text. i.e. something like this:

    {
          "name": "Infoboks Header",
          "alias": "infoboksHeader",
          "view": "textstring",
          "icon": "icon-grid",
          "config": {
            "style": "font-size: 20px;",
            "markup": "<div class='col-sm-6'><div class='list-group'><div class='list-group-item'><h4 class='list-group-item-heading'>#value#</h4>"
          }
        }
    

    A complete infoboks with static content currently has this code:

    <div class="col-sm-6">
                                        <div class="list-group">
                                            <div class="list-group-item">
                                                <h4 class="list-group-item-heading">Soveværelser</h4>
                                                <ul class="ul-with-bullets">
                                                    <li>Nr. 1: Dobbeltseng(e) (2 Sovepladser)</li>
                                                    <li>Nr. 2: Enkeltseng(e) (2 Sovepladser)</li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
    

    But I'm not sure how to implement the ul and li elements for the content creator. It should be possible to add new li elements to the list, which consists of a text string. I'm also not too sure how my grid datatype would look for this to work. Currently my datatype looks like this: http://i.imgur.com/DgwqzJd.png

    The boxes automatically align using the flexbox system, so that is no problem.

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Aug 25, 2017 @ 08:38
    Dan Diplo
    1

    Rather than re-invent the wheel I'd be tempted to use an existing editor that would allow this - such as Nested Content or Archetype. You could easily achieve what you wanted with either of these.

Please Sign in or register to post replies

Write your reply to:

Draft