Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/shared/_gl_toggle.html.haml')
-rw-r--r--app/views/shared/_gl_toggle.html.haml28
1 files changed, 28 insertions, 0 deletions
diff --git a/app/views/shared/_gl_toggle.html.haml b/app/views/shared/_gl_toggle.html.haml
new file mode 100644
index 00000000000..afaa6b6df92
--- /dev/null
+++ b/app/views/shared/_gl_toggle.html.haml
@@ -0,0 +1,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