Example #1
0
File: forum.py Project: fy0/Icarus
 def get(self):
     board_id = self.get_argument("board", None)
     board = Board.get_by_pk(board_id)
     board_title = board.title if board else None
     self.render(
         "forum/topic_new.html",
         nav="index",
         page_title=page_title("新建主题", board_title, "社区"),
         boards=Board.get_list(),
         board_id=board_id,
     )
Example #2
0
File: forum.py Project: fy0/Icarus
    def get(self, topic_id):
        topic = Topic.get_by_pk(topic_id)
        if not self.topic_check(topic):
            return

        self.render(
            "forum/topic_edit.html",
            nav="index",
            page_title=page_title("编辑主题 - %s" % topic.title, topic.board.title, "社区"),
            topic=topic,
            boards=Board.get_list(),
        )
Example #3
0
File: forum.py Project: fy0/Icarus
 def get(self, board_id):
     board = Board.get_by_pk(board_id)
     if board:
         page = self.get_argument("p", "1")
         count, query = Topic.get_list_by_board(board)
         pagination_ret = pagination(count, query, config.TOPIC_PAGE_SIZE, page)
         self.render(
             "forum/board.html",
             nav="index",
             page_title=page_title(board.title, "社区"),
             board=board,
             topics_count=count,
             pagination=pagination_ret,
             page_url=self.request.path,
         )
     else:
         self.write_error(404)
Example #4
0
File: forum.py Project: fy0/Icarus
 def get(self, topic_id):
     topic = Topic.get_by_pk(topic_id)
     if topic:
         topic.view_count_inc()
         count, user_topics = Topic.get_list_by_user(topic.user)
         user_topics = user_topics.limit(10)
         follow = JsDict()
         if self.current_user():
             follow.topic = Follow.exists(OBJECT_TYPES.TOPIC, topic_id, self.current_user())
             follow.author = Follow.exists(OBJECT_TYPES.USER, topic.user.id, self.current_user())
         self.render(
             "forum/topic.html",
             nav="index",
             page_title=page_title(topic.title, topic.board.title, "社区"),
             topic=topic,
             user_topics=user_topics,
             follow=follow,
         )
     else:
         self.write_error(404)