diff --git a/app/controllers/registrar/contacts_controller.rb b/app/controllers/registrar/contacts_controller.rb index 85a1adce5..756495457 100644 --- a/app/controllers/registrar/contacts_controller.rb +++ b/app/controllers/registrar/contacts_controller.rb @@ -83,7 +83,7 @@ class Registrar def update authorize! :edit, Depp::Contact - @contact = Depp::Contact.find_by_id(contact_params[:id]) + @contact = Depp::Contact.new(contact_params) if @contact.update_attributes(contact_params) redirect_to registrar_contact_url(@contact.id) diff --git a/app/views/registrar/contacts/form/_general.haml b/app/views/registrar/contacts/form/_general.haml index d7fcea38a..77443903d 100644 --- a/app/views/registrar/contacts/form/_general.haml +++ b/app/views/registrar/contacts/form/_general.haml @@ -15,9 +15,7 @@ = f.label :ident_country_code, t(:country) + '*' .col-md-7 - if ident_complete && @contact.persisted? && f.object.ident_country_code.present? - .disabled-value - = Country.new(f.object.ident_country_code).try(:to_s) - = " [#{f.object.ident_country_code}]" + = f.text_field :ident_country_code, value: f.object.ident_country_code, :readonly => true - else = f.select(:ident_country_code, ApplicationController.helpers.all_country_options(country_selected), {}, class: 'js-ident-country-code', required: true) @@ -27,9 +25,7 @@ = f.label :ident_type, t(:type) + '*' .col-md-7 - if ident_complete && @contact.persisted? && f.object.ident_type.present? - .disabled-value - = Depp::Contact.type_string(f.object.ident_type) - = " [#{f.object.ident_type}]" + = f.text_field :ident_type, value: f.object.ident_type, :readonly => true - else = f.select(:ident_type, Depp::Contact::SELECTION_TYPES, { selected: type_selected }, class: 'js-ident-type', required: true) @@ -39,8 +35,7 @@ = f.label :ident, t(:ident) + '*' .col-md-7 - if ident_complete && @contact.persisted? && f.object.ident.present? - .disabled-value - = f.object.ident + = f.text_field :ident, value: f.object.ident, :readonly => true - else = f.text_field :ident, class: 'form-control', required: true - tip_visibility = f.object.ident_type == 'birthday' ? '' : 'display: none'