Search in sources :

Example 1 with GetRoute

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";
}
Also used : Contents(com.tale.model.entity.Contents) Comments(com.tale.model.entity.Comments) Statistics(com.tale.model.dto.Statistics) GetRoute(com.blade.mvc.annotation.GetRoute)

Example 2 with GetRoute

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");
}
Also used : Metas(com.tale.model.entity.Metas) Contents(com.tale.model.entity.Contents) GetRoute(com.blade.mvc.annotation.GetRoute)

Example 3 with GetRoute

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");
}
Also used : Metas(com.tale.model.entity.Metas) Contents(com.tale.model.entity.Contents) GetRoute(com.blade.mvc.annotation.GetRoute)

Aggregations

GetRoute (com.blade.mvc.annotation.GetRoute)3 Contents (com.tale.model.entity.Contents)3 Metas (com.tale.model.entity.Metas)2 Statistics (com.tale.model.dto.Statistics)1 Comments (com.tale.model.entity.Comments)1