Admin Control Panel Gets Styles From GetResource.ashx and bootstrap.min.css Depending on the Module,

kentico guy asked on November 11, 2020 17:34

Kentico 12.0.15

I am trying to modify the macro console to make it fullscreen in the browser and this requires modify the bootstrap css. This is a change that is only in the dev environment and thus I will not push it into version control. I know that it's not generally advised to edit the editor but the macro console intellisense works a lot better in fullscreen and it's easier to write code in a bigger textbox.

I have modified custom.less then compiled the bootstrap.min.css and deployed it. If I go into the System > General the new stylesheet is being used by the CMS https://localhost/App_Themes/Default/bootstrap.min.css; but then when I go to System > Macros > Console the browser says "Style sheet could not be loaded. https://localhost/CMSPages/GetResource.ashx?stylesheetfile=/App_Themes/Default/bootstrap.min.css"

Does anyone have any idea why GetResource.ashx? would be able to load the stylesheet on System > General but not on System > Macros > Console ? It's strange that the file loads fine on one menu but not the other. I just checked the event log and I saw something like this but it's confusing to me:

Message: The file '/App_Themes/CMSPages/GetResource.ashx' is in the special directory 'App_Themes', which is not allowed.

I did some research on GetResource.ashx and I think it's actually a virtual file path? So why is the app trying to get a virtual file from a spot that it's own code tells it not to? I never changed this directory I just followed the directions on how to modify only custom.less then recompile the stylesheet. I'm not even planning on pushing this into our git I just want to have this change deployed on dev so that I can use the macro console like an IDE

please advise

Recent Answers

kentico guy answered on November 12, 2020 20:07 (last edited on November 20, 2020 18:20)

After doing some more experimentation, I believe this has something to do with the fact that the macro console is in it's own iFrame and thus the generic bootstrap css rules are not applied. I'm not sure how that works since I'm not a css expert. However, I figured out a way to do this using an embedded style tag, which isn't really ideal but I'm just happy I finally got the large macro console that I wanted. Sure, I can apply the css changes using the browser console, but every time I click "execute" the textbox would go back to the tiny state.

We are using source control and I will not be adding this file to the source repo, as this might cause problems when we upgrade the software. But I was able to make a massive improvement in the macro console by adding the following code in \CMSAdminControls\UI\Macros\Dialogs\ObjectBrowser.aspx in the line after <asp:Content ID="cntContent" ContentPlaceHolderID="plcContent" runat="Server">:

EDITED with my current layout, still loving this. Saving here for when I need it

        .form-control.CM.CM-blue.AutoSize {
            max-width: 100%;
            width: 100%;
            min-height: 300px;
            min-height: 290px;

If anyone knows a better way to do this I'm still curious. I think the macro console works a lot better with a bigger textbox, personally.

Also, is it possible to create a copy of this file and place it in a custom directory outside of the normal directory? I know not to change the stock files IE \CMSAdminControls\UI\Macros\Dialogs\ObjectBrowser.aspx in our repository but could I do something like _customCMSAdminControls\UI\Macros\Dialogs\ObjectBrowser.aspx then link the module up to that new webpart? Even doing that makes me kind of nervous so I'll probably just end up replacing this file manually as needed and never commit it to the repo.

Whenever I do any updates to kentico I clone the repo fresh out of source control anyway, so this won't affect our upgrades. It also never needs to leave dev because I don't use the large console window except to write macros in dev. I'm open for any type of advice that you have on this one.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.