Commit 45ee3e3015d09ecc8e99cd57df4828e38ddbb154

Authored by Victor Costa
2 parents 1a7d7edd 4cd10145

Merge branch 'rails3-custom_fields' into stable

Conflicts:
	app/helpers/application_helper.rb
app/helpers/application_helper.rb
... ... @@ -1338,8 +1338,8 @@ module ApplicationHelper
1338 1338 content_tag('div', custom_fields)
1339 1339 end
1340 1340 else
1341   - radios = templates.map do |template|
1342   - content_tag('li', labelled_radio_button(link_to(template.name, template.url, :target => '_blank'), "#{field_name}[template_id]", template.id, environment.is_default_template?(template)))
  1341 + radios = templates.map do |template|
  1342 + content_tag('li', labelled_radio_button(link_to(template.name, template.url, :target => '_blank'), "#{field_name}[template_id]", template.id, environment.is_default_template?(template), :onchange => 'show_fields_for_template(this);'))
1343 1343 end.join("\n")
1344 1344  
1345 1345 content_tag('div', content_tag('label', _('Profile organization'), :for => 'template-options', :class => 'formlabel') +
... ...
public/javascripts/manage-custom-fields.js
... ... @@ -73,7 +73,7 @@ function add_new_field() {
73 73  
74 74 function show_fields_for_template(element) {
75 75 jQuery('div#signup-form-custom-fields div.formfieldline').remove();
76   - var selected_template = element.options[element.selectedIndex].value;
  76 + var selected_template = jQuery(element).attr('value');
77 77 jQuery.ajax({
78 78 type: "GET",
79 79 url: "/account/custom_fields_for_template",
... ... @@ -99,3 +99,6 @@ function show_fields_for_template(element) {
99 99 });
100 100 }
101 101  
  102 +jQuery(document).ready(function($) {
  103 + show_fields_for_template($('#template-options input[type=radio]:checked'));
  104 +});
... ...