Compare View

switch
from
...
to
 
Commits (5)
web/making_a_web_site.anubis
... ... @@ -1308,6 +1308,30 @@ public define CoreAttrs formmethod(FormMethod method) = attr("formmethod", if me
1308 1308  
1309 1309  
1310 1310 'HTML_Off_Form' defines all the elements you may put outside any form.
  1311 +
  1312 +public define CoreAttrs method(String value) = attr("method", value).
  1313 +public define CoreAttrs for(String value) = attr("for", value).
  1314 +public define CoreAttrs placeholder(String value) = attr("placeholder", value).
  1315 +public define CoreAttrs action(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)).
  1316 +public define CoreAttrs action(WEB_Action_Name action, List((String,String)) extra_ops)= attr("formaction", "/"+format_web_action_name(action, extra_ops)).
  1317 +public define CoreAttrs formaction(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)).
  1318 +public define CoreAttrs formaction(WEB_Action_Name action, List((String,String)) extra_ops)= attr("formaction", "/"+format_web_action_name(action, extra_ops)).
  1319 +public define CoreAttrs formmethod(String value) = attr("formmethod", value).
  1320 +public define CoreAttrs form(String value) = attr("form", value).
  1321 +
  1322 +
  1323 +
  1324 +public define CoreAttrs method(String value) = attr("method", value).
  1325 +public define CoreAttrs for(String value) = attr("for", value).
  1326 +public define CoreAttrs placeholder(String value) = attr("placeholder", value).
  1327 +public define CoreAttrs action(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)).
  1328 +public define CoreAttrs action(WEB_Action_Name action, List((String,String)) extra_ops)= attr("formaction", "/"+format_web_action_name(action, extra_ops)).
  1329 +public define CoreAttrs formaction(WEB_Action_Name action)= attr("action", "/"+format_web_action_name(action)).
  1330 +public define CoreAttrs formaction(WEB_Action_Name action, List((String,String)) extra_ops)= attr("formaction", "/"+format_web_action_name(action, extra_ops)).
  1331 +public define CoreAttrs formmethod(String value) = attr("formmethod", value).
  1332 +public define CoreAttrs form(String value) = attr("form", value).
  1333 +
  1334 +
1311 1335  
1312 1336 public define HTML_Off_Form text(List(CoreAttrs) attrs, Int i) = text(attrs, to_decimal(i)).
1313 1337 public define HTML_Off_Form text(CoreAttrs attr, Int i) = text([attr], i).
... ... @@ -1445,9 +1469,11 @@ public define HTML_Off_Form form(CoreAttrs attr, List(HTML_Off_Form) content)
1445 1469 public define HTML_Off_Form form(CoreAttrs attr, HTML_Off_Form content) = html_tag("form", [attr], [content]).
1446 1470 public define HTML_Off_Form form(List(CoreAttrs) attrs) = html_tag("form", attrs, []).
1447 1471 public define HTML_Off_Form form(CoreAttrs attr) = html_tag("form", [attr], []).
  1472 +
1448 1473 public define HTML_Off_Form form(List(HTML_Off_Form) content) = html_tag("form", [], content).
1449 1474 public define HTML_Off_Form form(HTML_Off_Form content) = html_tag("form", [], [content]).
1450 1475  
  1476 +
1451 1477 // <header>
1452 1478 public define HTML_Off_Form header(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("header", attrs, content).
1453 1479 public define HTML_Off_Form header(List(CoreAttrs) attrs, HTML_Off_Form content) = html_tag("header", attrs, [content]).
... ... @@ -1502,19 +1528,23 @@ public define HTML_Off_Form iframe(String src)
1502 1528 public define HTML_Off_Form input(List(CoreAttrs) attrs) = html_void_tag("input", attrs).
1503 1529 public define HTML_Off_Form input(CoreAttrs attr) = html_void_tag("input", [attr]).
1504 1530  
  1531 +public define CoreAttrs type(String value)= attr("type", value).
  1532 +public define CoreAttrs name(String value)= attr("name", value).
  1533 +public define CoreAttrs value(String value)= attr("value", value).
  1534 +
1505 1535 //-- BEGIN of <input> preset type
1506 1536  
1507 1537 /// Radio button
1508   -public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form, Bool checked) = input([attr("type","radio"), attr("name",name), attr("value",value), attr("form", form), bool_attr(checked, "checked") . attrs]).
  1538 +public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form, Bool checked) = input([type("radio"), attr("name",name), attr("value",value), attr("form", form), bool_attr(checked, "checked") . attrs]).
1509 1539 public define HTML_Off_Form radio(List(CoreAttrs) attrs, String name, String value, String form) = radio(attrs, name, value, form, false).
1510 1540 public define HTML_Off_Form radio(String name, String value, String form, Bool checked) = radio([], name, value, form, checked).
1511 1541 public define HTML_Off_Form radio(String name, String value, String form) = radio([], name, value, form, false).
1512 1542  
1513 1543 /// hidden value
1514   -public define HTML_Off_Form hidden(List(CoreAttrs) attrs, String name, String value, String form) = input([attr("type","hidden"), attr("name",name), attr("value",value), attr("form", form) . attrs]).
  1544 +public define HTML_Off_Form hidden(List(CoreAttrs) attrs, String name, String value, String form) = input([type("hidden"), attr("name",name), attr("value",value), attr("form", form) . attrs]).
1515 1545 public define HTML_Off_Form hidden(CoreAttrs attr, String name, String value, String form) = hidden([attr], name, value, form).
1516 1546 public define HTML_Off_Form hidden(String name, String value, String form) = hidden([], name, value, form).
1517   -public define HTML_Off_Form hidden(String name, String value) = input([attr("type","hidden"), attr("name",name), attr("value",value)]).
  1547 +public define HTML_Off_Form hidden(String _name, String _value) = input([type("hidden"), name(_name), value(_value)]).
1518 1548  
1519 1549 //-- END of <input> preset type
1520 1550  
... ... @@ -1602,11 +1632,14 @@ public define HTML_Off_Form pre(List(CoreAttrs) attrs, String string)
1602 1632 // <progress>
1603 1633 public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, List(HTML_Off_Form) content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], content).
1604 1634 public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [content]).
1605   -public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) , _attr], [content]).
  1635 +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max) , _attr], [content]).
1606 1636 public define HTML_Off_Form progress(Int value, Int max, HTML_Off_Form content) = html_tag("progress", [attr("value", value), attr("max", max)], [content]).
1607 1637 public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], [text(content)]).
1608   -public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max), _attr], [text(content)]).
  1638 +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max), _attr], [text(content)]).
  1639 +public define HTML_Off_Form progress(List(CoreAttrs) attrs, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max) . attrs], []).
  1640 +public define HTML_Off_Form progress(CoreAttrs _attr, Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max), _attr], []).
1609 1641 public define HTML_Off_Form progress(Int value, Int max, String content) = html_tag("progress", [attr("value", value), attr("max", max)], [text(content)]).
  1642 +public define HTML_Off_Form progress(Int value, Int max) = html_tag("progress", [attr("value", value), attr("max", max)], []).
1610 1643  
1611 1644  
1612 1645 // <section>
... ... @@ -1634,6 +1667,8 @@ public define HTML_Off_Form span(Int i)
1634 1667 public define HTML_Off_Form span(List(CoreAttrs) attrs, String s) = html_tag("span", attrs, [text(s)]).
1635 1668 public define HTML_Off_Form span(CoreAttrs attr, String s) = html_tag("span", [attr],[text(s)]).
1636 1669 public define HTML_Off_Form span(String s) = html_tag("span", [], [text(s)]).
  1670 +public define HTML_Off_Form span(List(CoreAttrs) attrs) = html_tag("span", attrs, []).
  1671 +public define HTML_Off_Form span(CoreAttrs attr) = html_tag("span", [attr],[]).
1637 1672  
1638 1673 // <strong>
1639 1674 public define HTML_Off_Form strong(List(CoreAttrs) attrs, List(HTML_Off_Form) content) = html_tag("strong", attrs, content).
... ...
web/web_arg_utils.anubis
... ... @@ -141,9 +141,12 @@ public define Maybe(DB_id)
141 141 {
142 142 not_found then failure,
143 143 found(value) then
  144 + println("get_mb_DB_id value '"+value+"'");
144 145 //Check if value is none which means no id provided
145 146 if value="none" then
146 147 success(none)
  148 + else if value = "" then
  149 + success(none)
147 150 else
148 151 //Now try to convert the string into Int to get the id
149 152 if decimal_scan(value) is
... ...