Commit 45ee3e3015d09ecc8e99cd57df4828e38ddbb154
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
Merge branch 'rails3-custom_fields' into stable
Conflicts: app/helpers/application_helper.rb
Showing
2 changed files
with
6 additions
and
3 deletions
Show diff stats
app/helpers/application_helper.rb
| @@ -1338,8 +1338,8 @@ module ApplicationHelper | @@ -1338,8 +1338,8 @@ module ApplicationHelper | ||
| 1338 | content_tag('div', custom_fields) | 1338 | content_tag('div', custom_fields) |
| 1339 | end | 1339 | end |
| 1340 | else | 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 | end.join("\n") | 1343 | end.join("\n") |
| 1344 | 1344 | ||
| 1345 | content_tag('div', content_tag('label', _('Profile organization'), :for => 'template-options', :class => 'formlabel') + | 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,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 | +}); |