🎨 更改主题设置代码结构

pull/37/head
ruibaby 2018-10-11 22:11:53 +08:00
parent e5080107ad
commit bc1a0918a8
12 changed files with 91 additions and 116 deletions

View File

@ -91,6 +91,11 @@ public class MvcConfig implements WebMvcConfigurer {
.addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/halo/backup/"); .addResourceLocations("file:///" + System.getProperties().getProperty("user.home") + "/halo/backup/");
} }
/**
*
*
* @param registry registry
*/
@Override @Override
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") registry.addMapping("/**")
@ -100,6 +105,11 @@ public class MvcConfig implements WebMvcConfigurer {
.allowedMethods("*"); .allowedMethods("*");
} }
/**
*
*
* @return LocaleResolver
*/
@Bean @Bean
public LocaleResolver localeResolver() { public LocaleResolver localeResolver() {
SessionLocaleResolver slr = new SessionLocaleResolver(); SessionLocaleResolver slr = new SessionLocaleResolver();
@ -107,6 +117,11 @@ public class MvcConfig implements WebMvcConfigurer {
return slr; return slr;
} }
/**
*
*
* @return LocaleChangeInterceptor
*/
@Bean @Bean
public LocaleChangeInterceptor localeChangeInterceptor() { public LocaleChangeInterceptor localeChangeInterceptor() {
LocaleChangeInterceptor lci = new LocaleChangeInterceptor(); LocaleChangeInterceptor lci = new LocaleChangeInterceptor();

View File

@ -47,7 +47,7 @@
<script src="/static/plugins/jquery/jquery.min.js"></script> <script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script> <script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script> <script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script src="/static/js/login.js"></script> <script src="/static/js/login.js"></script>
</html> </html>
</#compress> </#compress>

View File

@ -53,7 +53,7 @@
<#if options.blog_locale?default('zh_CN')=='zh_CN'> <#if options.blog_locale?default('zh_CN')=='zh_CN'>
<script src="/static/plugins/fileinput/zh.min.js"></script> <script src="/static/plugins/fileinput/zh.min.js"></script>
</#if> </#if>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<@compress single_line=true> <@compress single_line=true>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();

View File

@ -78,7 +78,7 @@
<script src="/static/plugins/clipboard/clipboard.min.js"></script> <script src="/static/plugins/clipboard/clipboard.min.js"></script>
<script src="/static/js/adminlte.min.js"></script> <script src="/static/js/adminlte.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script> <script src="/static/plugins/layer/layer.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();
function btn_delete() { function btn_delete() {

View File

@ -68,7 +68,7 @@
</#if> </#if>
<script src="/static/plugins/clipboard/clipboard.min.js"></script> <script src="/static/plugins/clipboard/clipboard.min.js"></script>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script> <script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();
$('#uploadImg').fileinput({ $('#uploadImg').fileinput({

View File

@ -67,7 +67,7 @@
<script src="/static/plugins/fileinput/zh.min.js"></script> <script src="/static/plugins/fileinput/zh.min.js"></script>
</#if> </#if>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script> <script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();
$('#uploadImg').fileinput({ $('#uploadImg').fileinput({

View File

@ -78,7 +78,7 @@
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script> <script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/js/adminlte.min.js"></script> <script src="/static/js/adminlte.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script> <script src="/static/plugins/layer/layer.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();
function btn_delete() { function btn_delete() {

View File

@ -81,7 +81,7 @@
</#if> </#if>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script> <script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script> <script src="/static/plugins/layer/layer.js"></script>
<script src="/static/js/app.js"></script> <script src="/static/js/halo.js"></script>
<script> <script>
var halo = new $.halo(); var halo = new $.halo();
$(document).ready(function () { $(document).ready(function () {

View File

@ -0,0 +1,62 @@
<#macro head>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/plugins/toast/css/jquery.toast.min.css">
<link rel="stylesheet" href="/static/css/AdminLTE.min.css">
<style>
.themeSetting, .themeImg {
padding-top: 15px;
padding-bottom: 15px;
}
.form-horizontal .control-label {
text-align: left;
}
</style>
</head>
<body>
</#macro>
<#macro import_js>
</body>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script>
<script src="/static/js/halo.js"></script>
<#nested />
<script>
function saveThemeOptions(option) {
var param = $('#'+option).serialize();
$.ajax({
type: 'post',
url: '/admin/option/save',
data: param,
success: function (data) {
if(data.code==1){
showMsg(data.msg,"success",1000);
}else{
showMsg(data.msg,"error",1000);
}
}
});
}
function openAttach(id) {
layer.open({
type: 2,
title: '所有附件',
shadeClose: true,
shade: 0.5,
area: ['90%', '90%'],
content: '/admin/attachments/select?id='+id,
scrollbar: false
});
}
</script>
</html>
</#macro>

View File

@ -1,23 +1,5 @@
<!DOCTYPE html> <#import "/common/macro/theme_option_marco.ftl" as option>
<html> <@option.head />
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/plugins/toast/css/jquery.toast.min.css">
<link rel="stylesheet" href="/static/css/AdminLTE.min.css">
<style>
.themeSetting,.themeImg{
padding-top: 15px;
padding-bottom: 15px;
}
.form-horizontal .control-label{
text-align: left;
}
</style>
</head>
<body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-lg-6 themeImg"> <div class="col-lg-6 themeImg">
@ -218,38 +200,4 @@
</div> </div>
</div> </div>
</div> </div>
</body> <@option.import_js />
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script>
<script src="/static/js/app.js"></script>
<script>
function saveThemeOptions(option) {
var param = $('#'+option).serialize();
$.ajax({
type: 'post',
url: '/admin/option/save',
data: param,
success: function (data) {
if(data.code==1){
showMsg(data.msg,"success",1000);
}else{
showMsg(data.msg,"error",1000);
}
}
});
}
function openAttach(id) {
layer.open({
type: 2,
title: '所有附件',
shadeClose: true,
shade: 0.5,
area: ['90%', '90%'],
content: '/admin/attachments/select?id='+id,
scrollbar: false
});
}
</script>
</html>

View File

@ -1,24 +1,5 @@
<!DOCTYPE html> <#import "/common/macro/theme_option_marco.ftl" as option>
<html> <@option.head />
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="/static/plugins/toast/css/jquery.toast.min.css">
<link rel="stylesheet" href="/static/plugins/colorpicker/css/bootstrap-colorpicker.min.css">
<link rel="stylesheet" href="/static/css/AdminLTE.min.css">
<style>
.themeSetting,.themeImg{
padding-top: 15px;
padding-bottom: 15px;
}
.form-horizontal .control-label{
text-align: left;
}
</style>
</head>
<body>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-lg-6 themeImg"> <div class="col-lg-6 themeImg">
@ -507,13 +488,8 @@
</div> </div>
</div> </div>
</div> </div>
</body> <@option.import_js>
<script src="/static/plugins/jquery/jquery.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="/static/plugins/toast/js/jquery.toast.min.js"></script>
<script src="/static/plugins/layer/layer.js"></script>
<script src="/static/plugins/colorpicker/js/bootstrap-colorpicker.min.js"></script> <script src="/static/plugins/colorpicker/js/bootstrap-colorpicker.min.js"></script>
<script src="/static/js/app.js"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#materialUiuxThemeColor').colorpicker(); $('#materialUiuxThemeColor').colorpicker();
@ -524,31 +500,5 @@
$('#materialNprogressColor').colorpicker(); $('#materialNprogressColor').colorpicker();
$('#materialBackgroundColor').colorpicker(); $('#materialBackgroundColor').colorpicker();
}); });
function saveThemeOptions(option) {
var param = $('#'+option).serialize();
$.ajax({
type: 'post',
url: '/admin/option/save',
data: param,
success: function (data) {
if(data.code==1){
showMsg(data.msg,"success",1000);
}else{
showMsg(data.msg,"error",1000);
}
}
});
}
function openAttach(id) {
layer.open({
type: 2,
title: '所有附件',
shadeClose: true,
shade: 0.5,
area: ['90%', '90%'],
content: '/admin/attachments/select?id='+id,
scrollbar: false
});
}
</script> </script>
</html> </@option.import_js>