Commit 4cd10145af6e8cebcce9f9fc0c8e2e39ce8b64a6
1 parent
6daf9ba2
Exists in
staging
and in
4 other branches
Fix custom fields after merge with master
Showing
2 changed files
with
5 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -1327,7 +1327,7 @@ module ApplicationHelper | @@ -1327,7 +1327,7 @@ module ApplicationHelper | ||
1327 | end | 1327 | end |
1328 | else | 1328 | else |
1329 | radios = templates.map do |template| | 1329 | radios = templates.map do |template| |
1330 | - 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))) | 1330 | + 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);')) |
1331 | end.join("\n") | 1331 | end.join("\n") |
1332 | 1332 | ||
1333 | content_tag('div', content_tag('label', _('Profile organization'), :for => 'template-options', :class => 'formlabel') + | 1333 | 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,7 +73,7 @@ function add_new_field() { | ||
73 | 73 | ||
74 | function show_fields_for_template(element) { | 74 | function show_fields_for_template(element) { |
75 | jQuery('div#signup-form-custom-fields div.formfieldline').remove(); | 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 | jQuery.ajax({ | 77 | jQuery.ajax({ |
78 | type: "GET", | 78 | type: "GET", |
79 | url: "/account/custom_fields_for_template", | 79 | url: "/account/custom_fields_for_template", |
@@ -99,3 +99,6 @@ function show_fields_for_template(element) { | @@ -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 | +}); |