mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
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:
@@ -231,19 +231,25 @@ function insertTimezones(target) {
|
||||
}
|
||||
|
||||
$(() => {
|
||||
CodeMirror.fromTextArea(document.getElementById("theme-header"), {
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
mode: "htmlmixed",
|
||||
htmlMode: true
|
||||
});
|
||||
const theme_header_editor = CodeMirror.fromTextArea(
|
||||
document.getElementById("theme-header"),
|
||||
{
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
mode: "htmlmixed",
|
||||
htmlMode: true
|
||||
}
|
||||
);
|
||||
|
||||
CodeMirror.fromTextArea(document.getElementById("theme-footer"), {
|
||||
lineNumbers: true,
|
||||
lineWrapping: true,
|
||||
mode: "htmlmixed",
|
||||
htmlMode: true
|
||||
});
|
||||
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
Reference in New Issue
Block a user