Commit adc5c4e7cb5b80a7fb0882265aa8b369eab2020c
1 parent
a24518ab
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
fixes
Showing
3 changed files
with
9 additions
and
23 deletions
Show diff stats
app/helpers/profile_helper.rb
... | ... | @@ -45,22 +45,16 @@ module ProfileHelper |
45 | 45 | return |
46 | 46 | end |
47 | 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 | 49 | end |
57 | 50 | |
58 | 51 | def display_custom_fields(profile) |
59 | 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 | 58 | end |
65 | 59 | |
66 | 60 | end | ... | ... |
app/views/account/_signup_form.html.erb
... | ... | @@ -117,8 +117,7 @@ |
117 | 117 | data.custom_fields.each(function(field) { |
118 | 118 | html = '<div class="formfieldline">' + |
119 | 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 | 121 | '<div class="formfield type-text">' + |
123 | 122 | '<input type="text" name="profile_data[custom_fields][{#CUSTOM_FIELD_ID#}][value]" id="profile_data_custom_fields_{#CUSTOM_FIELD_ID#}_value" />' + |
124 | 123 | '</div>' + | ... | ... |
app/views/profile_editor/_person_form.html.erb
... | ... | @@ -77,8 +77,7 @@ |
77 | 77 | |
78 | 78 | <table border="0" style="display: none;"> |
79 | 79 | <tr> |
80 | - <th><%= _('Field name') %></th> | |
81 | - <th><%= _('Required') %></th> | |
80 | + <th align="left"><%= _('Field name') %></th> | |
82 | 81 | <th><%= _('Display on signup?') %></th> |
83 | 82 | <th> </th> |
84 | 83 | </tr> |
... | ... | @@ -89,9 +88,6 @@ |
89 | 88 | <%= text_field_tag( "profile_data[custom_fields][#{key}][label]", value[:label], :style => "display:block") %> |
90 | 89 | </td> |
91 | 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 | 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 | 92 | </td> |
97 | 93 | <td align="center"> |
... | ... | @@ -122,14 +118,11 @@ |
122 | 118 | <div class="formfieldline"> |
123 | 119 | |
124 | 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 | 122 | </span> |
131 | 123 | |
132 | 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 | 126 | <% valor = @person.custom_fields[key] ? @person.custom_fields[key][:value] : "" %> |
134 | 127 | <%= text_field_tag( "profile_data[custom_fields][#{key}][value]", valor, :size => 30 ) %> |
135 | 128 | </div> | ... | ... |