Copied to clipboard

Flag this post as spam?

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


  • Danny Blatant 91 posts 358 karma points
    Oct 17, 2014 @ 15:52
    Danny Blatant
    0

    Custom Partial View Macro parameters (Umbraco 7)?

    Hi everyone, another day another question!

    I have a couple of Partial View Macro's which are designed to be used in the RTE or otherwise, and everything is fine and dandy! (Wouldn't it be great if the post ended there PMV win!)

    Now, I want to add a parameter to said macro and I'm presented with a few issues...

    Firstly, I wish for one of my Parameters to be "Pick a single content item from below node X". I see the Content Picker but this is not suitable as I want to either limit the choices to a particular document type and/or ideally set the root node in which to look under. Can anyone help here?

    I notice that there are very few Data Types available as parameters in the Macro Parameters screen. Even my custom Drop downs and nuPicker derived Data Types are unavailable. Is there any way I can make my Data Type available as a Macro parameter?

    Lastly, I see no option for making the field required. Is this possible with Partial Macro View's macro parameters??

    Kind Regard,

    Danny "Blatant"

  • Danny Blatant 91 posts 358 karma points
    Oct 17, 2014 @ 16:50
    Danny Blatant
    0

    I found a piece of information regarding creating Property Editors in App_Data and adding a flag tothe manifest, as detailed here:

    http://www.nibble.be/?p=349

    http://umbraco.github.io/Belle/#/tutorials/manifest

    However, this deals with creating brand new, primitive Property Editors. I'm actaully interested in exposing an existing DataType I registered in Umbraco back end, this DataType was based on the nuPickers.SqlDropDownPicker Property Editor...

    This also doesn't help me determin how to set up a required parameter in my macro (on which the PVM is based), so any further hints and advise is well recieved still!

  • Danny Blatant 91 posts 358 karma points
    Oct 17, 2014 @ 17:21
    Danny Blatant
    0

    Further still, I found this :

    http://our.umbraco.org/documentation/Extending-Umbraco/Macro-Parameter-Editors/# http://www.richardsoeteman.net/2010/01/04/CreateACustomMacroParameterType.aspx

    But these are clearly based on Umbraco6, anyone have any advise in this in Umbraco 7 context?

    The 2 questions with the above examples I have are :

    1. Where do I create the class?
    2. Where do I enter my Parameter in the database (there is no cmsMacroPropertyType table in U7)? With the latter, a bit of source code digging suggests that we do this with attributes now but still not found an Umbraco 7 Macro Parameter goto document!
  • Charles Afford 1163 posts 1709 karma points
    Oct 18, 2014 @ 13:04
    Charles Afford
    0

    Hi Danny,

    What are you trying to achieve overall.

    May be there is another way around it :).

    Charlie.

  • Danny Blatant 91 posts 358 karma points
    Oct 20, 2014 @ 10:50
    Danny Blatant
    0

    Hi Sharles,

    Sorry let me give you some background!

    Firstly I have a site content structure as so (simplified for example):

    Home (homePage)
    --About Our Clubs (richTextPage)
    --Club Images (richTextPage)
    --Clubs (container)
    ----Club 1 (club)
    ----Club 2 (club)
    ----Club 3 (club)

    homePage is a special DocType for the homepage, richTextPage features an RTE in which the editors create columns, content, image and embed Partial View Macros (PMV). the container type is simply a 'folder' DocType for organising and beneath this we have clubs, which contain club specific data.

    on our richTextPages we have a "Club Selector" PVM, which looks for the container, iterates the clubs and displays a carousel. Beneath this we give the editor a choice of PVM's, for example clubInformation, clubImageGallery or clubMap. The carousel creates a jQuery event and sets session vartiables, while the other PVM's react to this event and session change.

    All this is fine, however I wish to be able to set the 'default' club within the club Carousel, for this I tought a Macro Paramter would be apt, and that this would be a form of content picker, but the content picker Parameter type lacks the ability to set the DocType to select or the root node, so to speak. This is why I thought I'd simply roll my own.

    I have had some progress, after alot of work I think I have the angular style of parameter markup working within App_plugins, however I am much more interested in how to do this with C# within my web project, as it is done in umbraco source (from the little i've mined out!).

    Do you have any suggestions as to how to achieve what I'm looking for? i.e. the ability to set a content picker macro parameter, with root node and doctype filter, to ensure the editor can only choose a club?

    In an absolutely ideal would I'd like to bundle the macro parameter in with my existing Club Selector Controller and models (I have custom Clubs Model as I pull some data from a 3rd party source)...

    Thanks for taking the time to look and reply!

    Danny "Blatant"

  • Charles Afford 1163 posts 1709 karma points
    Oct 20, 2014 @ 20:24
    Charles Afford
    0

    Hi Danny,

    On the rich text editor pages what properties do you have on there?

    Would it possible to have a content picker for items to be displayed in the carousel rather than having a macro?

    On the 'clubs' could you not just set a boolean property that when checked will become the default? That way you already have the data and just need to check if the boolean is true?

    I am most likely missing something. It just feels this is more complicated than it needs to be :)

    Charlie :)

  • Danny Blatant 91 posts 358 karma points
    Oct 21, 2014 @ 12:33
    Danny Blatant
    0

    Hi Charlie,

    On the Clubs DocType I have some meta info on the clubds ((string)title, (urlPicker)url, (RTE)about the club, etc) as you would imagine. on the rich Text pages I have a load of stuff like nav positioning, meta, and the content stacker (RTE's and styling options in an Archetype).

    I get what you are leading at, however we develpp sites that are then handed over to the client for management (editing), and part of this is the clients are rarely CMS guru's, sometimes not even Html savvy. Part of this then is to make the editing and CMS work fool-proof.

    That is the issue with a plain content picker as a parameter, the editor could just pick the Homepage node! Likewise with a default tick box they could easily pick more than one default (for instance they want Club 2, but Club 1 is default already, they set Club 2 but forget to unset Club 1). Basically there is an avenue for the editor to 'break' the site, or at least have it behave in unexpected ways.

    This is the whole ethos to putting the time into what I am attempting, I am looking to supply specific fields in order to make editing "just so".

    I am still wishing of a Macro Parameter that will just let you pick one of your existing Data Types, that would be the best answer in my humble opinion!

    Thanks,

    Danny "Blatant"

  • Charles Afford 1163 posts 1709 karma points
    Oct 25, 2014 @ 18:18
    Charles Afford
    0

    Hi Danny sorry for the late reply, had a lot of stuff going on.

    Yea i know what you mean, it would be a great thing to have if it was possible. XD.

    I think you should put a solution in and handle situation in the markup and razor where the user has not configured the page correctly.

    Charlie :)

  • Marco Ranieri {umbriaco} 21 posts 84 karma points
    Dec 17, 2014 @ 16:47
    Marco Ranieri {umbriaco}
    0

    Hi Danny,
    have you solved the problem?
    So, is possible in Umbraco 7 use Data Type for Macro Parameters?
    It sounds like a powerful tool for developers and editors. It could be a fantastic features for next release, do you think?

  • Danny Blatant 91 posts 358 karma points
    Dec 17, 2014 @ 19:13
    Danny Blatant
    0

    Hi Umbriaco,

    Sorry but no there is no solution that I found.

    I had to resort to primative Macro Parameters (i.e a content picker) and a butt load of validation (is the selected node correct) and a hard coded default (kind of defeats the point but hey ho).

    I do whole hartedly agree that the solution (pie in the sky) would be to allow MarcoParameters to be any Data Property configured in the CMS, rather than the more bespoke 'primative types' style list we have at the moment.

    I say, Pie in the Sky... I wouldn't know where to start with this!

    Kind Regards,

    Danny Blatant

  • Rob Scott 41 posts 94 karma points
    Feb 24, 2015 @ 18:11
    Rob Scott
    1

    I agree w/ Danny - this should be standard Umbraco stuff here. I'm needing the EXACT thing he is, while my needs are a "Member Group Picker" parameter instead of the RTE.

  • Robert J. Bullock 386 posts 405 karma points
    Apr 16, 2015 @ 22:40
    Robert J. Bullock
    0

    I'll echo what Danny and Rob said... It would be REALLY useful to use any datatype as a macro parameter, though I could see how that would be tricky (for example, what would you do with something like Archetype)?

Please Sign in or register to post replies

Write your reply to:

Draft