diff --git a/app/controllers/public/account_controller.rb b/app/controllers/public/account_controller.rb index 25d15f8..ac9428a 100644 --- a/app/controllers/public/account_controller.rb +++ b/app/controllers/public/account_controller.rb @@ -67,7 +67,7 @@ class AccountController < ApplicationController def custom_fields_for_template custom_fields ||= environment.people.templates.find(params[:template_id]).custom_fields.map { |k,v| - { :name => k, :label => v[:label] } if v['signup'] + { :name => k, :title => v[:title] } if v['signup'] }.compact render :text => {:ok => true, :custom_fields => custom_fields}.to_json end diff --git a/app/models/profile.rb b/app/models/profile.rb index 54c67d4..66e92dc 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -25,8 +25,26 @@ class Profile < ActiveRecord::Base settings_items :custom_fields, :default => {} - def custom_field_value(key) - self.custom_fields[key] + def custom_field_value(field) + self.custom_fields[field][:value] + end + + def custom_field_title(field) + if !self.custom_fields.blank? + self.custom_fields[field][:title] + else + '' + end + end + + def custom_fields_template + fields = {} + fields = self.template.custom_fields unless self.template.blank? + fields + end + + def custom_fields_template_title(field) + self.template.custom_fields[field][:title] end def self.default_search_display diff --git a/app/views/account/_signup_form.html.erb b/app/views/account/_signup_form.html.erb index dd6c426..e435eb8 100644 --- a/app/views/account/_signup_form.html.erb +++ b/app/views/account/_signup_form.html.erb @@ -124,7 +124,7 @@ ''; html = html.replace( /{#CUSTOM_FIELD_ID#}/g, field.name ); - html = html.replace( /{#CUSTOM_FIELD_NAME#}/g, field.label ); + html = html.replace( /{#CUSTOM_FIELD_NAME#}/g, field.title ); jQuery('div#signup-form-profile').append(html); }); }; diff --git a/app/views/profile_editor/_person_form.html.erb b/app/views/profile_editor/_person_form.html.erb index a503623..291416e 100644 --- a/app/views/profile_editor/_person_form.html.erb +++ b/app/views/profile_editor/_person_form.html.erb @@ -82,13 +82,13 @@