summaryrefslogtreecommitdiff
path: root/app/views/shared/_gl_toggle.html.haml
blob: afaa6b6df92e0fb7fe9a536b674bb050b02f4a08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-# This partial renders a GlToggle root element.
-# To actually initialize the component, make sure to call the initToggle helper from ~/toggles.

- classes = local_assigns.fetch(:classes)
- name = local_assigns.fetch(:name, nil)
- is_checked = local_assigns.fetch(:is_checked, false).to_s
- disabled = local_assigns.fetch(:disabled, false).to_s
- is_loading = local_assigns.fetch(:is_loading, false).to_s
- label = local_assigns.fetch(:label, nil)
- help = local_assigns.fetch(:help, nil)
- label_position = local_assigns.fetch(:label_position, nil)
- data = local_assigns.fetch(:data, {})

%span{ class: classes,
  data: { name: name,
    is_checked: is_checked,
    disabled: disabled,
    is_loading: is_loading,
    label: label,
    help: help,
    label_position: label_position,
    **data } }

-# Leverage this block to render a rich help text. To render a plain text help text,
-# prefer the `help` parameter.
- if yield.present?
  .gl-text-secondary.gl-mt-1
    = yield