Show asterisks instead of password in service edit form.

This commit is contained in:
Marin Jankovski 2015-03-12 10:10:19 -07:00
parent 5d27b23ddd
commit a1f5ae98e2
2 changed files with 12 additions and 2 deletions

View file

@ -265,4 +265,14 @@ module ProjectsHelper
"success"
end
end
def service_field_value(type, value)
return value unless type == 'password'
if value.present?
"***********"
else
nil
end
end
end

View file

@ -75,7 +75,7 @@
- @service.fields.each do |field|
- name = field[:name]
- title = field[:title] || name.humanize
- value = @service.send(name) unless field[:type] == 'password'
- value = service_field_value(field[:type], @service.send(name))
- type = field[:type]
- placeholder = field[:placeholder]
- choices = field[:choices]
@ -94,7 +94,7 @@
- elsif type == 'select'
= f.select name, options_for_select(choices, value ? value : default_choice), {}, { class: "form-control" }
- elsif type == 'password'
= f.password_field name, class: 'form-control'
= f.password_field name, placeholder: value, class: 'form-control'
- if help
%span.help-block= help