Append admin styles.css

Discussion corner for Developers of Serendipity.
Post Reply
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Append admin styles.css

Post 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!
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Append admin styles.css

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

Isn't there a hook for backend css? Can we take advantage of that?
Judebert
---
Website | Wishlist | PayPal
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3657
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post by Don Chambers »

Does pluginmanager.css get loaded from a template folder if it exists?
=Don=
Post Reply