2017-09-26 12:50:09 +00:00
{ { block switch ( id , name , value , label , checked , disabled = false ) } }
< input id = "{{id ? id : (value ? name + " - " + value : name)}}" name = "{{name}}" { { if value } } value = "{{value}}" { { end } } type = "checkbox" class = "switch is-success is-rounded" { { if ( value && checked == value ) || checked } } checked { { end } } { { if disabled } } disabled { { end } } >
< label for = "{{id ? id : (value ? name + " - " + value: name)}}" > { { label } } < / label >
{ { end } }
{ { block checkbox ( id , name , value , label , checked , disabled = false ) } }
2017-12-28 10:06:06 +00:00
< input id = "{{id ? id : (name + " - " + value)}}" { { if name } } name = "{{name}}[]" { { end } } { { if value } } value = "{{value}}" { { end } } type = "checkbox" class = "is-checkradio" { { if checked } } checked { { end } } { { if disabled } } disabled { { end } } { { yield content } } >
2017-09-26 12:50:09 +00:00
< label for = "{{id ? id : (name + " - " + value)}}" > { { label } } < / label >
{ { end } }
{ { block radio ( id , name , value , label , checked , disabled = false ) } }
2017-12-28 10:06:06 +00:00
< input id = "{{id ? id : (name + " - " + value)}}" name = "{{name}}" value = "{{value}}" type = "radio" class = "is-checkradio" { { if eq ( checked , value ) } } checked { { end } } { { if disabled } } disabled { { end } } { { yield content } } >
2017-09-26 12:50:09 +00:00
< label for = "{{id ? id : (name + " - " + value)}}" > { { label } } < / label >
{ { end } }
2018-04-17 03:20:51 +00:00
{ { block radios ( name , values , labels , checked ) } }
{ { labels = choose ( labels , values ) } }
2017-09-26 12:50:09 +00:00
{ { range i , v := values } }
2017-12-28 10:06:06 +00:00
< input id = "{{ name + " - " + v }}" name = "{{name}}" value = "{{v}}" type = "radio" class = "is-checkradio" { { if eq ( checked , v ) } } checked { { end } } >
2017-09-26 12:50:09 +00:00
< label for = "{{ name + " - " + v }}" > { { labels [ i ] } } < / label >
{ { end } }
{ { end } }
2018-04-17 03:20:51 +00:00
{ { block select ( name , values , labels , selected , dt ) } }
{ { labels = choose ( labels , values ) } }
2017-09-26 12:50:09 +00:00
< select name = "{{name}}" { { if dt } } data - type = "{{dt}}" { { end } } >
{ { range i , v := values } }
< option value = "{{ v }}" { { if eq ( selected , v ) } } selected { { end } } > { { labels [ i ] } } < / option >
{ { end } }
< / select >
{ { end } }
{ { block option ( value , label = "" , selected ) } }
< option value = "{{ value }}" { { if eq ( value , selected ) } } selected { { end } } > { { label == "" ? value : label } } < / option >
{ { end } }
{ { block options ( name , items ) } }
{ { n := replace ( name , "." , "-" , - 1 ) } }
< table id = "table-{{n}}s" class = "table is-bordered is-striped is-narrow is-marginless is-fullwidth" data - name = "{{name}}" >
< thead >
< tr >
2017-10-12 09:30:21 +00:00
< th > { { i18n ( "field.name" ) } } < / th >
< th > { { i18n ( "field.value" ) } } < / th >
2017-09-26 12:50:09 +00:00
< th width = "48" >
< a class = "button is-small is-success is-outlined" data - action = "add-{{n}}" >
< span class = "icon is-small" >
2018-01-26 05:10:38 +00:00
< i class = "fas fa-plus" > < / i >
2017-09-26 12:50:09 +00:00
< / span >
< / a >
< / th >
< / tr >
< / thead >
< tbody >
{ { if items } }
{ { i := 0 } }
2017-10-20 08:41:22 +00:00
{ { range k , v := items } }
2017-09-26 12:50:09 +00:00
< tr >
< td >
2017-10-20 08:41:22 +00:00
< input name = "{{name}}s[{{i}}].name" class = "input is-small" type = "text" value = "{{k}}" >
2017-09-26 12:50:09 +00:00
< / td >
< td >
< input name = "{{name}}s[{{i}}].value" class = "input is-small" type = "text" value = "{{v}}" >
< / td >
< td >
< a class = "button is-small is-danger is-outlined" data - action = "delete-{{n}}" >
< span class = "icon is-small" >
2018-04-10 09:37:44 +00:00
< i class = "far fa-trash-alt" > < / i >
2017-09-26 12:50:09 +00:00
< / span >
< / a >
< / td >
< / tr >
{ { i = i + 1 } }
{ { end } }
{ { end } }
< / tbody >
< / table >
{ { end } }
{ { block options_table ( name , items ) } }
{ { n := replace ( name , "." , "-" , - 1 ) } }
< table id = "table-{{n}}s" class = "table is-bordered is-striped is-narrow is-marginless is-fullwidth" data - name = "{{name}}" >
< thead >
< tr >
2017-10-12 09:30:21 +00:00
< th > { { i18n ( "field.name" ) } } < / th >
< th > { { i18n ( "field.value" ) } } < / th >
2017-09-26 12:50:09 +00:00
< th width = "48" >
< a class = "button is-small is-success is-outlined" data - action = "add-{{n}}" >
< span class = "icon is-small" >
2018-01-26 05:10:38 +00:00
< i class = "fas fa-plus" > < / i >
2017-09-26 12:50:09 +00:00
< / span >
< / a >
< / th >
< / tr >
< / thead >
< tbody >
{ { if items } }
{ { range i , opt := items } }
< tr >
< td >
< input name = "{{name}}s[{{i}}].name" class = "input is-small" type = "text" value = "{{opt.Name}}" >
< / td >
< td >
< input name = "{{name}}s[{{i}}].value" class = "input is-small" type = "text" value = "{{opt.Value}}" >
< / td >
< td >
< a class = "button is-small is-danger is-outlined" data - action = "delete-{{n}}" >
< span class = "icon is-small" >
2018-04-10 09:37:44 +00:00
< i class = "far fa-trash-alt" > < / i >
2017-09-26 12:50:09 +00:00
< / span >
< / a >
< / td >
< / tr >
{ { end } }
{ { end } }
< / tbody >
< / table >
2017-10-09 13:02:41 +00:00
{ { end } }
{ { block form_submit ( url ) } }
< div class = "field is-grouped" >
< div class = "control" >
2017-10-12 09:30:21 +00:00
< button type = "submit" class = "button is-primary" > { { i18n ( "button.submit" ) } } < / button >
2017-10-09 13:02:41 +00:00
< / div >
< div class = "control" >
2017-10-12 09:30:21 +00:00
< a href = "{{ url }}" class = "button is-link" > { { i18n ( "button.cancel" ) } } < / a >
2017-10-09 13:02:41 +00:00
< / div >
< / div >
{ { end } }