From b55b0cd580a5a8d8065bcbb3d5d66b58e0daf319 Mon Sep 17 00:00:00 2001 From: Francisco Marcelo de Araújo Lima Júnior Date: Fri, 29 Aug 2014 18:28:00 -0300 Subject: [PATCH] fixes --- app/views/account/_signup_form.html.erb | 1 + app/views/profile_editor/_person_form.html.erb | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------- public/javascripts/manage-custom-fields.js | 3 --- 3 files changed, 55 insertions(+), 23 deletions(-) diff --git a/app/views/account/_signup_form.html.erb b/app/views/account/_signup_form.html.erb index a926d26..6817d1e 100644 --- a/app/views/account/_signup_form.html.erb +++ b/app/views/account/_signup_form.html.erb @@ -117,6 +117,7 @@ data.custom_fields.each(function(field) { html = '
' + '' + + '' + '' + '
' + '' + diff --git a/app/views/profile_editor/_person_form.html.erb b/app/views/profile_editor/_person_form.html.erb index 7352ea8..efa82cf 100644 --- a/app/views/profile_editor/_person_form.html.erb +++ b/app/views/profile_editor/_person_form.html.erb @@ -78,7 +78,6 @@ - @@ -90,9 +89,6 @@ <%= text_field_tag( "profile_data[custom_fields][#{key}][label]", value[:label], :style => "display:block") %> - ' + '' + - '' + '
<%= _('Field name') %><%= _('Active') %> <%= _('Required') %> <%= _('Display on signup?') %>   - <%= check_box_tag "profile_data[custom_fields][#{key}][active]", value['active'], value['active'], :onclick => "active_action(this, 'profile_data[custom_fields][#{key}][required]', 'profile_data[custom_fields][#{key}][signup]')" %> - <%= check_box_tag "profile_data[custom_fields][#{key}][required]", value['required'], value['required'], :onclick => "required_action('profile_data[custom_fields][#{key}][active]','profile_data[custom_fields][#{key}][required]', 'profile_data[custom_fields][#{key}][signup]')" %> @@ -118,30 +114,68 @@ <% else %> - <% Profile.find(@person.template_id).custom_fields.each { |key,value| %> + <% template_custom_fields = Profile.find(@person.template_id).custom_fields %> + + <% @person.custom_fields.each { |key,value| %> + + <% if template_custom_fields.include?(key) || !value[:value].empty? %> - <% if value['active'] %> -
-
+ <% if value[:active] %> +
+
- - <% if value['required'] %> - <%= label_tag value[:label] + ' (*)', nil, class: 'required' %> - <% else %> - <%= label_tag value[:label] %> - <% end %> - + + <% if value[:required] %> + <%= label_tag value[:label] + ' (*)', nil, class: 'required' %> + <% else %> + <%= label_tag value[:label] %> + <% end %> + + +
+ <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %> + <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %> +
-
- <% 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 %> +
+ <% end %> + + <% end %> + + <% } %> + + <% template_custom_fields.each { |key,value| %> + + <% unless @person.custom_fields.include?(key) %> + + <% if value['active'] %> +
+
+ + + <% if value['required'] %> + <%= label_tag value[:label] + ' (*)', nil, class: 'required' %> + <% else %> + <%= label_tag value[:label] %> + <% end %> + - <%= profile_field_privacy_selector @person, key %> +
+ <% 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 %> + +
+ <% end %> -
<% end %> <% } %> diff --git a/public/javascripts/manage-custom-fields.js b/public/javascripts/manage-custom-fields.js index 24e619a..4da0f40 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