FOR c IN request.config.$tbl.required_cols;
required.$c = 1;
END;
+
%]
-[% FOR col = classmetadata.columns;
+[%
+SET heading_shown = 0;
+FOR col = classmetadata.columns;
NEXT IF !classmetadata.cgi.$col;
NEXT IF col == "id" OR col == classmetadata.table _ "_id";
-
# Display foreign inputs last
IF (mykeys = classmetadata.cgi.$col.keys);
foreign.push(col);
names.push(classmetadata.colnames.$col);
NEXT;
END;
+ IF ! heading_shown;
+ heading = classmetadata.moniker | ucfirst;
+ "<h4> $heading </h4>";
+ SET heading_shown = 1;
+ END;
%]
[% # Base case starts here
[% USE this = Class(classmetadata.name);
FOR col IN foreign;
- fclass = this.related_class(request, col);
+ # has_many mapping throws a stick in our spokes because related_class returns the mapped
+ # class. Sometimes we just want the has_many class.
+
+ # In case of Pub Handpumps maps to Beer and we want to add Handpump to Pub, we dont
+ # want the mapped data .
+ # In case of "Create New Handpump" -- we want the mapped data probably so we get
+ # Beer inputs and Pub select box.
+
+ fclass_rel_meta = this.related_meta(request, col);
+ fclass = fclass_rel_meta.foreign_class; # ignor args.mapping
fclass_meta = this.get_classmetadata(fclass);
- fclass_meta.cgi = classmetadata.cgi.$col;
+ fclass_meta.cgi = classmetadata.cgi.$col;
+ # USE Dumper; Dumper.dump(fclass_meta);
INCLUDE display_inputs
col_prefix = col _ "__AF__" _ col_prefix
errors = errors.$col