mirror of https://github.com/halo-dev/halo
⏪ 去除主题预览功能
parent
590a0ffa6c
commit
12a6b548a4
|
@ -33,21 +33,6 @@ public abstract class BaseController {
|
||||||
return themeStr.toString();
|
return themeStr.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据主题以及模板名渲染页面
|
|
||||||
*
|
|
||||||
* @param theme 主题
|
|
||||||
* @param pageName 模板名
|
|
||||||
* @return String
|
|
||||||
*/
|
|
||||||
public String render(String theme, String pageName) {
|
|
||||||
final StrBuilder themeStr = new StrBuilder("themes/");
|
|
||||||
themeStr.append(theme);
|
|
||||||
themeStr.append("/");
|
|
||||||
themeStr.append(pageName);
|
|
||||||
return themeStr.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 渲染404页面
|
* 渲染404页面
|
||||||
*
|
*
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import static cc.ryanc.halo.model.support.HaloConst.OPTIONS;
|
import static cc.ryanc.halo.model.support.HaloConst.OPTIONS;
|
||||||
import static org.springframework.data.domain.Sort.Direction.DESC;
|
import static org.springframework.data.domain.Sort.Direction.DESC;
|
||||||
|
@ -45,9 +44,8 @@ public class FrontIndexController extends BaseController {
|
||||||
* @return 模板路径
|
* @return 模板路径
|
||||||
*/
|
*/
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public String index(@RequestParam(value = "theme", defaultValue = "") String theme,
|
public String index(Model model) {
|
||||||
Model model) {
|
return this.index(model, 1, Sort.by(DESC, "postPriority").and(Sort.by(DESC, "postDate")));
|
||||||
return this.index(model, theme, 1, Sort.by(DESC, "postPriority").and(Sort.by(DESC, "postDate")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +57,6 @@ public class FrontIndexController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "page/{page}")
|
@GetMapping(value = "page/{page}")
|
||||||
public String index(Model model,
|
public String index(Model model,
|
||||||
@RequestParam(value = "theme", defaultValue = "") String theme,
|
|
||||||
@PathVariable(value = "page") Integer page,
|
@PathVariable(value = "page") Integer page,
|
||||||
@SortDefault.SortDefaults({
|
@SortDefault.SortDefaults({
|
||||||
@SortDefault(sort = "postPriority", direction = DESC),
|
@SortDefault(sort = "postPriority", direction = DESC),
|
||||||
|
@ -82,9 +79,6 @@ public class FrontIndexController extends BaseController {
|
||||||
model.addAttribute("is_index", true);
|
model.addAttribute("is_index", true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
model.addAttribute("rainbow", rainbow);
|
model.addAttribute("rainbow", rainbow);
|
||||||
if (StrUtil.isNotEmpty(theme)) {
|
|
||||||
return this.render(theme, "index");
|
|
||||||
}
|
|
||||||
return this.render("index");
|
return this.render("index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,9 +27,6 @@
|
||||||
font-size: 18px;
|
font-size: 18px;
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
.theme-title a{
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
.btn-delete:hover{
|
.btn-delete:hover{
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +53,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="box-footer">
|
<div class="box-footer">
|
||||||
<span class="theme-title">
|
<span class="theme-title">
|
||||||
<a href="${options.blog_url!}?theme=${theme.themeName!}" target="_blank" title="点击预览该主题">${theme.themeName!?cap_first}</a>
|
${theme.themeName!?cap_first}
|
||||||
</span>
|
</span>
|
||||||
<#if theme.hasOptions>
|
<#if theme.hasOptions>
|
||||||
<button class="btn btn-primary btn-sm pull-right btn-theme-setting" onclick="halo.layerModal('/admin/themes/options?theme=${theme.themeName!}&hasUpdate=<#if theme.hasUpdate>true<#else>false</#if>','${theme.themeName!} <@spring.message code="admin.themes.js.theme-setting" />')" style="display: none"><@spring.message code='admin.themes.btn.setting' /></button>
|
<button class="btn btn-primary btn-sm pull-right btn-theme-setting" onclick="halo.layerModal('/admin/themes/options?theme=${theme.themeName!}&hasUpdate=<#if theme.hasUpdate>true<#else>false</#if>','${theme.themeName!} <@spring.message code="admin.themes.js.theme-setting" />')" style="display: none"><@spring.message code='admin.themes.btn.setting' /></button>
|
||||||
|
|
Loading…
Reference in New Issue