Skip to content

Commit

Permalink
global support for ignoring bootstrap css theme link when no_main-theme
Browse files Browse the repository at this point in the history
  • Loading branch information
bradymiller committed Dec 20, 2019
1 parent efc973e commit 9e40a85
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
1 change: 0 additions & 1 deletion Documentation/help_files/openemr_installation_help.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<html>
<head>
<link rel=stylesheet href="../../public/themes/style_light.css">
<link rel="stylesheet" href="../../public/assets/bootstrap/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../../public/assets/jquery-ui/jquery-ui.css" type="text/css">
<script type="text/javascript" src="../../public/assets/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../../public/assets/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
Expand Down
1 change: 0 additions & 1 deletion Documentation/help_files/openemr_multisite_admin_help.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<html>
<head>
<link rel=stylesheet href="../../public/themes/style_light.css">
<link rel="stylesheet" href="../../public/assets/bootstrap/dist/css/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="../../public/assets/jquery-ui/jquery-ui.css" type="text/css">
<script type="text/javascript" src="../../public/assets/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="../../public/assets/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
Expand Down
8 changes: 5 additions & 3 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ assets:
bootstrap:
basePath: %assets_static_relative%/bootstrap/dist/
script: js/bootstrap.bundle.min.js
# Moving into SASS
# link: css/bootstrap.min.css
# Bootstrap is included in main themes via SASS
# So will only use below css link if no_main-theme token is provided.
# TODO - incorporate this mechanism for rtl when rtl bootrap SASS mechanism is up and running
link: css/bootstrap.min.css
autoload: true
allowNoLoad: true # could also just edit Header.php to remove this check (unnecessary?)
allowNoLoad: true
rtl:
basePath: %assets_static_relative%/bootstrap-v4-rtl/dist/
link: css/bootstrap-rtl.min.css
Expand Down
10 changes: 2 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,8 @@ function install(done) {
.pipe(gulp.dest(config.dist.assets + key + '/decoders'));
gulp.src('node_modules/' + key + '/locales/**/*')
.pipe(gulp.dest(config.dist.assets + key + '/locales'));
} else if (key == 'bootstrap') {
// bootstrap is special and need to copy dist and scss
gulp.src('node_modules/' + key + '/dist/**/*')
.pipe(gulp.dest(config.dist.assets + key + '/dist'));
gulp.src('node_modules/' + key + '/scss/**/*')
.pipe(gulp.dest(config.dist.assets + key + '/scss'));
} else if (key == 'bootstrap-v4-rtl') {
// bootstrap-v4-rtl is special and need to copy dist and scss
} else if (key == 'bootstrap' || key == 'bootstrap-v4-rtl') {
// bootstrap and bootstrap-v4-rtl are special and need to copy dist and scss
gulp.src('node_modules/' + key + '/dist/**/*')
.pipe(gulp.dest(config.dist.assets + key + '/dist'));
gulp.src('node_modules/' + key + '/scss/**/*')
Expand Down
9 changes: 7 additions & 2 deletions src/Core/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,13 @@ private static function parseConfigFile($map, $selectedAssets = array())
self::$scripts[] = $s;
}

foreach ($tmp['links'] as $l) {
self::$links[] = $l;
if (($k == "bootstrap") && (!in_array("no_main-theme", $selectedAssets))) {
// Above comparison is to skip bootstrap theme loading when using a main theme
// since bootstrap theme is already including in main themes via SASS.
} else {
foreach ($tmp['links'] as $l) {
self::$links[] = $l;
}
}

if ($rtl && $_SESSION['language_direction'] == 'rtl') {
Expand Down

0 comments on commit 9e40a85

Please sign in to comment.