Older/WebApplication/view/PostView.h
amass b6e0681489
All checks were successful
Deploy / PullDocker (push) Successful in 4s
Deploy / Build (push) Successful in 2m8s
Deploy Docker Images / Docusaurus build and Server deploy (push) Successful in 13s
add code.
2024-11-02 00:30:14 +08:00

40 lines
862 B
C++

#ifndef __POSTVIEW_H__
#define __POSTVIEW_H__
#include "model/Post.h"
#include <Wt/WTemplate.h>
class BlogSession;
class PostView : public Wt::WTemplate {
public:
enum RenderType {
Brief,
Detail,
Edit,
};
PostView(BlogSession &session, const std::string &basePath, Wt::Dbo::ptr<Post> post, RenderType type);
protected:
void render(RenderType type);
void updateCommentCount(Wt::Dbo::ptr<Comment> 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> post_;
RenderType viewType_;
Wt::WText *commentCount_;
Wt::WLineEdit *titleEdit_;
Wt::WTextArea *briefEdit_, *bodyEdit_;
};
#endif // __POSTVIEW_H__