Skip to content

Commit

Permalink
コントローラがTableも返せるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
mzp committed Jan 11, 2010
1 parent ab73460 commit 902ec90
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions controller.ml
Expand Up @@ -4,6 +4,7 @@ open StdLabels
type t =
String of string
| Bool of bool
| Table of (string * t) list list

let find_package module_ configs =
let config =
Expand Down
1 change: 1 addition & 0 deletions controller.mli
@@ -1,5 +1,6 @@
type t =
String of string
| Bool of bool
| Table of (string * t) list list

val format : Config.t list -> Search.t -> (string * t) list
10 changes: 9 additions & 1 deletion main.ml
Expand Up @@ -10,7 +10,15 @@ let rec to_var = function
Controller.String s ->
Template.VarString s
| Controller.Bool b ->
Template.VarConditional b
Template.VarConditional b
| Controller.Table rows ->
Template.VarTable begin
List.map rows ~f:begin fun row ->
List.map row ~f:begin fun (name, cell) ->
(name, to_var cell)
end
end
end

let index_page (cgi : cgi) =
cgi#template @@ template "templates/index.html"
Expand Down

0 comments on commit 902ec90

Please sign in to comment.