Copied to clipboard

Flag this post as spam?

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


  • Paul Gower 28 posts 74 karma points
    Sep 19, 2016 @ 18:31
    Paul Gower
    0

    Always run some AngularJS Code in Umbraco Admin

    So I'm working with a client and they want me to change some styling in the umbraco admin based on the user type. So the easiest way I thought of doing this was to run some code in an angularJS controller so I could easily determine the logged in user type and do the necessary styling.

    I know how to always include styles using the package.manifest in an App_Plugins folder but I can't seem to get angularJS module to do the same.

    Perhaps this is my lack of expertise with angularJS or how umbraco is loading the App_Plugins.

    If someone could help me figure out how to run some code, on every page load in the Umbraco Admin I would be very appreciative.

  • Comment author was deleted

    Sep 19, 2016 @ 18:55

    Hey Paul,

    This post might offer some help on the issue http://24days.in/umbraco/2015/umbraco-7-back-office-tweaks/

  • Paul Gower 28 posts 74 karma points
    Sep 19, 2016 @ 19:02
    Paul Gower
    0

    Thanks, Tim, I will check this out.

  • Paul Gower 28 posts 74 karma points
    Sep 19, 2016 @ 21:24
    Paul Gower
    0

    Thanks, Tim. This blog post helped me understand some of the ways I could hook into the angularJS pipeline; however, I'm having difficulty understanding the best way to do what I am trying to do.

    So the full story is I would like to "hide" the nav/tree section of the page if the user account is not an "admin".

    So far I have these steps running in an "module.run" function:

    1. get the current user using the authResource
    2. check the userType
    3. use appState.setGlobalState("showNavigation", true/false)

    It appears that the appState.setGlobalState is not working as expected. I looked in the code in github to find this appears to be how you are setting the "table/mobile" view and removing the tree navigation area.

    Is there a better way to do this?

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft