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

View File

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

View File

@ -171,6 +171,12 @@
</label> </label>
</div> </div>
</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>
<div class="box-footer"> <div class="box-footer">
<button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button> <button type="button" class="btn btn-primary btn-sm pull-right" onclick="saveThemeOptions('anatoleStyleOptions')">保存设置</button>