? ? Success

User tests: Successful: Unsuccessful:

avatar Sophist-UK
Sophist-UK
2 Jun 2014

See tracker #33026.

This change was previously submitted as #2684, and as per @Bakual I am resubmitting it as a way to reopen it. The background to this is as follows:

  1. A lot of Fabrik users want to make lists more compact - since there is no custom.css in the standard Joomla admin templates, at present we are using locale-based CSS i.e. en-gb.css (how weird is that!!!) to achieve this. Custom.css would be a more standard way of achieving this, and will be more convenient when developing a multi-country web-site where admin users might change locale frequently to test how it looks/works.
  2. Clearly a user can change the basic css files for the template, however that will be overwritten when you apply a Joomla update.
  3. It was previously suggested that the way to achieve this is to copy the template e.g. create my-isis and make changes to the CSS there. Copying an Admin template just to change small CSS seems to me to be a little over-kill - and will then provide a potential minefield of incompatibility where you are using a copy of an old template against an updated rest of Joomla, and a maintenance overhead to re-copy and reapply the css changes every time there is a joomla update.

This is a small and simple change with little risk, so I am not clear why there should be any issue with implementing it.

Votes

# of Users Experiencing Issue
2/2
Average Importance Score
4.50

avatar Sophist-UK Sophist-UK - open - 2 Jun 2014
avatar Sophist-UK Sophist-UK - change - 2 Jun 2014
Title
Load custom.css (if exist) in Admin templates.
[#33026] Load custom.css (if exist) in Admin templates.
avatar zero-24
zero-24 - comment - 2 Jun 2014

Hi,
in 2013 i have open a similar PR / FT
FT
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31135&start=0
Joomla Dev CMS:
https://groups.google.com/forum/?hl=en&fromgroups#!topic/joomla-dev-cms/jo5pFTx4gpE

After this i have release a simple Plugin that do this job.

You can see here:
http://joomlacode.org/gf/project/joomla/tracker/?action=TrackerItemEdit&tracker_item_id=31135&start=0 (last comment)
or direktly here:
http://www.jah-tz.de/joomla-custom-css-plugin-joomla-3.html (german)
http://translate.google.de/translate?hl=en&ie=UTF8&prev=_t&sl=de&tl=en&u=http://www.jah-tz.de/joomla-custom-css-plugin-joomla-3.html (english)

Also you can find some similar plugins at the JED.

This is a small and simple change with little risk, so I am not clear why there should be any issue with implementing it.

Yes.

avatar Bakual
Bakual - comment - 2 Jun 2014

Personally I prefer a plugin/module approach here. You even get more flexibility here, especially if using a module because you can only apply certain styles to specific menu items.

If we merge this, it would be kind of an undocumented feature which then only a few would use.

avatar Sophist-UK
Sophist-UK - comment - 2 Jun 2014

A. There are (as far as I can find) two extensions - the one @zero-24 mentions above (which is not in the JED and not available in english - which I am therefore not as comfortable about as I would really like) and the Custom CSS extension which puts your .css into a module (which presumably means it is sent to the browser in HTML with every page rather than cached locally like a custom.css file would be).

Using a plugin extension seems to me to be a much more complex solution than this PR to a simple requirement for a an ability to provide a global css tweak to a template.

B. custom.css is in fairly common usage - so many people will expect this to be available - and it is only undocumented if it is ... um ... undocumented, easily fixed with a couple of lines in the Joomla documentation as well sites like stackoverflow documenting it which are then easily found in google.

P.S. Does anyone know what the purpose of locale-based css files is? I don't understand why we have these but there is such resistance to having a custom.css.

avatar zero-24
zero-24 - comment - 3 Jun 2014

@Sophist-UK

(which is not in the JED ...

This is true. Is there any problems?

... and not available in english ...

This is not true. (only the website is not english)

... which I am therefore not as comfortable about as I would really like)

hmm don't understand this point. It implement your if statment you want to have into the core. With this plugin you can use it at every template (Backend and Frontend)

avatar Bakual
Bakual - comment - 3 Jun 2014

A. There are (as far as I can find) two extensions

There are two categories which both contain several extensions which I think will allow you to do what you want.
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/head-code
http://extensions.joomla.org/extensions/style-a-design/templating

I didn't check which of them also work for the backend. However it should be easy to adjust an existing extension to allow it if needed. Maybe the developer would even add it as feature.

P.S. Does anyone know what the purpose of locale-based css files is?

The purpose is to provide language specific CSS rules I guess.

I don't understand why we have these but there is such resistance to having a custom.css.

You made a good point with the language CSS files actually. Imho we have to many of those undocumented features already in core which could be solved nicely by using a module or plugin approach. I just don't like it much to add even more of them when there is no real need for it. Like in this case where there are several easy-to-use and lighweight extensions which provide that function.

avatar Sophist-UK
Sophist-UK - comment - 3 Jun 2014

I agree that extensions are the best approach where the requirement is complex and somewhat niche because the performance hit of an extension would be small by comparison to the impact of putting the code in Joomla core and it doesn't make sense to have a performance hit of the complex code for people who don't need it.

I am less sure that extensions are the best approach for a very simple and generic requirement like this. If we try to provide ALL functionality through extensions, both the server-side performance and network bandwidth are likely to be severely hit.

So an extension to do this simple thing to add a custom.css for the template would need to:

  1. Scan the output before it is sent to the browser;
  2. See if there is already a custom.css called for the template - ignoring custom.css that e.g. is used for modules.
  3. See if there is a custom.css file for the template (is it clear where this would need to be located?)
  4. Decide where the last template css file is called in the HTML;
  5. Insert a new call to custom.css just after this last CSS file.

Since this is complicated, the extensions previously mention put css code into a module which is sent to the browser on every page load rather than the custom.css file being cached.

So, I believe that some requirements ARE best delivered by changes to core code rather than using plugins, and that this is one of these.

avatar Bakual
Bakual - comment - 3 Jun 2014

Actually, the easiest extension way would be a module which you load into a module position. It doesn't have to scan anything. It just loads a file into the head. The user even can define the file himself and specify on which page it should be loaded. The module doesn't need to generate any output.
It's actually very easy and doesn't really have a performance impact.

avatar Sophist-UK
Sophist-UK - comment - 3 Jun 2014

That is true.

I guess the other thing we should strive for is consistency - either all templates have a custom.css or none do.

avatar sovainfo
sovainfo - comment - 3 Jun 2014

Agree with striving for consistency, disagree with either all or none.
Consistency to me means you act the same when circumstances are the same. You are turning it into: act the same regardless the circumstances.

avatar Sophist-UK
Sophist-UK - comment - 4 Jun 2014

That was not my intent.

For me, consistency is about user (i.e. Joomla administrator as well as end-user) expectations - that they should expect the system to operate (in both surface and underlying ways) in a consistent manner so that e.g. (in this example) there either is an ability to use a custom.css file on all templates or there is a well understood approach to need an extension (which might then through market forces narrow down to one of several de-facto extensions for different types of need). In other words, how to do such-and-such should be obvious (either immediately from the UI or easily found in Joomla documentation or a google search).

avatar sovainfo
sovainfo - comment - 4 Jun 2014

And that is what the user gets now. It works in a consistent manner. The manner being to leave the technical implementation up to de template developer. Whether and how customizations are implemented is completely his choice. Control is transferred to the template, as is consistent with modules and components.

avatar Bakual
Bakual - comment - 4 Jun 2014

Whether and how customizations are implemented is completely his choice. Control is transferred to the template, as is consistent with modules and components.

@sovainfo Just to clarify, the proposed code here would only add this function to the administrator templates Isis and Hathor. It has no impact on other templates at all.

avatar sovainfo
sovainfo - comment - 4 Jun 2014

@Bakual Understood that. The first time I saw this I agreed with the request. Only after reading and thinking about the complete discussion, I agree with not implementing this. You know how much I like consistency. Was trying to get the point across that doing something differently doesn't mean it is inconsistent. Take off the blindfold and look at things from a different perspective (figure of speach, not meant at you directly).
Implementing it in Hathor but not in Isis wouldn't make it inconsistent to me, because the technical implementations should have that freedom.

avatar brianteeman brianteeman - change - 8 Aug 2014
Labels Added: ?
avatar brianteeman brianteeman - change - 21 Aug 2014
Status New Pending
avatar nicksavov nicksavov - change - 21 Aug 2014
Labels Removed: ?
avatar brianteeman brianteeman - change - 2 Sep 2014
Category Template
avatar infograf768
infograf768 - comment - 3 Sep 2014

Concerning frontend, I have released a while ago a small plugin doing that and also that takes care of RTL vs LTR via a custom.css
http://extensions.joomla.org/extensions/style-a-design/templating/20389

avatar Sophist-UK
Sophist-UK - comment - 3 Sep 2014

Your plugin is front-end - this PR is for back-end.

avatar infograf768
infograf768 - comment - 4 Sep 2014

Yes, this was to explain that 3rd party extensions can easily be used instead of modifying core.
#4211

avatar brianteeman brianteeman - change - 8 Sep 2014
Category Template Templates (admin)
avatar brianteeman brianteeman - change - 17 Oct 2014
Status Pending Needs Review
avatar mtmeyrick mtmeyrick - test_item - 17 Oct 2014 - Tested successfully
avatar phproberto
phproberto - comment - 19 Oct 2014

For me this is the right approach. It makes no sense at all to distribute a template which CSS you cannot customise minimally without losing your changes on update. This should be in all our frontend and backend templates. With a good documentation about it I'm sure all templates will adopt the same system (a lot of them already do it).

Having to install one extension for this only makes things and site harder to maintain.

So :+1: here

avatar brianteeman brianteeman - change - 1 Jan 2015
Labels Removed: ?
avatar davdebcom davdebcom - test_item - 28 Feb 2015 - Tested successfully
avatar roland-d roland-d - change - 28 Feb 2015
Status Needs Review Ready to Commit
avatar davdebcom
davdebcom - comment - 28 Feb 2015

@test
Tested successfully


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/3709.
avatar brianteeman brianteeman - change - 2 Mar 2015
Labels Added: ?
avatar phproberto phproberto - change - 15 Mar 2015
Milestone Added:
avatar phproberto phproberto - change - 15 Mar 2015
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2015-03-15 21:36:22
avatar phproberto phproberto - close - 15 Mar 2015
avatar phproberto phproberto - close - 15 Mar 2015
avatar phproberto
phproberto - comment - 15 Mar 2015

Merged. Thanks!

avatar rvbgnu
rvbgnu - comment - 8 Mar 2017

I know it is bad to comment on an old and closed PR (nice feature, well done guys 👍 but how should I check if this new feature is documented on the JDocs? @phproberto @Sophist-UK
And would it be better to link the issue to the documentation, even only rough? (at least it is started and can be improved by the JDocs Team).

As volunteers, I suppose that no body likes duplicate work and effort, especially, after having read all the comments here and on the linked issue, before creating the Wiki page. A quick search did not find anything.

Add a Comment

Login with GitHub to post a comment