switch theme on every page
This commit is contained in:
@ -7,7 +7,7 @@ plugins {
|
||||
apply plugin: 'io.spring.dependency-management'
|
||||
|
||||
group = 'de.jottyfan'
|
||||
version = '1.3.3'
|
||||
version = '1.3.4'
|
||||
|
||||
description = """timetrack"""
|
||||
|
||||
|
@ -0,0 +1,19 @@
|
||||
package de.jottyfan.timetrack.modules;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
public abstract class CommonController {
|
||||
|
||||
@Value("${server.servlet.context-path}")
|
||||
private String contextPath;
|
||||
|
||||
@ModelAttribute("baseUrl")
|
||||
public String getBaseUrl() {
|
||||
return contextPath;
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class IndexController {
|
||||
public class IndexController extends CommonController {
|
||||
private static final Logger LOGGER = LogManager.getLogger(IndexController.class);
|
||||
|
||||
@Autowired
|
||||
|
@ -6,6 +6,7 @@ import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
|
||||
/**
|
||||
@ -14,7 +15,7 @@ import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class CalendarController {
|
||||
public class CalendarController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private OAuth2Provider provider;
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.db.contact.enums.EnumContacttype;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
|
||||
@ -25,7 +26,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class ContactController {
|
||||
public class ContactController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private OAuth2Provider provider;
|
||||
|
@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
|
||||
@ -24,7 +25,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class DoneController {
|
||||
public class DoneController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private OAuth2Provider provider;
|
||||
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.db.done.tables.records.TJobRecord;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneModel;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
@ -22,7 +23,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class JobController {
|
||||
public class JobController extends CommonController {
|
||||
@Autowired
|
||||
private JobService jobService;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.db.done.tables.records.TModuleRecord;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneModel;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
@ -22,7 +23,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class ModuleController {
|
||||
public class ModuleController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private ModuleService moduleService;
|
||||
|
@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.db.done.tables.records.TProjectRecord;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneController;
|
||||
import de.jottyfan.timetrack.modules.done.DoneModel;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
@ -22,7 +23,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class ProjectController {
|
||||
public class ProjectController extends CommonController {
|
||||
@Autowired
|
||||
private ProjectService projectService;
|
||||
|
||||
|
@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.db.note.enums.EnumCategory;
|
||||
import de.jottyfan.timetrack.db.note.enums.EnumNotetype;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
import de.jottyfan.timetrack.modules.profile.ProfileService;
|
||||
import jakarta.annotation.security.RolesAllowed;
|
||||
|
||||
@ -25,7 +26,7 @@ import jakarta.annotation.security.RolesAllowed;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class NoteController {
|
||||
public class NoteController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private OAuth2Provider provider;
|
||||
|
@ -7,6 +7,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
import de.jottyfan.timetrack.modules.CommonController;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -14,7 +15,7 @@ import de.jottyfan.timetrack.component.OAuth2Provider;
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class ProfileController {
|
||||
public class ProfileController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private OAuth2Provider provider;
|
||||
|
@ -226,13 +226,17 @@ body {
|
||||
|
||||
.version {
|
||||
font-size: small;
|
||||
color: silver;
|
||||
color: black;
|
||||
position: absolute;
|
||||
padding-top: 36px;
|
||||
padding-left: 22px;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
[data-bs-theme="dark"] .version {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.fc-content {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
toggleTheme = function() {
|
||||
toggleTheme = function(urlprefix) {
|
||||
var oldValue = $("html").attr("data-bs-theme");
|
||||
var newValue = oldValue == "dark" ? "light" : "dark";
|
||||
$("html").attr("data-bs-theme", newValue);
|
||||
var url = "profile/" + newValue;
|
||||
var url = urlprefix + "/profile/" + newValue;
|
||||
$.ajax({
|
||||
url: url,
|
||||
dataType: 'json',
|
||||
|
@ -47,7 +47,7 @@
|
||||
<li class="nav-item"><a class="nav-link titlemod"><font layout:fragment="title"></font></a></li>
|
||||
<li layout:fragment="menuitem" style="list-style-type: none"></li>
|
||||
<li layout:fragment="menu" style="list-style-type: none"></li>
|
||||
<li class="nav-item ms-auto"><div id="clock" class="clock" onclick="toggleTheme();resetClock()"></div></li>
|
||||
<li class="nav-item ms-auto"><div id="clock" class="clock" th:attr="onclick=|toggleTheme('${baseUrl}');resetClock()|"></div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user