Skip to content
Browse files

[enhance] widgets: WBootstrap -> extended table elt type

  • Loading branch information...
1 parent 6caa4f2 commit b10c8a864745085596f6a26a31d8659ca8ec5e82 @Aqua-Ye Aqua-Ye committed Jan 16, 2013
Showing with 15 additions and 8 deletions.
  1. +1 −0 CHANGELOG
  2. +14 −8 lib/stdlib/widgets/bootstrap/bootstrap.opa
View
1 CHANGELOG
@@ -13,6 +13,7 @@ Updated APIs:
- added base64_char and base64_string parser
* WBootstrap
+ - extended table elt type
- extended table body lines type
- added data-toggle and data-target functions
View
22 lib/stdlib/widgets/bootstrap/bootstrap.opa
@@ -1,5 +1,5 @@
/*
- Copyright © 2011, 2012 MLstate
+ Copyright © 2011, 2012, 2013 MLstate
This file is part of Opa.
@@ -85,7 +85,9 @@ type WBootstrap.Navigation.page_nav_elt = {
// Table
-type WBootstrap.Table.elt = xhtml
+type WBootstrap.Table.elt =
+ {xhtml:xhtml}
+/ {xhtml:xhtml decorator:(xhtml -> xhtml)}
type WBootstrap.Table.elts = list(WBootstrap.Table.elt)
@@ -97,8 +99,8 @@ type WBootstrap.Table.decoration =
type WBootstrap.Table.decorations = list(WBootstrap.Table.decoration)
type WBootstrap.Table.line =
- list(xhtml)
-/ {elts:list(xhtml) handles:list(handle_assoc(xhtml_event))}
+ list(WBootstrap.Table.elt)
+/ {elts:WBootstrap.Table.elts handles:list(handle_assoc(xhtml_event))}
type WBootstrap.Table.lines = list(WBootstrap.Table.line)
@@ -450,18 +452,22 @@ WBootstrap = {{
@private gen_head(elts:WBootstrap.Table.elts) =
<thead><tr>{
@toplevel.List.map(e ->
- <th>{e}</th>
+ match e
+ ~{xhtml decorator} -> <th>{xhtml}</th> |> decorator(_)
+ ~{xhtml} -> <th>{xhtml}</th>
, elts)
}</tr></thead>
@private gen_body(lines:WBootstrap.Table.lines) =
<tbody>{
@toplevel.List.map(
line ->
- build_line(line:list(xhtml)) =
+ build_line(line) =
<tr>{
- @toplevel.List.map(
- e -> <td>{e}</td>
+ @toplevel.List.map(e ->
+ match e
+ ~{xhtml decorator} -> <td>{xhtml}</td> |> decorator(_)
+ ~{xhtml} -> <td>{xhtml}</td>
, line)
}</tr>
match line

0 comments on commit b10c8a8

Please sign in to comment.
Something went wrong with that request. Please try again.