diff options
author | Ioannis Kappas <ikappas@devworks.gr> | 2015-04-02 11:18:42 +0300 |
---|---|---|
committer | Ioannis Kappas <ikappas@devworks.gr> | 2015-04-22 20:04:03 +0300 |
commit | 3196c52969fded4bf1cb2e2977ef5284a43ec02d (patch) | |
tree | 8688886ca0482a60374f815bc397863a87d2ac95 /app/views/shared/_field.html.haml | |
parent | 0e0325ee993eee2e9aac04186c46a0fde1d726a3 (diff) |
added fieldset support to project and admin services views.
split field logic to separate template.
Diffstat (limited to 'app/views/shared/_field.html.haml')
-rw-r--r-- | app/views/shared/_field.html.haml | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/views/shared/_field.html.haml b/app/views/shared/_field.html.haml new file mode 100644 index 00000000000..30d37dceb30 --- /dev/null +++ b/app/views/shared/_field.html.haml @@ -0,0 +1,24 @@ +- name = field[:name] +- title = field[:title] || name.humanize +- value = service_field_value(field[:type], @service.send(name)) +- type = field[:type] +- placeholder = field[:placeholder] +- choices = field[:choices] +- default_choice = field[:default_choice] +- help = field[:help] + +.form-group + = form.label name, title, class: "control-label" + .col-sm-10 + - if type == 'text' + = form.text_field name, class: "form-control", placeholder: placeholder + - elsif type == 'textarea' + = form.text_area name, rows: 5, class: "form-control", placeholder: placeholder + - 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, placeholder: value, class: 'form-control' + - if help + %span.help-block= help |