Copied to clipboard

Flag this post as spam?

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


  • Rick van der Meij 35 posts 135 karma points
    Jan 16, 2015 @ 13:31
    Rick van der Meij
    0

    Use partial when Macro is chosen in RTE

    I have made a macro partial view, which can be selected multiple times inside the RTE.

    The macro needs scripts, css and another partial. Is it possible to render these scripts, css etc only when the macro is created in the RTE.

    something like this?

    @if(Model.Content.GetPropertyValue("bodyText").HasMacro("macroAlias")){
       @Html.Partial("myPartial")
    }
    
  • Valerie 67 posts 163 karma points
    Jan 19, 2015 @ 11:11
    Valerie
    0

    Hello,

    I've always had to either check the bodytext to see if any of the content from my macro is present or check for other environemntal things (check if current node has children etc) to achieve this. I don't think there is a way to detect directly if a macro has been used - I'd love to know if there is.

  • Valerie 67 posts 163 karma points
    Jan 19, 2015 @ 11:19
    Valerie
    0

    Sorry, this was posted in the wrong topic ;)

  • Rick van der Meij 35 posts 135 karma points
    Jan 19, 2015 @ 11:25
    Rick van der Meij
    0

    How do you check the bodytext if there is a macro?

  • Valerie 67 posts 163 karma points
    Jan 19, 2015 @ 11:27
    Valerie
    0

    It's nasty but you can sneak in a class or something in the html that is only specific to that macro :/ then if the bodytext contains it you know the macro is there!

  • Rick van der Meij 35 posts 135 karma points
    Jan 19, 2015 @ 11:44
    Rick van der Meij
    0

    Yeah, ok. Thanks, but I'm not going to do that :)

  • Valerie 67 posts 163 karma points
    Jan 19, 2015 @ 11:46
    Valerie
    0

    Haha ;) I don't blame you.

Please Sign in or register to post replies

Write your reply to:

Draft