Permalink
Browse files

update preload.pl to the new syntax and defaults

  • Loading branch information...
1 parent 53c2822 commit d1132d887a72023cb1bd9cce9b932ec635491547 @tonycoz committed Dec 21, 2013
Showing with 24 additions and 28 deletions.
  1. +24 −28 site/templates/preload.tmpl
@@ -1,11 +1,8 @@
<:# see preload.pod for documentation -:>
-<:.set groups = 0 -:>
-<:.set grouplabel = "label" -:>
-<:.set groupid = "id" -:>
-<:.set itemgroupid = "groupid" -:>
<:.set dist_image_uri = cfg.entryIfVar("uri", "dist_images", "/images") -:>
<:# utility definitions :>
-<:-.define make_select-:>
+<:-.define make_select; groups: 0, grouplabel: "label", groupid: "id",
+ itemgroupid: "groupid" -:>
<:-.if !default.defined -:>
<:-.set default = "" -:>
<:.end if:>
@@ -50,7 +47,7 @@ make_multicheck expects:
name - the name of the input elements
readonly - true to make it readonly
-:>
-<:-.define make_multicheck-:>
+<:-.define make_multicheck; readonly: 0-:>
<:.if !readonly -:>
<input type="hidden" name="_save_<:= name -:>" value="1">
<:.end if -:>
@@ -137,7 +134,7 @@ Page <:= pages.page :> of <:= pages.pagecount :>
<:.end define -:>
<:.define error_img -:>
-<:.call "error_img_n", "index":0 -:>
+<:.call "error_img_n", index:0 -:>
<:.end define -:>
<:.define input -:>
@@ -175,22 +172,21 @@ Page <:= pages.page :> of <:= pages.pagecount :>
<:.set values = values.is_code ? values() : values -:>
<:.set default = cgi.param("_save_" _ name) ? [ cgi.param(name) ] : default -:>
<:.call "make_multicheck",
- "id":field.select.id,
- "desc":field.select.label,
- "readonly":0 -:>
+ id:field.select.id,
+ desc:field.select.label -:>
<: .elsif field.htmltype eq "select" -:>
<:.set values = field.select["values"] -:>
<:.set values = values.is_code ? values() : values -:>
<:.call "make_select",
- "name":name,
- "default":default,
- "list":values,
- "id":field.select.id,
- "desc":field.select.label,
- "groupid": (field.select.groupid or "id"),
- "itemgroupid": (field.select.itemgroupid or "groupid"),
- "groups": field.select.groups ? (field.select.groups.is_code ? (field.select.groups)() : field.select.groups ) : 0,
- "grouplabel": (field.select.grouplabel or "label")
+ name: name,
+ default: default,
+ list: values,
+ id: field.select.id,
+ desc: field.select.label,
+ groupid : (field.select.groupid or "id"),
+ itemgroupid: (field.select.itemgroupid or "groupid"),
+ groups: field.select.groups ? (field.select.groups.is_code ? (field.select.groups)() : field.select.groups ) : 0,
+ grouplabel: (field.select.grouplabel or "label")
-:>
<: .else -:>
<input id="<:= name | html :>" type="text" name="<:= name | html :>" value="<:= default | html :>"
@@ -207,7 +203,7 @@ Page <:= pages.page :> of <:= pages.pagecount :>
<:.if fields.is_hash -:>
<:.set f = fields[name] -:>
<:.if f -:>
- <:.call "inlinefield", "field":f, "name":name -:>
+ <:.call "inlinefield", field:f, name:name -:>
<:.else -:>
<p>Unknown field id '<b><:= name :></b>', available fields are '<:= fields.keys.join("', '") :>'</p>
<:.end if -:>
@@ -226,9 +222,9 @@ Page <:= pages.page :> of <:= pages.pagecount :>
<label for="<:= name | html :>"><:= field.nolabel ? "" : field.description | html :>:</label>
<span>
<:-.if field.readonly -:>
-<:-.call "display", "name":name -:>
+<:-.call "display", name:name -:>
<:.else -:>
-<:-.call "input", "name":name -:><:.call "error_img", "field":name :>
+<:-.call "input", name:name -:><:.call "error_img", field:name :>
<:-.end if -:>
<:-.if field.units -:>
<:-= field.units | html -:>
@@ -250,7 +246,7 @@ parameters:
<:.if !f.nolabel -:>
<legend><:= f.description :></legend>
<:.end if -:>
- <:.call "input", "name":name, "field":f -:>
+ <:.call "input", name: name, field: f -:>
</fieldset>
<:.elsif fields.is_hash -:>
<p>Unknown field id '<b><:= name :></b>', available fields are '<:= fields.keys.join("', '") :>'</p>
@@ -284,9 +280,9 @@ parameters:
<:.set values = field.select["values"] -:>
<:.set values = values.is_code ? values() : values -:>
<:.call "make_multicheck",
- "id":field.select.id,
- "desc":field.select.label,
- "readonly":1 -:>
+ id: field.select.id,
+ desc: field.select.label,
+ readonly: 1 -:>
<: .elsif field.htmltype eq "select" -:>
<:.set values = field.select["values"] -:>
<:.set values = values.is_code ? values() : values -:>
@@ -312,7 +308,7 @@ parameters:
<:.if field.is_hash -:>
<div>
<label for="<:= name :>"><:= field.nolabel ? "" : field.description :>:</label>
- <span><:.call "display", "name":name -:>
+ <span><:.call "display", name:name -:>
<:-.if field.units -:>
<:-= field.units -:>
<:-.end if -:>
@@ -326,7 +322,7 @@ parameters:
<:.if fields.is_hash -:>
<:.set f = fields[name] -:>
<:.if f -:>
- <:.call "inlinefieldro", "field":f, "name":name -:>
+ <:.call "inlinefieldro", field:f, name:name -:>
<:.else -:>
<p>Unknown field id '<b><:= name :></b>', available fields are '<:= fields.keys.join("', '") :>'</p>
<:.end if -:>

0 comments on commit d1132d8

Please sign in to comment.