Esempio n. 1
0
  public GridLayout initialize() {

    LOG.debug("Initializing the category and post view");
    buildCategoryTree();
    buildCategoryCRUDAccordion();

    postCRUDAccordion = postView.buildPostCRUDAccordion();
    postCRUDAccordion.setHeight("100%");
    postViewGrid = postView.buildPostViewGrid();

    topLayout.setImmediate(true);
    topLayout.setHeight("100%");
    topLayout.setWidth("100%");
    topLayout.setSpacing(true);

    // first row of the grid layout
    topLayout.addComponent(categoryAccordionCRUD);
    topLayout.addComponent(topTreeLayout);
    topLayout.addComponent(postCRUDAccordion); // builds the CRUD accordion for Posts management

    // second row of the grid layout
    topLayout.addComponent(
        postViewGrid,
        0,
        1,
        2,
        1); // builds the Grid for the Posts view which spans over 3 columns of the row
    topLayout.setComponentAlignment(postViewGrid, Alignment.TOP_LEFT);

    return topLayout;
  }
Esempio n. 2
0
 private String renderListOfPosts(Page<Post> page, Model model, String activeCategory) {
   Page<PostView> postViewPage = PostView.pageOf(page, dateFactory);
   List<PostView> posts = postViewPage.getContent();
   model.addAttribute("activeCategory", activeCategory);
   model.addAttribute("categories", PostCategory.values());
   model.addAttribute("posts", posts);
   model.addAttribute("paginationInfo", new PaginationInfo(postViewPage));
   model.addAttribute("disqusShortname", service.getDisqusShortname());
   return "blog/index";
 }
Esempio n. 3
0
  @RequestMapping(
      value = "/{year:\\d+}/{month:\\d+}/{day:\\d+}/{slug}",
      method = {GET, HEAD})
  public String showPost(
      @PathVariable String year,
      @PathVariable String month,
      @PathVariable String day,
      @PathVariable String slug,
      Model model) {

    String publicSlug = String.format("%s/%s/%s/%s", year, month, day, slug);
    Post post = service.getPublishedPost(publicSlug);
    model.addAttribute("post", PostView.of(post, dateFactory));
    model.addAttribute("categories", PostCategory.values());
    model.addAttribute("activeCategory", post.getCategory().getDisplayName());
    model.addAttribute("disqusShortname", service.getDisqusShortname());
    return "blog/show";
  }
Esempio n. 4
0
 public void refreshPostView() {
   postView.initialize(selectedCategory);
   postView.refreshPostViewGrid();
 }
 @Override
 public void onBindViewHolder(PostView holder, int position) {
   final Post post = posts.get(position);
   holder.bindPost(post, position);
 }