Copied to clipboard

Flag this post as spam?

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


  • Leon 101 posts 489 karma points
    May 29, 2015 @ 16:16
    Leon
    0

    Partial view macro custom parameter

    Hello.

    How can I make a parameter for a partial view macro that will be a drop down list or radio list or multiple options list?

    Requirement: User to select an image with text that appears if you click on an icon overlaying the image. The partial view parameter is to be a selection for the icon overlay. Something like: Choose your icon overlay image - options: light, dark, left, center, right...

    Leon

  • Chris Day 34 posts 107 karma points c-trib
    May 29, 2015 @ 17:01
    Chris Day
    1

    I have just recently done this in the project I am working on. You need to create a folder in App_Plugins and give it a name. My example was called CornerPosition. It gave me a drop down list to select "Top Right", "Bottom Left" etc.

    within the folder create two following files and code within:

    package.manifest

    {
    propertyEditors:[
        {
            name: "Corner Position",
            alias: "WebsiteName.CornerPosition",
            isParameterEditor: true,
            editor:{
                view: "~/app_plugins/CornerPosition/select.html"
            }
        }
    ]
    }
    

    select.html

    <select ng-model="model.value">
        <option value="top-right" selected>Top Right</option>
        <option value="top-left">Top Left</option>
        <option value="bottom-left">Bottom Left</option>
        <option value="bottom-right">Bottom Right</option>
    </select>
    

    Rebuild and restart your project, and you should find your new custom macro parameter available on the properties page.

  • Leon 101 posts 489 karma points
    May 29, 2015 @ 17:15
    Leon
    0

    YAY!! It worked. That's brilliant. Thank you very much. You're the best!

  • Chris Day 34 posts 107 karma points c-trib
    May 29, 2015 @ 17:18
    Chris Day
    0

    You're welcome :)

  • Leon 101 posts 489 karma points
    Jun 23, 2015 @ 11:27
    Leon
    0

    Hi Chris.

    Since I did this, I needed to update the values in the drop down. I've changed the html "select", but I can't get it to update in the application. Any ideas?

  • Chris Day 34 posts 107 karma points c-trib
    Jun 23, 2015 @ 11:36
    Chris Day
    1

    Yes. After building you need to "touch" the web.config file, just add a space somewhere and save it. Then refresh the website.

  • Leon 101 posts 489 karma points
    Jun 23, 2015 @ 12:37
    Leon
    0

    Thanks. That worked. However, I found that there are issues with browser cache. Opening it in my usual browser (chrome) showed the old values. Opening it in a different browser (IE) showed the new updated values. Umbraco version 7.2.6.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies