summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkushalpandya <kushal@gitlab.com>2017-05-25 14:16:52 +0530
committerJarka Kadlecova <jarka@gitlab.com>2017-06-01 07:47:15 +0200
commit338a73ec03ceb2b61a824aebe4437a52b56f0f03 (patch)
tree43d2f625ec3ef52eb6cfdebd95d705ab128e3262
parent33d82ccb453ef020d28f1307be1a3a97130c9e0b (diff)
downloadgitlab-ce-338a73ec03ceb2b61a824aebe4437a52b56f0f03.tar.gz
Add support for required input validation
-rw-r--r--app/views/shared/_field.html.haml6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/views/shared/_field.html.haml b/app/views/shared/_field.html.haml
index d67e20e988d..3bda8cd5e9c 100644
--- a/app/views/shared/_field.html.haml
+++ b/app/views/shared/_field.html.haml
@@ -15,14 +15,14 @@
= form.label name, title, class: "control-label"
.col-sm-10
- if type == 'text'
- = form.text_field name, class: "form-control", placeholder: placeholder
+ = form.text_field name, class: "form-control", placeholder: placeholder, required: required
- elsif type == 'textarea'
- = form.text_area name, rows: 5, class: "form-control", placeholder: placeholder
+ = form.text_area name, rows: 5, class: "form-control", placeholder: placeholder, required: required
- elsif type == 'checkbox'
= form.check_box name
- elsif type == 'select'
= form.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
- = form.password_field name, autocomplete: "new-password", class: "form-control"
+ = form.password_field name, autocomplete: "new-password", class: "form-control", required: value.present? ? nil : :required
- if help
%span.help-block= help