diff options
author | kushalpandya <kushal@gitlab.com> | 2017-05-25 11:46:52 +0300 |
---|---|---|
committer | Jarka Kadlecova <jarka@gitlab.com> | 2017-06-01 08:47:15 +0300 |
commit | 338a73ec03ceb2b61a824aebe4437a52b56f0f03 (patch) | |
tree | 43d2f625ec3ef52eb6cfdebd95d705ab128e3262 /app/views/shared | |
parent | 33d82ccb453ef020d28f1307be1a3a97130c9e0b (diff) |
Add support for required input validation
Diffstat (limited to 'app/views/shared')
-rw-r--r-- | app/views/shared/_field.html.haml | 6 |
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 |