Search in sources :

Example 1 with PostType

use of com.nixmash.blog.jpa.enums.PostType in project nixmash-blog by mintster.

the class AdminPostsController method addPostLink.

// endregion
// region Add Post GET
@RequestMapping(value = "/add/{type}", method = GET)
public String addPostLink(@PathVariable("type") String type, Model model, HttpServletRequest request) {
    PostType postType = PostType.valueOf(type.toUpperCase());
    model.addAttribute("postDTO", new PostDTO());
    model.addAttribute("canPreview", false);
    model.addAttribute("categories", postService.getAdminSelectionCategories());
    if (postType == PostType.POST) {
        WebUtils.setSessionAttribute(request, SESSION_ATTRIBUTE_NEWPOST, null);
        model.addAttribute("hasPost", true);
        model.addAttribute("postheader", webUI.getMessage(ADD_POST_HEADER));
        return ADMIN_POST_ADD_VIEW;
    } else {
        model.addAttribute("postLink", new PostLink());
        model.addAttribute("postheader", webUI.getMessage(ADD_LINK_HEADER));
        return ADMIN_LINK_ADD_VIEW;
    }
}
Also used : PostType(com.nixmash.blog.jpa.enums.PostType) PostDTO(com.nixmash.blog.jpa.dto.PostDTO) PostLink(com.nixmash.blog.mvc.containers.PostLink)

Aggregations

PostDTO (com.nixmash.blog.jpa.dto.PostDTO)1 PostType (com.nixmash.blog.jpa.enums.PostType)1 PostLink (com.nixmash.blog.mvc.containers.PostLink)1