Copied to clipboard

Flag this post as spam?

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


  • Johannes Lantz 156 posts 838 karma points c-trib
    Nov 10, 2021 @ 21:19
    Johannes Lantz
    0

    content picker 'allowRemoveButton' for umb-property-editor

    Hi!

    I am using the the contentpicker in a <umb-property> directive. I can config max, min & idType by doing something like this:

        {
            alias: "page",
            label: "Page",
            view: "contentpicker",
            value: ticket.PageUdi,
            config: {
                 idType: "udi",
                 minNumber: 1,
                 maxNumber: 1,
                 showOpenButton: true,
    
             },
    }
    

    I looking to hide the remove button. Since I just want to display the node & be able to open it. After some digging I found the allowRemoveButton property. But it looks like you can't set that value by using <umb-property-editor>. You would have to use the <umb-node-preview/> directive. I really don't want to use it. Since I have a long list of properties with the contentpicker in the middle of the list.

    Do anyone know if I could hide the remove button with by using the <umb-property-editor> directive. Or do I have to resort to using the <umb-node-preview/> directive?

    //Johannes

  • Johannes Lantz 156 posts 838 karma points c-trib
    Nov 11, 2021 @ 13:56
    Johannes Lantz
    100

    I ended up duplicating the contentpicker.html and removing the things I didn't need and changing:

     allow-remove="allowRemoveButton" 
    

    to:

     allow-remove="model.config.allowRemoveButton"
    

    So now it looks like this:

    JS:

        {
            alias: "page",
            label: "Page",
            view: "components/propertyeditors/contentpicker.html",
            value: ticket.PageUdi,
            config: {
                 idType: "udi",
                 minNumber: 1,
                 maxNumber: 1,
                 showOpenButton: true,
                 allowRemoveButton: false
             },
    }
    

    Html:

    <div ng-controller="Umbraco.PropertyEditors.ContentPickerController" class="umb-property-editor umb-contentpicker">
        <umb-node-preview ng-repeat="node in renderModel track by node.id"
                          icon="node.icon"
                          name="node.name"
                          published="node.published"
                          description="node.url"
                          sortable="!sortableOptions.disabled"
                          allow-remove="model.config.allowRemoveButton"
                          allow-open="model.config.showOpenButton && allowOpenButton && !dialogEditor"
                          on-remove="remove($index)"
                          on-open="openEditor(node)">
        </umb-node-preview>
    </div>
    

    //Johannes

Please Sign in or register to post replies

Write your reply to:

Draft