use of com.tale.dto.MetaDto in project tale by otale.
the class IndexController method categories.
@Route(values = { "category/:keyword/:page", "category/:keyword/:page.html" }, method = HttpMethod.GET)
public String categories(Request request, @PathParam String keyword, @PathParam int page, @QueryParam(value = "limit", defaultValue = "12") int limit) {
page = page < 0 || page > TaleConst.MAX_PAGE ? 1 : page;
MetaDto metaDto = metasService.getMeta(Types.CATEGORY, keyword);
if (null == metaDto) {
return this.render_404();
}
Paginator<Contents> contentsPaginator = contentsService.getArticles(metaDto.getMid(), page, limit);
request.attribute("articles", contentsPaginator);
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.tale.dto.MetaDto in project tale by otale.
the class IndexController method tags.
/**
* 标签分页
*
* @param request
* @param name
* @param page
* @param limit
* @return
*/
@Route(values = { "tag/:name/:page", "tag/:name/:page.html" }, method = HttpMethod.GET)
public String tags(Request request, @PathParam String name, @PathParam int page, @QueryParam(value = "limit", defaultValue = "12") int limit) {
page = page < 0 || page > TaleConst.MAX_PAGE ? 1 : page;
MetaDto metaDto = metasService.getMeta(Types.TAG, name);
if (null == metaDto) {
return this.render_404();
}
Paginator<Contents> contentsPaginator = contentsService.getArticles(metaDto.getMid(), page, limit);
request.attribute("articles", contentsPaginator);
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");
}