View Issue Details

IDProjectCategoryView StatusLast Update
0012352mantisbthtmlpublic2019-12-23 15:15
Reporterrakekniven Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status acknowledgedResolutionopen 
Summary0012352: Add my own css code without modifying default.css
Description

There is css/default.css which is delivered with Mantis.
In config file I found variable "$g_css_include_file" to use other css file.

First thought was "Cool, I can use default.css and use $g_css_include_file to append my css code from separate file".

But behaviour is different because when I use $g_css_include_file then only this file is used and default.css is ignored.
I verified this statement by checking html header.

So please add the posibility to add own css code without touching default.css.

Every time I update Mantis I have to diff old and new default.css to merge my changes into new default.css.
So I am looking for an easier way.

Additional Information

This issue results from a post to forum:
http://www.mantisbt.org/forums/viewtopic.php?f=3&t=11938&start=0

Tagsredesign
Attached Files
issue12352.patch (2,365 bytes)   
From ad178b396d577a489ebe80aa496b96c2155336ec Mon Sep 17 00:00:00 2001
From: Kirill Krasnov <krasnovforum@gmail.com>
Date: Mon, 20 Sep 2010 16:35:56 +0300
Subject: [PATCH] Fix 12352: change config-value css_include_file for user define file
 which can overwrite values from default file  default.css

---
 config_defaults_inc.php                     |    4 ++--
 core/html_api.php                           |    3 ++-
 docbook/Admin_Guide/en-US/Configuration.xml |    3 ++-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index ca109c3..395d219 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -3101,10 +3101,10 @@ $g_bottom_include_page = '%absolute_path%';
 $g_top_include_page = '%absolute_path%';
 
 /**
- * CSS file
+ * CSS file for user overwrite
  * @global string $g_css_include_file
  */
-$g_css_include_file = 'default.css';
+$g_css_include_file = '';
 
 /**
  * RTL CSS file
diff --git a/core/html_api.php b/core/html_api.php
index 7784df0..6e6c7e8 100644
--- a/core/html_api.php
+++ b/core/html_api.php
@@ -353,7 +353,7 @@ function require_css( $p_stylesheet_path ) {
  */
 function html_css() {
 	global $g_stylesheets_included;
-	html_css_link( config_get( 'css_include_file' ) );
+	html_css_link('default.css');
 	html_css_link( 'jquery-ui.css' );
 	# Add right-to-left css if needed
 	if ( lang_get( 'directionality' ) == 'rtl' ) {
@@ -362,6 +362,7 @@ function html_css() {
 	foreach ( $g_stylesheets_included as $t_stylesheet_path ) {
 		html_css_link ( $t_stylesheet_path );
 	}
+	html_css_link( config_get( 'css_include_file' ) );
 }
 
 /**
diff --git a/docbook/Admin_Guide/en-US/Configuration.xml b/docbook/Admin_Guide/en-US/Configuration.xml
index 84d2eec..900f1d5 100644
--- a/docbook/Admin_Guide/en-US/Configuration.xml
+++ b/docbook/Admin_Guide/en-US/Configuration.xml
@@ -1628,7 +1628,8 @@
             <varlistentry>
                 <term>$g_css_include_file</term>
                 <listitem>
-                    <para>Set this to point to the CSS file of your choice.</para>
+                    <para>Set this to point to the user CSS file of your choice which
+                        can overwrite default values in default.css.</para>
                 </listitem>
             </varlistentry>
             <varlistentry>
-- 
1.7.2.3.msysgit.0

issue12352.patch (2,365 bytes)   

Activities

dhx

dhx

2010-09-15 08:22

reporter   ~0026720

As a temporary workaround you can just place @import url('default.css') to the top of your custom CSS file.

rakekniven

rakekniven

2010-09-15 08:54

reporter   ~0026721

Thanx dhx for this valuable hint.

Now I can use default.css AND my custom css.

You can close this issue if you want.

dhx

dhx

2010-09-17 22:59

reporter   ~0026759

Thanks for the feedback.

I'll probably leave this issue open as there is a valid feature request here for a configuration option that is essentially an array of additional CSS files to include.

Using @import is usually frowned upon due to performance reasons (browsers have to wait for custom.css to load before it can start loading default.css - ideally both files should be downloaded in parallel by the browser).

rakekniven

rakekniven

2010-09-20 08:04

reporter   ~0026803

Hello dhx,

your arguments sounds very comprehensible.

It would be a much better solution to have configuration options for that.

Personally I can live with @import in our intranet. No performance problems ;-)

Kirill

Kirill

2010-09-20 09:39

reporter   ~0026804

@rakekniven, please try test issue12352.patch attached to this issue and write result in comments.

rakekniven

rakekniven

2010-09-20 10:36

reporter   ~0026806

Hello Kirill,

we run stable 1.2.3 here.
I cannot apply your patch against this version.
There is no function require_css in html_api.php here.

Could you provide a patch against 1.2.3?

Thanx

rakekniven

rakekniven

2014-02-10 04:22

reporter   ~0039359

You can close issue.

dregad

dregad

2014-02-10 05:10

developer   ~0039364

The provided patch is actually against master branch (1.3.x)

grangeway

grangeway

2014-06-01 15:10

reporter   ~0040691

Dropping target version - reporter states we can close issue - i'm inclined to leave it open for now (sorry rake for any email notifications on this) just so we can implement something when dealing with theming/redesign. It's already got the redesign tag so we should pick it up then.

cproensa

cproensa

2016-06-11 13:38

developer   ~0053317

Currently, any custom CSS or JS file can be included with a plugin that uses the EVENT_LAYOUT_RESOURCES.