Commit adc5c4e7cb5b80a7fb0882265aa8b369eab2020c

Authored by Francisco Marcelo de Araújo Lima Júnior
1 parent a24518ab

fixes

app/helpers/profile_helper.rb
@@ -45,22 +45,16 @@ module ProfileHelper @@ -45,22 +45,16 @@ module ProfileHelper
45 return 45 return
46 end 46 end
47 value = profile.custom_fields[field][:value] 47 value = profile.custom_fields[field][:value]
48 - if !value.blank?  
49 - if block_given?  
50 - value = yield(value)  
51 - end  
52 - content_tag('tr', content_tag('td', title, :class => 'field-name') + content_tag('td', value))  
53 - else  
54 - ''  
55 - end 48 + !value.blank? ? content_tag('tr', content_tag('td', title) + content_tag('td', value)) : ''
56 end 49 end
57 50
58 def display_custom_fields(profile) 51 def display_custom_fields(profile)
59 fields = [] 52 fields = []
60 - profile.custom_fields.each { |key,value|  
61 - fields << display_custom_field(value[:label], profile, key) 53 + profile.custom_fields.each { |custom_field_key,custom_field_data|
  54 + fields << display_custom_field(custom_field_data[:title], profile, custom_field_key)
62 } 55 }
63 - content_tag('tr', content_tag('th', _('Custom Fields'), { :colspan => 2 })) + fields.join.html_safe 56 + fields.reject!(&:blank?)
  57 + fields.size >= 1 ? content_tag('tr', content_tag('th', _('Custom Fields'), { :colspan => 2 })) + fields.join.html_safe : ''
64 end 58 end
65 59
66 end 60 end
app/views/account/_signup_form.html.erb
@@ -117,8 +117,7 @@ @@ -117,8 +117,7 @@
117 data.custom_fields.each(function(field) { 117 data.custom_fields.each(function(field) {
118 html = '<div class="formfieldline">' + 118 html = '<div class="formfieldline">' +
119 '<label class="formlabel" for="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}">{#CUSTOM_FIELD_NAME#}</label>' + 119 '<label class="formlabel" for="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}">{#CUSTOM_FIELD_NAME#}</label>' +
120 - '<input type="hidden" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}[required]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_required" value="on" />' +  
121 - '<input type="hidden" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}][label]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_label" value="{#CUSTOM_FIELD_NAME#}" />' + 120 + '<input type="hidden" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}][title]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_title" value="{#CUSTOM_FIELD_NAME#}" />' +
122 '<div class="formfield type-text">' + 121 '<div class="formfield type-text">' +
123 '<input type="text" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}][value]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_value" />' + 122 '<input type="text" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}][value]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_value" />' +
124 '</div>' + 123 '</div>' +
app/views/profile_editor/_person_form.html.erb
@@ -77,8 +77,7 @@ @@ -77,8 +77,7 @@
77 77
78 <table border="0" style="display: none;"> 78 <table border="0" style="display: none;">
79 <tr> 79 <tr>
80 - <th><%= _('Field name') %></th>  
81 - <th><%= _('Required') %></th> 80 + <th align="left"><%= _('Field name') %></th>
82 <th><%= _('Display on signup?') %></th> 81 <th><%= _('Display on signup?') %></th>
83 <th>&nbsp;</th> 82 <th>&nbsp;</th>
84 </tr> 83 </tr>
@@ -89,9 +88,6 @@ @@ -89,9 +88,6 @@
89 <%= text_field_tag( "profile_data[custom_fields][#{key}][label]", value[:label], :style => "display:block") %> 88 <%= text_field_tag( "profile_data[custom_fields][#{key}][label]", value[:label], :style => "display:block") %>
90 </td> 89 </td>
91 <td align="center"> 90 <td align="center">
92 - <%= 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]')" %>  
93 - </td>  
94 - <td align="center">  
95 <%= check_box_tag "profile_data[custom_fields][#{key}][signup]", value['signup'], value['signup'], :onclick => "signup_action('profile_data[custom_fields][#{key}][active]','profile_data[custom_fields][#{key}][required]', 'profile_data[custom_fields][#{key}][signup]')" %> 91 <%= check_box_tag "profile_data[custom_fields][#{key}][signup]", value['signup'], value['signup'], :onclick => "signup_action('profile_data[custom_fields][#{key}][active]','profile_data[custom_fields][#{key}][required]', 'profile_data[custom_fields][#{key}][signup]')" %>
96 </td> 92 </td>
97 <td align="center"> 93 <td align="center">
@@ -122,14 +118,11 @@ @@ -122,14 +118,11 @@
122 <div class="formfieldline"> 118 <div class="formfieldline">
123 119
124 <span style="display: block;"> 120 <span style="display: block;">
125 - <% if value[:required] %>  
126 - <%= label_tag value[:label] + ' (*)', nil, class: 'required' %>  
127 - <% else %>  
128 - <%= label_tag value[:label] %>  
129 - <% end %> 121 + <%= label_tag value[:label] %>
130 </span> 122 </span>
131 123
132 <div class="formfield type-text" style="display: inline-block;"> 124 <div class="formfield type-text" style="display: inline-block;">
  125 + <%= hidden_field_tag "profile_data[custom_fields][#{key}[title]", @person.custom_fields[key][:title] %>
133 <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %> 126 <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %>
134 <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %> 127 <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %>
135 </div> 128 </div>