summaryrefslogtreecommitdiffstats
path: root/web/layout
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-06 23:09:13 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-14 22:35:56 +0200
commit38ac196b2f00c1e13a0928cd892384bc296c8a98 (patch)
tree473663650b5b4fd898bd9bab4c666dca6b900dd4 /web/layout
parent7d434464a843a8ca8acc903367492186a0ae13e8 (diff)
downloadaconf-38ac196b2f00c1e13a0928cd892384bc296c8a98.tar.bz2
aconf-38ac196b2f00c1e13a0928cd892384bc296c8a98.tar.xz
web client: extract each widget to a dedicated file
Diffstat (limited to 'web/layout')
-rw-r--r--web/layout/stacked.js17
-rw-r--r--web/layout/tabular.js31
2 files changed, 48 insertions, 0 deletions
diff --git a/web/layout/stacked.js b/web/layout/stacked.js
new file mode 100644
index 0000000..1fa8af9
--- /dev/null
+++ b/web/layout/stacked.js
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2012-2014 Kaarle Ritvanen
+ * See LICENSE file for license details
+ */
+
+define(["acf2/type", "acf2/widget/inline"], function(type, Base) {
+ var Class = Base.extend({
+ widget: function(meta) {
+ return type.isTreeNode(meta) ?
+ Base : this.super(Class, "widget", meta);
+ }
+ });
+
+ return Class;
+});
+
+
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;
+ }
+);