use of com.tale.dto.ThemeDto in project tale by otale.
the class ThemeController method index.
@Route(value = "", method = HttpMethod.GET)
public String index(Request request) {
// 读取主题
String themesDir = AttachController.CLASSPATH + "templates/themes";
File[] themesFile = new File(themesDir).listFiles();
List<ThemeDto> themes = new ArrayList<>(themesFile.length);
for (File f : themesFile) {
if (f.isDirectory()) {
ThemeDto themeDto = new ThemeDto(f.getName());
if (FileKit.exist(f.getPath() + "/setting.html")) {
themeDto.setHasSetting(true);
}
themes.add(themeDto);
try {
Blade.$().embedServer().addStatic("/templates/themes/" + f.getName() + "/screenshot.png");
} catch (Exception e) {
}
}
}
request.attribute("current_theme", Commons.site_theme());
request.attribute("themes", themes);
return "admin/themes";
}
Aggregations