Role Specific CSS

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
11/22/2013 4:06:22 PM
Gravatar
Total Posts 199
Community Expert

mojoPortal Hosting & Design @ i7MEDIA!

Role Specific CSS

Hey Joe,

I build a lot of mojoPortal skins, and over the years I've accumulated a lot of little CSS changes to the administration sections of mojoPortal that I always include in my skins. All the little things have added up to quite a lot of CSS now to make things look the way I need them to.

Today I ran into another issue that's along similar lines and lead me to post this request. I use a grid system in my skins and when the skin isn't responsive that grid is based on set pixel widths. This causes an issue where my clients who are viewing content in the WYSIWYG don't see things arranged the way they should be on the page, because the WYSIWYG itself takes up some space on the left and right and causes each grid section to break over.

I've had a number of other issues with content visibility inside the WYSIWYG when the content was heavily styled - these issues are not faults in mojoPortal at all or in the WYSIWYG, they're just things that require me to include extra CSS to fix.

The downside here is that all that CSS is really only useful for admins or content editors. Is it possible that we could include a CSS file inside our skins that is role-restricted, so that all of the CSS fixes we need to add for content administration don't have to be downloaded by regular users who will never see its effects?

We have the ability already to add role-specific HTML via the layout-master in some cases, so it would make sense if we could also include CSS that is also only called if a user is logged into a specific role.

Thanks!
-Isaac

11/22/2013 6:04:38 PM
Gravatar
Total Posts 18439

Re: Role Specific CSS

Hi Isaac,

"We have the ability already to add role-specific HTML via the layout-master"

a link to an extra css file is html so couldn't you do this already?

Best,

Joe

11/22/2013 6:38:59 PM
Gravatar
Total Posts 199
Community Expert

mojoPortal Hosting & Design @ i7MEDIA!

Re: Role Specific CSS

Yes, perhaps we could, but that would mean that particular file doesn't go through the CSS Handler, which means we'd have to edit the skin in a site-specific way to make image URL's and such go to the right place (for instance, if the skin is used in site 2 instead of site 1).

Do you know a way to work around that?

Thanks,
-Isaac

11/23/2013 3:30:52 PM
Gravatar
Total Posts 18439

Re: Role Specific CSS

Hi Isaac,

Ok, I just implemented this new control SkinFolderCssFile. Using either the latest code from our repository or the next release of mojoPortal, you can do something like this in layout.master:

<portal:SkinFolderCssFile id="css1" runat="server" CssFileName="admin.css" VisibleRoles="Admins;Content Administrators" />​

where admin.css is an extra css file in the skin folder that is not included in style.config but will be linked if the user is in one of the VisibleRoles. If VisibleRoles is not specified then it is always goingn to render.

​If you look at the control you'll see I also made it possible to add extra css files based on the url which should come in handy in a pinch but I would not go crazy with lots of url specific css files for different url paths.

Note that in this case the css is not processed at all by css handler but images are resolved relative the url of the css file anyway. The only reason we resolve them in css handler is because the url for csshandler does not reflect the skin path.

Hope that helps,

Joe

 

11/23/2013 6:52:51 PM
Gravatar
Total Posts 199
Community Expert

mojoPortal Hosting & Design @ i7MEDIA!

Re: Role Specific CSS

That's a really big help, I love the VisibleUrls feature and Joe D. mentioned we should be able to make it work with script files also by setting the LinkFormat differently also.

I really appreciate it, thanks!
-Isaac

11/25/2013 9:32:00 AM
Gravatar
Total Posts 18439

Re: Role Specific CSS

Hi Isaac,

Glad to be of help and thanks for the beer!

You could use the new control for scripts but to keep things looking more logical in layout.master I've added similar filtering logic to <portal:SkinFolderScript

​I'm also going to look into adding a setting on <portal:StyleSheetCombiner to make it possible to not render the main csshandler url so that one could make a precombined static css file linked in with SkinFolderCssFile and do away with the overhead of csshandler. Since append the skin guid the reset skin guid will clear the cache for the static file after edits.

Best,

Joe

You must sign in to post in the forums. This thread is closed to new posts.