From 805906959653bc76424cc6c17532a695d50a8b0e Mon Sep 17 00:00:00 2001 From: Yannick Gaultier Date: Tue, 18 Sep 2012 12:50:45 +0200 Subject: [PATCH 1/2] Rebased on clean master, updated all templates to use new loadCss() method --- administrator/templates/hathor/index.php | 6 ++---- administrator/templates/isis/index.php | 7 ++----- libraries/cms/html/bootstrap.php | 26 ++++++++++++++++++++++++ templates/beez3/index.php | 10 ++------- templates/protostar/index.php | 7 ++----- 5 files changed, 34 insertions(+), 22 deletions(-) diff --git a/administrator/templates/hathor/index.php b/administrator/templates/hathor/index.php index d26664356e5d3..a78af705ff536 100644 --- a/administrator/templates/hathor/index.php +++ b/administrator/templates/hathor/index.php @@ -15,10 +15,8 @@ $input = $app->input; $user = JFactory::getUser(); -// If Right-to-Left -if ($this->direction == 'rtl') : - $doc->addStyleSheet('../media/jui/css/bootstrap-rtl.css'); -endif; +// load optional rtl bootstrap css and bootstrap bugfixes +JHtmlBootstrap::loadCss( $includeMaincss = false, $this->direction); // Load specific language related CSS $file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css'; diff --git a/administrator/templates/isis/index.php b/administrator/templates/isis/index.php index c32fc56a3454b..46620ba8870f1 100644 --- a/administrator/templates/isis/index.php +++ b/administrator/templates/isis/index.php @@ -23,11 +23,8 @@ // Add Stylesheets $doc->addStyleSheet('templates/' . $this->template . '/css/template.css'); -// If Right-to-Left -if ($this->direction === 'rtl') -{ - $doc->addStyleSheet('../media/jui/css/bootstrap-rtl.css'); -} + // load optional rtl bootstrap css and bootstrap bugfixes +JHtmlBootstrap::loadCss( $includeMaincss = false, $this->direction); // Load specific language related CSS $file = 'language/' . $lang->getTag() . '/' . $lang->getTag() . '.css'; diff --git a/libraries/cms/html/bootstrap.php b/libraries/cms/html/bootstrap.php index d55ea29a8b82c..c9d11008128c9 100644 --- a/libraries/cms/html/bootstrap.php +++ b/libraries/cms/html/bootstrap.php @@ -575,4 +575,30 @@ public static function endPanel() { return ''; } + + /** + * Loads css files needed by bootstrap, including a secondary file that may contains boostrap css bug fixes + * + * @param boolean if true, main bootstrap.css file is loaded, if false, only optional rtl and bug fixes file + * @param string rtl or ltr direction. If empty, ltr is assumed + * @param array optional array of attributes to be passed to JHtml::_('stylesheet') + */ + public static function loadCss( $includeMaincss = true, $direction = 'ltr', $attribs = array()) + { + + if($includeMaincss) + { + // load bootstrap main css + JHtml::_('stylesheet', 'media/jui/css/bootstrap.css', array(), false); + } + + if ($direction === 'rtl') + { + JHtml::_('stylesheet', 'media/jui/css/bootstrap-rtl.css', array(), false); + } + + // load bootstrap css fixes + JHtml::_('stylesheet', 'media/cms/css/bootstrap.css', array(), false); + + } } diff --git a/templates/beez3/index.php b/templates/beez3/index.php index 058e393153e07..423f33bb0c577 100644 --- a/templates/beez3/index.php +++ b/templates/beez3/index.php @@ -36,14 +36,8 @@ if ($templateparams->get('bootstrap') == 1) { - // Pull in the Bootstrap styles from jui - $doc->addStyleSheet('media/jui/css/bootstrap.css'); - - // If Right-to-Left - if ($this->direction == 'rtl') - { - $doc->addStyleSheet('media/jui/css/bootstrap-rtl.css'); - } + // load optional rtl bootstrap css and bootstrap bugfixes + JHtmlBootstrap::loadCss( $includeMaincss = true, $this->direction); } $doc->addStyleSheet(JURI::base() . '/templates/system/css/system.css'); diff --git a/templates/protostar/index.php b/templates/protostar/index.php index 28fc42313e616..5148c663ea291 100644 --- a/templates/protostar/index.php +++ b/templates/protostar/index.php @@ -37,11 +37,8 @@ // Add Stylesheets $doc->addStyleSheet('templates/'.$this->template.'/css/template.css'); -// If Right-to-Left -if ($this->direction == 'rtl') -{ - $doc->addStyleSheet('media/jui/css/bootstrap-rtl.css'); -} +// load optional rtl bootstrap css and bootstrap bugfixes +JHtmlBootstrap::loadCss( $includeMaincss = false, $this->direction); // Add current user information $user = JFactory::getUser(); From fc2c76dbdb7a2c61d7c82d660ba0e77a2ced4a58 Mon Sep 17 00:00:00 2001 From: Yannick Gaultier Date: Tue, 18 Sep 2012 13:00:44 +0200 Subject: [PATCH 2/2] bootstrap.css bug fixes file was missing from commit --- media/cms/css/bootstrap.css | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 media/cms/css/bootstrap.css diff --git a/media/cms/css/bootstrap.css b/media/cms/css/bootstrap.css new file mode 100644 index 0000000000000..5dca513a37705 --- /dev/null +++ b/media/cms/css/bootstrap.css @@ -0,0 +1,7 @@ +/** + * @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved. + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +/* Fix for #29223: ref: http://stackoverflow.com/questions/10959068/twitter-bootstrap-accordion-and-button-dropdown-overflow-issue */ +.accordion-body.in:hover { overflow:visible; }