#pragma once #include "git_repo.h" #include #include #include // Data passed from request handlers to the compiled cppcms templates. namespace content { // Shared layout fields. `query` is "" or "?id=" and is appended to links // so navigation stays pinned to the viewed commit. struct master : public cppcms::base_content { std::string title; std::string repo; // current repository name, "" outside a repo std::string query; }; struct frontpage : public master { size_t repo_count = 0; }; struct repo_list : public master { std::vector repos; }; struct repo_home : public master { std::string commit_oid; std::string default_branch; std::string readme_name; // "" when the repo has no README std::string readme_text; // raw markdown, rendered client-side }; struct tree_view : public master { std::string commit_oid; std::string path; // "" at repo root std::string parent_path; // for the ".." link bool is_root = true; std::vector entries; }; struct file_view : public master { std::string commit_oid; std::string path; std::string filename; std::string text; bool is_binary = false; bool is_markdown = false; bool is_image = false; uint64_t size = 0; }; struct blame_view : public master { std::string commit_oid; std::string path; std::string filename; std::vector lines; }; struct log_view : public master { std::string commit_oid; std::vector commits; }; struct object_view : public master { ObjectView object; }; struct tags_view : public master { std::vector tags; }; struct tag_view : public master { TagDetail tag; }; struct commit_view : public master { CommitDetail commit; }; } // namespace content