mirror of https://github.com/halo-dev/halo
Merge remote-tracking branch 'origin/v1' into v1
commit
bd7d627d76
|
@ -49,10 +49,15 @@ public class ThemeProperty {
|
|||
private Author author;
|
||||
|
||||
/**
|
||||
* Folder name.
|
||||
* Theme path.
|
||||
*/
|
||||
private String themePath;
|
||||
|
||||
/**
|
||||
* Theme folder name.
|
||||
*/
|
||||
private String folderName;
|
||||
|
||||
/**
|
||||
* Has options.
|
||||
*/
|
||||
|
|
|
@ -97,7 +97,7 @@ public class StartedListener implements ApplicationListener<ApplicationStartedEv
|
|||
*/
|
||||
private void cacheActiveTheme() {
|
||||
try {
|
||||
configuration.setSharedVariable("themeName", themeService.getActivatedThemeId());
|
||||
configuration.setSharedVariable("themeId", themeService.getActivatedThemeId());
|
||||
} catch (TemplateModelException e) {
|
||||
log.error("", e);
|
||||
}
|
||||
|
|
|
@ -282,10 +282,8 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
public String render(String pageName) {
|
||||
// Get activated theme
|
||||
ThemeProperty activatedTheme = getActivatedTheme();
|
||||
// Get theme folder name
|
||||
String themeFolderName = Paths.get(activatedTheme.getThemePath()).getFileName().toString();
|
||||
// Build render url
|
||||
return String.format(RENDER_TEMPLATE, themeFolderName, pageName);
|
||||
return String.format(RENDER_TEMPLATE, activatedTheme.getFolderName(), pageName);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -331,7 +329,7 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
|
||||
try {
|
||||
// TODO Refactor here in the future
|
||||
configuration.setSharedVariable("themeName", themeId);
|
||||
configuration.setSharedVariable("themeId", themeId);
|
||||
configuration.setSharedVariable("options", optionService.listOptions());
|
||||
} catch (TemplateModelException e) {
|
||||
throw new ServiceException("Failed to set shared variable", e).setErrorData(themeId);
|
||||
|
@ -644,6 +642,7 @@ public class ThemeServiceImpl implements ThemeService {
|
|||
|
||||
// Resolve additional properties
|
||||
themeProperty.setThemePath(themePath.toString());
|
||||
themeProperty.setFolderName(themePath.getFileName().toString());
|
||||
themeProperty.setHasOptions(hasOptions(themePath));
|
||||
themeProperty.setActivated(false);
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
*/
|
||||
function updateTheme(theme, e) {
|
||||
$(e).button('loading');
|
||||
$.get('/admin/themes/pull',{'themeName': theme},function (data) {
|
||||
$.get('/admin/themes/pull',{'themeId': theme},function (data) {
|
||||
if (data.code === 1) {
|
||||
halo.showMsgAndParentRedirect(data.msg, 'success', 1000, '/admin/themes');
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue