Update quickstart mixin to make it more customisable

This commit is contained in:
ines 2017-05-28 16:36:07 +02:00
parent 8a24c60c1e
commit b85d88fac6

View File

@ -93,7 +93,7 @@ mixin permalink(id)
groups - [object] option groups, uses global variable QUICKSTART
headline - [string] optional text to be rendered as widget headline
mixin quickstart(groups, headline, description)
mixin quickstart(groups, headline, description, hide_results)
.c-quickstart.o-block-small#qs
.c-quickstart__content
if headline
@ -102,21 +102,25 @@ mixin quickstart(groups, headline, description)
p=description
for group in groups
.c-quickstart__group.u-text-small(data-qs-group=group.id)
.c-quickstart__legend=group.title
if group.help
| #[+help(group.help)]
if group.title
.c-quickstart__legend=group.title
if group.help
| #[+help(group.help)]
.c-quickstart__fields
for option in group.options
input.c-quickstart__input(class="c-quickstart__input--" + (group.multiple ? "check" : "radio") type=group.multiple ? "checkbox" : "radio" name=group.id id=option.id value=option.id checked=option.checked)
label.c-quickstart__label(for=option.id)=option.title
input.c-quickstart__input(class="c-quickstart__input--" + (group.input_style ? group.input_style : group.multiple ? "check" : "radio") type=group.multiple ? "checkbox" : "radio" name=group.id id=option.id value=option.id checked=option.checked)
label.c-quickstart__label(for=option.id)!=option.title
if option.meta
| #[span.c-quickstart__label__meta (#{option.meta})]
if option.help
| #[+help(option.help)]
pre.c-code-block
code.c-code-block__content.c-quickstart__code(data-qs-results="")
block
if hide_results
block
else
pre.c-code-block
code.c-code-block__content.c-quickstart__code(data-qs-results="")
block
.c-quickstart__info.u-text-tiny.o-block.u-text-right
| Like this widget? Check out #[+a("https://github.com/ines/quickstart").u-link quickstart.js]!