November Happy Hour will be moved to Thursday December 5th.

Inject JS/CSS into CMS Edit View

Vote:
 

Hi, I need to add a litle custom CSS into the edit view to hide the nav/toolbar panes when I have a certain querysting parameter. Ideally I would do this with JS, but I can't find a way to inject a custom JS script into the main CMS page (Cms#context=epi.cms.contentdata:///..).

Does anyone know if this is possible?

Thanks,

Paul.

#121442
May 11, 2015 13:32
Vote:
 

Add the following in your module.config in the root of the project (create it if it doesn't exist):

<?xml version="1.0" encoding="utf-8"?>
<module>
    <clientResources>
        <add name="epi-cms.widgets.base" path="~/Path/To/Script.js" resourceType="Script" />
    </clientResources>
</module>
#121486
May 12, 2015 12:01
Vote:
 

Btw, if you need to inject CSS you can add another clientResource-element and set resourceType="Style".

#121507
May 12, 2015 15:18
Vote:
 

I found out that we can use navigation instead epi-cms.widgets.base, that will add the script to both Edit mode and Admin mode

<add name="navigation" path="~/ClientResources/Scripts/xyz.js" resourceType="Script"/>
#179138
Jun 01, 2017 5:36
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.