Copied to clipboard

Flag this post as spam?

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


  • Petr Hruzek 28 posts 100 karma points
    Jun 22, 2014 @ 23:50
    Petr Hruzek
    1

    Custom dropdown macro parameter editor

    I am trying to build a custom dropdown macro parameter editor, but it does not show up at macro properties tab.

    I have two files. First App_Plugins/ImageWidthEditor/ImageWidthEditor.html containing

    <div>
        <select class="umb-editor umb-dropdown">
            <option value="20">20 %</option>
            <option value="30">30 %</option>
            <option value="40">40 %</option>
            <option value="50">50 %</option>
            <option value="100" selected>100 %</option>
        </select>
    </div>

    and App_Plugins/ImageWidthEditor/package.manifest containing

    {
        parameterEditors: [
            {
                alias: "ImageWidthEditor",
                name: "Image Width Editor",
                editor: {
                    view: "~/App_Plugins/ImageWidthEditor/ImageWidthEditor.html"
                }
            }
        ]
    }
    
    Am I missing something? Is there any example how to build v7 dropdown parameter editor? I am not able to find anything.
  • Petr Hruzek 28 posts 100 karma points
    Jun 23, 2014 @ 01:03
    Petr Hruzek
    0

    It still does not work, but I must be very close. Now I have three files:

    App_Plugins/ImageWidthEditor/ImageWidthEditor.controller.js

    angular.module("umbraco")
     .controller("My.ImageWidthEditorController",
     function () {
     });

    App_Plugins/ImageWidthEditor/ImageWidthEditor.html

    <div ng-controller="My.ImageWidthEditorController">
        <select ng-model="model.value" class="umb-editor umb-dropdown">
            <option value="20">20 %</option>
            <option value="30">30 %</option>
            <option value="40">40 %</option>
            <option value="50">50 %</option>
            <option value="100" selected>100 %</option>
        </select>
    </div>
    
    and App_Plugins/ImageWidthEditor/package.manifest with
    {
        parameterEditors: [
            {
                alias: "My.ImageWidthEditor",
                name: "Image Width Editor",
                editor: {
                    view: "~/App_Plugins/ImageWidthEditor/ImageWidthEditor.html"
                }
            }
        ],
        javascript: [
            "~/App_Plugins/ImageWidthEditor/ImageWidthEditor.controller.js"
        ]
    }
    Do you see anything wrong in that code?
  • Arunabha Das 38 posts 151 karma points
    Jun 25, 2014 @ 11:43
    Arunabha Das
    1

    In the package.manifest put isParameterEditor: true

     

    {
        propertyEditors
    :[
           
    {
               
    alias:"My.ImageWidthEditor",
                name
    :"Image Width Editor",
    isParameterEditor: true,
                editor
    :{
                    view
    :"~/App_Plugins/ImageWidthEditor/ImageWidthEditor.html"
               
    }
           
    }
       
    ],
        javascript
    :[
           
    "~/App_Plugins/ImageWidthEditor/ImageWidthEditor.controller.js"
       
    ]
    }
  • Petr Hruzek 28 posts 100 karma points
    Jun 27, 2014 @ 11:47
    Petr Hruzek
    0

    Hello Arunabha!

    Well, I am 120 percent sure that I tried that before but with no luck. After your suggestion I tried that again and now it works perfect, strange :)

    Anyways, thank you very much!

  • Pasang Tamang 258 posts 458 karma points
    Jul 06, 2014 @ 07:04
    Pasang Tamang
    0

    Hi all,

    For me just changing in package manifest doesn't work. I was creating a propertyeditor from c# and my code looks like in below:

        [PropertyEditor("mycontentpicker", "mycontentpicker", "/App_Plugins/mycontent/mycontentpicker.html", ValueType = "STRING", IsParameterEditor=true)]
        [PropertyEditorAsset(ClientDependencyType.Javascript, "/App_Plugins/mycontent/mycontentpicker.js")]
        public class MyContentPropertyEditor : PropertyEditor
        {
        }

    Before

    "IsParameterEditor=true"

    was not there but was in package.manifest and doesnt' work. After changing the IsParameterEditor value into true in my class file it works.

     

    Thanks
    PTamang

  • Arunabha Das 38 posts 151 karma points
    Jul 08, 2014 @ 09:36
    Arunabha Das
    0

    Hi Pasang,

    I already mentioned on my post, that In the package.manifest put isParameterEditor: true :)

  • Paul Brown 39 posts 80 karma points
    Aug 22, 2014 @ 13:04
    Paul Brown
    0

    @Petr i have been trying to duplicate what you have done, using same files and filenames etc but I dont seem to get "Image Width Editor" in the Macro Parameter / Type dropdown?

    Does it need registred or something? Any advice greatfully received :)

    Paul

  • Arunabha Das 38 posts 151 karma points
    Aug 22, 2014 @ 13:19
    Arunabha Das
    0

    Hi Paul,

    Reset the iis and clear all browser cache Reload it. it will work.

  • Vishal G.P 62 posts 122 karma points
    Nov 05, 2014 @ 14:48
    Vishal G.P
    0

    Hi... when i try to fetch the value from the dropdown, i always get NULL.

    var size = ViewData.Model.MacroParameters["size"];
    

    What can be the case... my pluging is exactly the same

    angular.module("umbraco").controller("TT.ImageSizeDropdown.ImageSizeController", function () {  });
    
    <div ng-controller="TT.ImageSizeDropdown.ImageSizeController">
    <select ng-model="model.value" class="umb-editor umb-dropdown">
        <option value="full">Heel</option>
        <option value="half">Half</option>
        <option value="quarter">Kwart</option>
    </select>
    

    {
    propertyEditors: [
        {
            alias: "TT.ImageSizeDropdown",
            name: "Image Size",
            isParameterEditor: true,
            editor: {
                view: "~/App_Plugins/TT.ImageSizeDropdown/imagesizedropdown.html",
                valueType: "TEXT"
            }
        }
    ],
    javascript: [
        "~/App_Plugins/TT.ImageSizeDropdown/imagesizedropdown.controller.js"
    ]}
    

    I created a macro with Alias 'size' and Type the type above 'Image Size'.

    Any help on why i get the NULL value when fetching it..

  • Joshua Stewart 36 posts 128 karma points c-trib
    Nov 28, 2014 @ 22:47
    Joshua Stewart
    0

    Hi Vishal,

    Did you create the 'size' parameter on the macro itself in the Umbraco backend?

  • Phil 54 posts 139 karma points
    Jan 27, 2015 @ 10:13
    Phil
    0

    I am having a similar problem to Paul - I have replicated the code that Petr supplied, but I cannot see the ImageWidthEditor parameter in my list of macro parameters.

    I have added the isParameterEditor: true to the package.manifest, reset IIS and cleared my cache but to no avail.

    Does anyone have any ideas?

  • denisedelbando 141 posts 339 karma points
    Aug 20, 2015 @ 14:28
    denisedelbando
    0

    this has worked for me.

    is there a documentation where these properties is listed out? I am a bit frustrated i have to keep searching in google.

  • Stephen Garside 6 posts 75 karma points
    Nov 09, 2018 @ 05:55
    Stephen Garside
    0

    Hi, bit late to the party but I have created a really simple custom dropdown plugin that you can download from github and read how to implement a custom umbraco dropdown parameter here

Please Sign in or register to post replies

Write your reply to:

Draft