#ifndef __POSTVIEW_H__ #define __POSTVIEW_H__ #include "model/Post.h" #include class BlogSession; class PostView : public Wt::WTemplate { public: enum RenderType { Brief, Detail, Edit, }; PostView(BlogSession &session, const std::string &basePath, Wt::Dbo::ptr post, RenderType type); protected: void render(RenderType type); void updateCommentCount(Wt::Dbo::ptr comment); void saveEdit(); void showView(); void publish(); void retract(); void setState(Post::State state); void showEdit(); void rm(); private: BlogSession &session_; std::string basePath_; Wt::Dbo::ptr post_; RenderType viewType_; Wt::WText *commentCount_; Wt::WLineEdit *titleEdit_; Wt::WTextArea *briefEdit_, *bodyEdit_; }; #endif // __POSTVIEW_H__