Add theme folder name in theme property

pull/146/head
johnniang 2019-04-20 16:57:13 +08:00
parent e46c1f8740
commit e81ed5b660
2 changed files with 8 additions and 4 deletions

View File

@ -49,10 +49,15 @@ public class ThemeProperty {
private Author author; private Author author;
/** /**
* Folder name. * Theme path.
*/ */
private String themePath; private String themePath;
/**
* Theme folder name.
*/
private String folderName;
/** /**
* Has options. * Has options.
*/ */

View File

@ -282,10 +282,8 @@ public class ThemeServiceImpl implements ThemeService {
public String render(String pageName) { public String render(String pageName) {
// Get activated theme // Get activated theme
ThemeProperty activatedTheme = getActivatedTheme(); ThemeProperty activatedTheme = getActivatedTheme();
// Get theme folder name
String themeFolderName = Paths.get(activatedTheme.getThemePath()).getFileName().toString();
// Build render url // Build render url
return String.format(RENDER_TEMPLATE, themeFolderName, pageName); return String.format(RENDER_TEMPLATE, activatedTheme.getFolderName(), pageName);
} }
@Override @Override
@ -644,6 +642,7 @@ public class ThemeServiceImpl implements ThemeService {
// Resolve additional properties // Resolve additional properties
themeProperty.setThemePath(themePath.toString()); themeProperty.setThemePath(themePath.toString());
themeProperty.setFolderName(themePath.getFileName().toString());
themeProperty.setHasOptions(hasOptions(themePath)); themeProperty.setHasOptions(hasOptions(themePath));
themeProperty.setActivated(false); themeProperty.setActivated(false);