diff --git a/app/helpers/profile_helper.rb b/app/helpers/profile_helper.rb index 014968d..16b1d34 100644 --- a/app/helpers/profile_helper.rb +++ b/app/helpers/profile_helper.rb @@ -51,9 +51,10 @@ module ProfileHelper def display_custom_fields(profile) fields = [] profile.custom_fields.each { |custom_field_key,custom_field_data| - fields << display_custom_field(custom_field_data[:title], profile, custom_field_key) + if !profile.fields_privacy.blank? && profile.fields_privacy.include?(custom_field_key) + fields << display_custom_field(custom_field_data[:title], profile, custom_field_key) if profile.fields_privacy[custom_field_key] == 'public' + end } - fields.reject!(&:blank?) fields.size >= 1 ? content_tag('tr', content_tag('th', _('Custom Fields'), { :colspan => 2 })) + fields.join.html_safe : '' end diff --git a/app/views/profile_editor/_person_form.html.erb b/app/views/profile_editor/_person_form.html.erb index 39f66a9..a503623 100644 --- a/app/views/profile_editor/_person_form.html.erb +++ b/app/views/profile_editor/_person_form.html.erb @@ -114,24 +114,50 @@ <% template_custom_fields.each { |key,value| %> -
-
+ <% if @person.custom_fields.include?(key) %> - - <%= label_tag value[:label] %> - +
+
+ + + <%= label_tag value[:label] %> + + +
+ <%= hidden_field_tag "profile_data[custom_fields][#{key}[title]", @person.custom_fields[key][:title] %> + <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %> + <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %> +
+ +
+ + <%= profile_field_privacy_selector @person, key %> + +
+ + <% else %> + +
+
+ + + <%= label_tag value[:label] %> + + +
+ <%= hidden_field_tag "profile_data[custom_fields][#{key}[title]", value[:label] %> + <% valor = key ? value[:value] : "" %> + <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %> +
-
- <%= hidden_field_tag "profile_data[custom_fields][#{key}[title]", @person.custom_fields[key][:title] %> - <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %> - <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %>
+ <%= profile_field_privacy_selector @person, key %> +
- <%= profile_field_privacy_selector @person, key %> -
+ <% end %> <% } %> diff --git a/public/javascripts/manage-custom-fields.js b/public/javascripts/manage-custom-fields.js index 4da0f40..8899d43 100644 --- a/public/javascripts/manage-custom-fields.js +++ b/public/javascripts/manage-custom-fields.js @@ -61,9 +61,6 @@ function add_new_field() { '' + '' + '' + - '' + - '' + - '' + '' + '' + '' + -- libgit2 0.21.2