summaryrefslogtreecommitdiffstats
path: root/web/layout/tabular.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/layout/tabular.js')
-rw-r--r--web/layout/tabular.js31
1 files changed, 31 insertions, 0 deletions
diff --git a/web/layout/tabular.js b/web/layout/tabular.js
new file mode 100644
index 0000000..03fbe03
--- /dev/null
+++ b/web/layout/tabular.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2012-2014 Kaarle Ritvanen
+ * See LICENSE file for license details
+ */
+
+define(
+ [
+ "acf2/type",
+ "acf2/widget/inline",
+ "acf2/widget/table/header",
+ "acf2/widget/table/row"
+ ],
+ function(type, Base, TableHeader, TableRow) {
+ var Class = Base.extend({
+ render: function(data, meta) {
+ this.header = true;
+ this.super(Class, "render", data, meta);
+ },
+
+ widget: function(meta) {
+ if (!type.isTreeNode(meta))
+ return this.super(Class, "widget", meta);
+ if (!this.header) return TableRow;
+ this.header = false;
+ return TableHeader;
+ }
+ });
+
+ return Class;
+ }
+);