comparison scid/page-index.c @ 28:4c16bb25e4f1

scid: implement themes in javascript
author David Demelier <markand@malikania.fr>
date Thu, 04 Aug 2022 06:09:54 +0200
parents dae2de19ca5d
children 695637f1d8a7
comparison
equal deleted inserted replaced
27:dae2de19ca5d 28:4c16bb25e4f1
21 21
22 #include "log.h" 22 #include "log.h"
23 #include "config.h" 23 #include "config.h"
24 #include "db.h" 24 #include "db.h"
25 #include "page.h" 25 #include "page.h"
26 #include "scid.h"
26 #include "util.h" 27 #include "util.h"
28 #include "theme.h"
27 29
28 #if 0 30 #if 0
29 31
30 /* 32 /*
31 * Document we create for templatize. 33 * Document we create for templatize.
104 } 106 }
105 107
106 #endif 108 #endif
107 109
108 static void 110 static void
109
110 static void
111 get(struct kreq *r) 111 get(struct kreq *r)
112 { 112 {
113 #if 0 113 #if 0
114 (void)r; 114 (void)r;
115 struct project projects[SCI_PROJECT_MAX] = {0}; 115 struct project projects[SCI_PROJECT_MAX] = {0};
126 json_array_append(array, make_project(&projects[i])); 126 json_array_append(array, make_project(&projects[i]));
127 127
128 page(r, KHTTP_200, KMIME_TEXT_HTML, "pages/index.html", json_pack("{so}", 128 page(r, KHTTP_200, KMIME_TEXT_HTML, "pages/index.html", json_pack("{so}",
129 "projects", array 129 "projects", array
130 )); 130 ));
131 #endif
132 json_t *array; 131 json_t *array;
133 132
134 if (!(db_project_list())) { 133 if (!(db_project_list())) {
135 log_warn("page-index: %s", db.error); 134 log_warn("page-index: %s", db.error);
136 page(); 135 page();
137 } else 136 } else
138 render(array); 137 render(array);
138 #endif
139 khttp_head(r, kresps[KRESP_CONTENT_TYPE], "%s", kmimetypes[KMIME_TEXT_HTML]);
140 khttp_head(r, kresps[KRESP_STATUS], "%s", khttps[KHTTP_200]);
141 khttp_body(r);
142 khttp_printf(r, "%s", theme_render_index(scid.theme, "{}"));
143 khttp_free(r);
139 } 144 }
140 145
141 void 146 void
142 page_index(struct kreq *r) 147 page_index(struct kreq *r)
143 { 148 {