Fix setting the CTFd theme color (#1482)

* Fix setting the CTFd theme color in the Admin Panel by properly getting the current theme header value
This commit is contained in:
Kevin Chung
2020-06-08 13:55:51 -04:00
committed by GitHub
parent 8b6e91f76c
commit aad3d21568
3 changed files with 22 additions and 16 deletions

View File

@@ -231,19 +231,25 @@ function insertTimezones(target) {
}
$(() => {
CodeMirror.fromTextArea(document.getElementById("theme-header"), {
const theme_header_editor = CodeMirror.fromTextArea(
document.getElementById("theme-header"),
{
lineNumbers: true,
lineWrapping: true,
mode: "htmlmixed",
htmlMode: true
});
}
);
CodeMirror.fromTextArea(document.getElementById("theme-footer"), {
const theme_footer_editor = CodeMirror.fromTextArea(
document.getElementById("theme-footer"),
{
lineNumbers: true,
lineWrapping: true,
mode: "htmlmixed",
htmlMode: true
});
}
);
insertTimezones($("#start-timezone"));
insertTimezones($("#end-timezone"));
@@ -256,7 +262,7 @@ $(() => {
$("#import-button").click(importConfig);
$("#config-color-update").click(function() {
const hex_code = $("#config-color-picker").val();
const user_css = $("#theme-header").val();
const user_css = theme_header_editor.getValue();
let new_css;
if (user_css.length) {
let css_vars = `theme-color: ${hex_code};`;
@@ -269,7 +275,7 @@ $(() => {
`.jumbotron{background-color: var(--theme-color) !important;}\n` +
`</style>\n`;
}
$("#theme-header").val(new_css);
theme_header_editor.getDoc().setValue(new_css);
});
$(".start-date").change(function() {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long