commit 8d4d245353aa669e60c4e97039dd7c3914e62ac5 from: Tracey Emery date: Wed Jan 15 22:10:30 2020 UTC summary styling commit - 17a96b9f3e444f9ccc92aad27ca5890af61fa2e0 commit + 8d4d245353aa669e60c4e97039dd7c3914e62ac5 blob - d9a860735bffd19f2d84ba0691bf3ab0e60ee222 blob + 2df206605e5aeebf3f38ae1ec3e8db151e649c05 --- gotweb/files/htdocs/gotweb/gotweb.css +++ gotweb/files/htdocs/gotweb/gotweb.css @@ -115,7 +115,7 @@ body { width: 100%; background-color: #ced7e0; } -#np_navs { +#navs { padding-left: 10px; padding-top: 2px; padding-bottom: 2px; @@ -188,7 +188,62 @@ body { padding-top: 5px; padding-bottom: 5px; overflow: auto; +} +#shortlog_wrapper { + clear: left; + float: left; + padding-left: 10px; + padding-top: 5px; + padding-bottom: 5px; +} +#shortlog_age { + float: left; + width: 6.5em; +} +#shortlog_author { + float: left; + width: 7.5em; + font-style: italic; +} +#shortlog_log { + float: left; + font-weight: bold; +} +#tags_wrapper { + clear: left; + float: left; + padding-left: 10px; + padding-top: 5px; + padding-bottom: 5px; +} +#tags_age { + float: left; + width: 6.5em; +} +#tag { + float: left; + width: 7.5em; + font-style: italic; +} +#tag_name { + float: left; + font-weight: bold; } +#heads_wrapper { + clear: left; + float: left; + padding-left: 10px; + padding-top: 5px; + padding-bottom: 5px; +} +#heads_age { + float: left; + width: 6.5em; +} +#head { + float: left; + font-weight: bold; +} /* index.tmpl */ @@ -301,16 +356,11 @@ body { padding-top: 5px; padding-bottom: 5px; } -#summary_shortlog_content_wrapper { +#summary_shortlog_content { clear: left; float: left; width: 100%; } -#summary_shortlog_content { - padding-left: 10px; - padding-top: 5px; - padding-bottom: 5px; -} #summary_tags_title_wrapper { clear: left; float: left; @@ -323,16 +373,11 @@ body { padding-top: 5px; padding-bottom: 5px; } -#summary_tags_content_wrapper { +#summary_tags_content { clear: left; float: left; width: 100%; } -#summary_tags_content { - padding-left: 10px; - padding-top: 5px; - padding-bottom: 5px; -} #summary_heads_title_wrapper { clear: left; float: left; @@ -345,13 +390,8 @@ body { padding-top: 5px; padding-bottom: 5px; } -#summary_heads_content_wrapper { +#summary_heads_content { clear: left; float: left; width: 100%; } -#summary_heads_content { - padding-left: 10px; - padding-top: 5px; - padding-bottom: 5px; -} blob - 2a81b4e630f47940689755f379f67be7423f49ac blob + 0ca52e2c26e6dff41c63802c4a053773fdcecec7 --- gotweb/gotweb.c +++ gotweb/gotweb.c @@ -131,6 +131,9 @@ static char *gw_get_repo_owner(struct trans *, char *); static char *gw_get_repo_age(struct trans *, char *, char *, int); +static char *gw_get_repo_shortlog(struct trans *); +static char *gw_get_repo_tags(struct trans *); +static char *gw_get_repo_heads(struct trans *); static char *gw_get_clone_url(struct trans *, char *); static char *gw_get_got_link(struct trans *); static char *gw_get_site_link(struct trans *); @@ -154,7 +157,6 @@ static const struct got_error* gw_blob(struct trans * static const struct got_error* gw_blob_diff(struct trans *); static const struct got_error* gw_commit(struct trans *); static const struct got_error* gw_commit_diff(struct trans *); -static const struct got_error* gw_heads(struct trans *); static const struct got_error* gw_history(struct trans *); static const struct got_error* gw_index(struct trans *); static const struct got_error* gw_log(struct trans *); @@ -162,7 +164,6 @@ static const struct got_error* gw_raw(struct trans *) static const struct got_error* gw_shortlog(struct trans *); static const struct got_error* gw_snapshot(struct trans *); static const struct got_error* gw_summary(struct trans *); -static const struct got_error* gw_tags(struct trans *); static const struct got_error* gw_tree(struct trans *); struct gw_query_action { @@ -276,14 +277,6 @@ gw_commit_diff(struct trans *gw_trans) } static const struct got_error * -gw_heads(struct trans *gw_trans) -{ - const struct got_error *error = NULL; - - return error; -} - -static const struct got_error * gw_history(struct trans *gw_trans) { const struct got_error *error = NULL; @@ -403,13 +396,7 @@ static const struct got_error * gw_shortlog(struct trans *gw_trans) { const struct got_error *error = NULL; - struct got_repository *repo = NULL; - error = got_repo_open(&repo, gw_trans->repo_path, NULL); - if (error != NULL) - return error; - - return error; } @@ -426,7 +413,8 @@ gw_summary(struct trans *gw_trans) { const struct got_error *error = NULL; char *description_html, *repo_owner_html, *repo_age_html, - *cloneurl_html; + *cloneurl_html, *shortlog, *tags, *heads, *shortlog_html, + *tags_html, *heads_html; error = apply_unveil(gw_trans->gw_dir->path, NULL); if (error) @@ -482,19 +470,36 @@ gw_summary(struct trans *gw_trans) } khttp_puts(gw_trans->gw_req, div_end); - error = gw_shortlog(gw_trans); - error = gw_tags(gw_trans); - error = gw_heads(gw_trans); - khttp_puts(gw_trans->gw_req, summary_shortlog); - khttp_puts(gw_trans->gw_req, summary_tags); - khttp_puts(gw_trans->gw_req, summary_heads); - return error; -} + shortlog = gw_get_repo_shortlog(gw_trans); + tags = gw_get_repo_tags(gw_trans); + heads = gw_get_repo_heads(gw_trans); -static const struct got_error * -gw_tags(struct trans *gw_trans) -{ - const struct got_error *error = NULL; + if (shortlog != NULL && strcmp(shortlog, "") != 0) { + if ((asprintf(&shortlog_html, summary_shortlog, + shortlog)) == -1) + return got_error_from_errno("asprintf"); + khttp_puts(gw_trans->gw_req, shortlog_html); + free(shortlog_html); + free(shortlog); + } + + if (tags != NULL && strcmp(tags, "") != 0) { + if ((asprintf(&tags_html, summary_tags, + tags)) == -1) + return got_error_from_errno("asprintf"); + khttp_puts(gw_trans->gw_req, tags_html); + free(tags_html); + free(tags); + } + + if (heads != NULL && strcmp(heads, "") != 0) { + if ((asprintf(&heads_html, summary_heads, + heads)) == -1) + return got_error_from_errno("asprintf"); + khttp_puts(gw_trans->gw_req, heads_html); + free(heads_html); + free(heads); + } return error; } @@ -1045,9 +1050,36 @@ gw_get_clone_url(struct trans *gw_trans, char *dir) fclose(f); free(d_file); return url; +} + +static char * +gw_get_repo_shortlog(struct trans *gw_trans) +{ + char *shortlog = NULL; + + asprintf(&shortlog, shortlog_row, "30 min ago", "Flan Author", "this is just a fake ass place holder", shortlog_navs); + return shortlog; } static char * +gw_get_repo_tags(struct trans *gw_trans) +{ + char *tags = NULL; + + asprintf(&tags, tags_row, "30 min ago", "1.0.0", "tag 1.0.0", tags_navs); + return tags; +} + +static char * +gw_get_repo_heads(struct trans *gw_trans) +{ + char *heads = NULL; + + asprintf(&heads, heads_row, "30 min ago", "master", heads_navs); + return heads; +} + +static char * gw_get_got_link(struct trans *gw_trans) { char *link; blob - 9628eafaeef5509996b07e89b3e5318b2dafcf1c blob + 3aef0f4d79721d7d97e6eb21db510584357cc6ff --- gotweb/gotweb_ui.h +++ gotweb/gotweb_ui.h @@ -114,6 +114,58 @@ char *cloneurl = "
Clone URL:
" \ "
%s
"; +char *shortlog_row = + "
" \ + "
%s
" \ + "
%s
" \ + "
%s
" \ + "
" \ + "" \ + "" \ + "
"; + +char *shortlog_navs = + "commit | " \ + "commit diff | " \ + "tree | " \ + "snapshot"; + +char *tags_row = + "
" \ + "
%s
" \ + "
%s
" \ + "
%s
" \ + "
" \ + "" \ + "" \ + "
"; + +char *tags_navs = + "tag | " \ + "commit | " \ + "shortlog | " \ + "log"; + +char *heads_row = + "
" \ + "
%s
" \ + "" \ + "
" \ + "" \ + "" \ + "
"; + +char *heads_navs = + "shortlog | " \ + "log | " \ + "commit"; + /* index.tmpl */ char *index_projects_header = @@ -133,7 +185,7 @@ char *index_projects = "
%s
" \ "
%s
" \ "" \ "" \ "
"; @@ -152,22 +204,16 @@ char *summary_wrapper = char *summary_shortlog = "
" \ "
Shortlog
" \ - "
" \ - "
%s
" \ - "
"; + "
%s
"; char *summary_tags = "
" \ "
Tags
" \ - "
" \ - "
%s
" \ - "
"; + "
%s
"; char *summary_heads = "
" \ "
Heads
" \ - "
" \ - "
%s
" \ - "
"; + "
%s
"; #endif /* GOTWEB_UI_H */