src/content.h
browsing at commit = 4fe276c400f51581a3858e55f7b9a48a1f90f419
#pragma once
#include "git_repo.h"
#include <cppcms/view.h>
#include <string>
#include <vector>
// Data passed from request handlers to the compiled cppcms templates.
namespace content {
// Shared layout fields. `query` is "" or "?id=<oid>" 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<std::string> 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<TreeEntry> 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;
uint64_t size = 0;
};
struct blame_view : public master {
std::string commit_oid;
std::string path;
std::string filename;
std::vector<BlameLine> lines;
};
struct log_view : public master {
std::string commit_oid;
std::vector<CommitInfo> commits;
};
struct object_view : public master {
ObjectView object;
};
struct tags_view : public master {
std::vector<TagInfo> tags;
};
struct tag_view : public master {
TagDetail tag;
};
struct commit_view : public master {
CommitDetail commit;
};
} // namespace content