👽 Anatole主题优化

pull/18/head
ruibaby 2018-06-05 18:04:44 +08:00
parent 249a78d6d8
commit 3237c5a301
3 changed files with 23 additions and 32 deletions

View File

@ -48,16 +48,12 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
*
*/
private void loadActiveTheme(){
try {
String themeValue = optionsService.findOneOption("theme");
if(StringUtils.isNotEmpty("themeValue") && !StringUtils.equals(themeValue,null)){
BaseController.THEME = themeValue;
}else{
//以防万一
BaseController.THEME = "anatole";
}
}catch (Exception e){
log.error("加载主题设置失败:{0}",e.getMessage());
String themeValue = optionsService.findOneOption("theme");
if(StringUtils.isNotEmpty("themeValue") && !StringUtils.equals(themeValue,null)){
BaseController.THEME = themeValue;
}else{
//以防万一
BaseController.THEME = "anatole";
}
}
@ -65,13 +61,9 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
*
*/
private void loadOptions(){
try{
Map<String,String> options = optionsService.findAllOptions();
if(options!=null&&!options.isEmpty()){
HaloConst.OPTIONS = options;
}
}catch (Exception e){
log.error("加载设置选项失败:{0}",e.getMessage());
Map<String,String> options = optionsService.findAllOptions();
if(options!=null&&!options.isEmpty()){
HaloConst.OPTIONS = options;
}
}
@ -79,13 +71,9 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
*
*/
private void loadFiles(){
try {
List<Attachment> attachments = attachmentService.findAllAttachments();
if(null!=attachments){
HaloConst.ATTACHMENTS = attachments;
}
}catch (Exception e){
log.error("加载所有文件失败:{0}",e.getMessage());
List<Attachment> attachments = attachmentService.findAllAttachments();
if(null!=attachments){
HaloConst.ATTACHMENTS = attachments;
}
}
@ -93,14 +81,10 @@ public class StartupConfig implements ApplicationListener<ContextRefreshedEvent>
*
*/
private void loadThemes(){
try{
HaloConst.THEMES.clear();
List<Theme> themes = HaloUtils.getThemes();
if(null!=themes){
HaloConst.THEMES = themes;
}
}catch (Exception e){
log.error("加载主题失败:{0}",e.getMessage());
HaloConst.THEMES.clear();
List<Theme> themes = HaloUtils.getThemes();
if(null!=themes){
HaloConst.THEMES = themes;
}
}
}

View File

@ -9,6 +9,7 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="format-detection" content="telephone=no" />
<meta name="renderer" content="webkit">
<meta name="theme-color" content="${options.anatole_style_google_color?default('#fff')}">
<meta name="author" content="${user.userDisplayName?if_exists}" />
<meta name="keywords" content="${keywords?default("Anatole")}"/>
<meta name="description" content="${description?default("Anatole")}" />

View File

@ -171,6 +171,12 @@
</label>
</div>
</div>
<div class="form-group">
<label for="anatoleStyleGoogleColor" class="col-sm-4 control-label">浏览器沉浸颜色:</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="anatoleStyleGoogleColor" name="anatole_style_google_color" value="${options.anatole_style_google_color?default("#fff")}" >
</div>
</div>
</div>
<div class="box-footer">
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button>