use of com.blade.mvc.annotation.GetRoute in project tale by otale.
the class IndexController method index.
/**
* 仪表盘
*/
@GetRoute(value = { "/", "index" })
public String index(Request request) {
List<Comments> comments = siteService.recentComments(5);
List<Contents> contents = siteService.getContens(Types.RECENT_ARTICLE, 5);
Statistics statistics = siteService.getStatistics();
request.attribute("comments", comments);
request.attribute("articles", contents);
request.attribute("statistics", statistics);
return "admin/index";
}
use of com.blade.mvc.annotation.GetRoute in project tale by otale.
the class CategoryController method categories.
/**
* 某个分类详情页分页
*/
@GetRoute(value = { "category/:keyword/:page", "category/:keyword/:page.html" })
public String categories(Request request, @PathParam String keyword, @PathParam int page, @Param(defaultValue = "12") int limit) {
page = page < 0 || page > TaleConst.MAX_PAGE ? 1 : page;
Metas metaDto = metasService.getMeta(Types.CATEGORY, keyword);
if (null == metaDto) {
return this.render_404();
}
Page<Contents> contentsPage = contentsService.getArticles(metaDto.getMid(), page, limit);
request.attribute("articles", contentsPage);
request.attribute("meta", metaDto);
request.attribute("type", "分类");
request.attribute("keyword", keyword);
request.attribute("is_category", true);
request.attribute("page_prefix", "/category/" + keyword);
return this.render("page-category");
}
use of com.blade.mvc.annotation.GetRoute in project tale by otale.
the class CategoryController method tags.
/**
* 标签下文章分页
*/
@GetRoute(value = { "tag/:name/:page", "tag/:name/:page.html" })
public String tags(Request request, @PathParam String name, @PathParam int page, @Param(defaultValue = "12") int limit) {
page = page < 0 || page > TaleConst.MAX_PAGE ? 1 : page;
Metas metaDto = metasService.getMeta(Types.TAG, name);
if (null == metaDto) {
return this.render_404();
}
Page<Contents> contentsPage = contentsService.getArticles(metaDto.getMid(), page, limit);
request.attribute("articles", contentsPage);
request.attribute("meta", metaDto);
request.attribute("type", "标签");
request.attribute("keyword", name);
request.attribute("is_tag", true);
request.attribute("page_prefix", "/tag/" + name);
return this.render("page-category");
}
Aggregations