Page 1 of 1

Append admin styles.css

Posted: Thu Dec 04, 2008 5:35 am
by Don Chambers
So let's say I have a reasonable understanding of admin templates and the admin css...

Lets also say that I like the the default admin template 99.9% for a given template....

but that template needs something the default template does not provide....

For instance, pluginmanager assumes I only have 3 sidebars:

Code: Select all

.pluginmanager_side {
    vertical-align: top;
    width: 33%;
}
But maybe I have 4, and want that width to be 25%.. or 5, and I want that width to be 20%, etc.

Or maybe, I have a special class/id emitted in my template config that emits a class not previously defined by the admin template:

Code: Select all

$msg = "<div class='unique'>. MESSAGE . "</div>"; 
Can anyone think of a way that we could, perhaps, APPEND a stylesheet to the regular stylesheet on the backend instead of taking the default and just adding the few extra styles? Maybe, if a css file of a certain name existed in /templates/mytemplate/admin/append_style.css, it would be loaded after /admin/style.css?

I am also wondering about future-proofing this... today we have one admin template..... 1.4 will give us something different... 1.5 could be something different again... etc.

Late for me, thinking out loud. Input welcome as always!

Re: Append admin styles.css

Posted: Thu Dec 04, 2008 11:49 am
by garvinhicking
Hi!

The current admin/index.tpl loads two CSS files, the main style.css and the pluginmanager.css - couldn't you append your custom style to that custom variant of a pluginmanager css file?

Of course, we could add a third stylesheet there, but that will require us to edit all instances of admin/index.tpl files we have. That is currently not a lot, luckily. But this illustrates why templated admins are quite hard: You can never really add functionality very well.

Regards,
Garvin

Posted: Thu Dec 04, 2008 3:41 pm
by Don Chambers
I already appended my rules to a copy of the admin style.css.... what I was trying to prevent was a) a 99% identical style.css file and b) a "locked in time" style.css.

For instance, if I just have a few additional rules, and I add them to a duplicate of style.css, and save that with my template, the template will not benefit from any future modifications to the default admin style.css....

This same potential problem is what prevented me from modifying the admin index.tpl file. The logic currently says "if template has admin/style.css, use that one... if not, use default/admin/style.css.

I was wondering if the logic could be easily modified to also say, "elseif template has admin/append_style.css, load /default/admin/style.css THEN load /template/admin/append_style.css.

Its just an idea, and only worth pursuing if you feel it has merit. If not, I already have the alternative in place by placing my additional rules into a copy of the admin stylesheet and saving it in my template folder.

Posted: Thu Dec 04, 2008 6:09 pm
by garvinhicking
Hi!

Loading more than one stylesheet definitely requires a change in the index.tpl template file for one more <link> rel. If you think that's fine and understand that every admin/index.tpl would need to be patched for that and only available in s9y >= 1.4, I'm surely willing to go that route. :)

Regards,
Garvin

Posted: Thu Dec 04, 2008 8:27 pm
by judebert
Isn't there a hook for backend css? Can we take advantage of that?

Posted: Fri Dec 05, 2008 10:37 am
by garvinhicking
Hi!
judebert wrote:Isn't there a hook for backend css? Can we take advantage of that?
Hooks can only be used by plugins, a template can't do that - you would then create a dependency on a plugin which is something that I try to avoid, if necessary.

Regards,
Garvin

Posted: Fri Dec 05, 2008 3:14 pm
by Don Chambers
Does pluginmanager.css get loaded from a template folder if it exists?