Skip to content

Commit

Permalink
Merge branch 'MDL-69117-master-2' of git://github.com/bmbrands/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Sep 3, 2020
2 parents e02e90f + a158714 commit 695a7f2
Show file tree
Hide file tree
Showing 8 changed files with 220 additions and 4 deletions.
35 changes: 32 additions & 3 deletions lib/outputlib.php
Expand Up @@ -1440,17 +1440,33 @@ protected function get_css_content_from_scss($themedesigner) {

// TODO: MDL-62757 When changing anything in this method please do not forget to check
// if the validate() method in class admin_setting_configthemepreset needs updating too.
$cacheoptions = '';

$cachedir = make_localcache_directory('scsscache-' . $this->name, false);
$cacheoptions = [];
if ($themedesigner) {
$scsscachedir = $CFG->localcachedir . '/scsscache/';
$cacheoptions = array(
'cacheDir' => $scsscachedir,
'cacheDir' => $cachedir,
'prefix' => 'scssphp_',
'forceRefresh' => false,
);
} else {
if (file_exists($cachedir)) {
remove_directory($cachedir);
}
}

// Set-up the compiler.
$compiler = new core_scss($cacheoptions);

if ($this->supports_source_maps($themedesigner)) {
// Enable source maps.
$compiler->setSourceMapOptions([
'sourceMapBasepath' => str_replace('\\', '/', $CFG->dirroot),
'sourceMapRootpath' => $CFG->wwwroot . '/'
]);
$compiler->setSourceMap($compiler::SOURCE_MAP_INLINE);
}

$compiler->prepend_raw_scss($this->get_pre_scss_code());
if (is_string($scss)) {
$compiler->set_file($scss);
Expand Down Expand Up @@ -2192,6 +2208,19 @@ public function set_rtl_mode($inrtl = true) {
$this->rtlmode = $inrtl;
}

/**
* Checks if source maps are supported
*
* @param bool $themedesigner True if theme designer is enabled.
* @return boolean True if source maps are supported.
*/
public function supports_source_maps($themedesigner): bool {
if (empty($this->rtlmode) && $themedesigner) {
return true;
}
return false;
}

/**
* Whether the theme is being served in RTL mode.
*
Expand Down
2 changes: 2 additions & 0 deletions theme/boost/classes/autoprefixer.php
Expand Up @@ -104,6 +104,8 @@ class autoprefixer {
* @param Document $tree The CSS tree.
*/
public function __construct(Document $tree) {
debugging('theme_boost\autoprefixer() is deprecated. Required prefixes for Bootstrap ' .
'are now in theme/boost/scss/moodle/prefixes.scss', DEBUG_DEVELOPER);
$this->tree = $tree;

$pseudos = array_map(function($pseudo) {
Expand Down
1 change: 0 additions & 1 deletion theme/boost/config.php
Expand Up @@ -148,7 +148,6 @@

$THEME->parents = [];
$THEME->enable_dock = false;
$THEME->csstreepostprocessor = 'theme_boost_css_tree_post_processor';
$THEME->extrascsscallback = 'theme_boost_get_extra_scss';
$THEME->prescsscallback = 'theme_boost_get_pre_scss';
$THEME->precompiledcsscallback = 'theme_boost_get_precompiled_css';
Expand Down
2 changes: 2 additions & 0 deletions theme/boost/lib.php
Expand Up @@ -31,6 +31,8 @@
* @param theme_config $theme The theme config object.
*/
function theme_boost_css_tree_post_processor($tree, $theme) {
error_log('theme_boost_css_tree_post_processor() is deprecated. Required' .
'prefixes for Bootstrap are now in theme/boost/scss/moodle/prefixes.scss');
$prefixer = new theme_boost\autoprefixer($tree);
$prefixer->prefix();
}
Expand Down
1 change: 1 addition & 0 deletions theme/boost/scss/moodle.scss
Expand Up @@ -40,3 +40,4 @@ $breadcrumb-divider-rtl: "◀" !default;
@import "moodle/print";
@import "moodle/modal";
@import "moodle/layout";
@import "moodle/prefixes";
65 changes: 65 additions & 0 deletions theme/boost/scss/moodle/prefixes.scss
@@ -0,0 +1,65 @@
.form-control:-ms-input-placeholder {
color: $input-placeholder-color;
}

.custom-select {
-webkit-appearance: none;
-moz-appearance: none;
}

.custom-range {
-webkit-appearance: none;
-moz-appearance: none;
&::-webkit-slider-thumb,
&::-moz-range-thumb,
&::-ms-thumb {
-webkit-appearance: none;
-moz-appearance: none;
}
}

input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="month"] {
&.form-control {
-webkit-appearance: none;
-moz-appearance: none;
}
}

.card-columns {
@include media-breakpoint-up(sm) {
-webkit-column-gap: $card-columns-gap;
-moz-column-gap: $card-columns-gap;
}
}

.carousel-item {
-webkit-backface-visibility: hidden;
}

.card {
-webkit-background-clip: border-box;
}

.carousel-indicators li,
.dropdown-menu,
.form-control,
.modal-content,
.popover,
.toast {
-webkit-background-clip: padding-box;
}

.btn {
-webkit-user-select: none;
-ms-user-select: none;
}

@each $value in $user-selects {
.user-select-#{$value} {
-webkit-user-select: $value !important; /* stylelint-disable-line declaration-no-important */
-ms-user-select: none;
}
}
59 changes: 59 additions & 0 deletions theme/boost/style/moodle.css
Expand Up @@ -19101,6 +19101,65 @@ span[data-flexitour="container"][x-placement="right"], span[data-flexitour="cont
height: 1em;
font-size: 4em; }

.form-control:-ms-input-placeholder {
color: #6c757d; }

.custom-select {
-webkit-appearance: none;
-moz-appearance: none; }

.custom-range {
-webkit-appearance: none;
-moz-appearance: none; }
.custom-range::-webkit-slider-thumb, .custom-range::-moz-range-thumb, .custom-range::-ms-thumb {
-webkit-appearance: none;
-moz-appearance: none; }

input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control {
-webkit-appearance: none;
-moz-appearance: none; }

@media (min-width: 576px) {
.card-columns {
-webkit-column-gap: 1.25rem;
-moz-column-gap: 1.25rem; } }

.carousel-item {
-webkit-backface-visibility: hidden; }

.card {
-webkit-background-clip: border-box; }

.carousel-indicators li,
.dropdown-menu,
.form-control,
.modal-content,
.popover,
.toast {
-webkit-background-clip: padding-box; }

.btn {
-webkit-user-select: none;
-ms-user-select: none; }

.user-select-all {
-webkit-user-select: all !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

.user-select-auto {
-webkit-user-select: auto !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

.user-select-none {
-webkit-user-select: none !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; }
Expand Down
59 changes: 59 additions & 0 deletions theme/classic/style/moodle.css
Expand Up @@ -19284,6 +19284,65 @@ span[data-flexitour="container"][x-placement="right"], span[data-flexitour="cont
height: 1em;
font-size: 4em; }

.form-control:-ms-input-placeholder {
color: #6c757d; }

.custom-select {
-webkit-appearance: none;
-moz-appearance: none; }

.custom-range {
-webkit-appearance: none;
-moz-appearance: none; }
.custom-range::-webkit-slider-thumb, .custom-range::-moz-range-thumb, .custom-range::-ms-thumb {
-webkit-appearance: none;
-moz-appearance: none; }

input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control {
-webkit-appearance: none;
-moz-appearance: none; }

@media (min-width: 576px) {
.card-columns {
-webkit-column-gap: 1.25rem;
-moz-column-gap: 1.25rem; } }

.carousel-item {
-webkit-backface-visibility: hidden; }

.card {
-webkit-background-clip: border-box; }

.carousel-indicators li,
.dropdown-menu,
.form-control,
.modal-content,
.popover,
.toast {
-webkit-background-clip: padding-box; }

.btn {
-webkit-user-select: none;
-ms-user-select: none; }

.user-select-all {
-webkit-user-select: all !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

.user-select-auto {
-webkit-user-select: auto !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

.user-select-none {
-webkit-user-select: none !important;
/* stylelint-disable-line declaration-no-important */
-ms-user-select: none; }

body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale; }
Expand Down

0 comments on commit 695a7f2

Please sign in to comment.