Commit 9082d6c16a222374caa57f987e0af3faab52d26d

Authored by Antonio Terceiro
1 parent c5339c76

manage_field: fix Javascript

I am pretty sure that those calls to .first() an .last() on Javascript
arrays never worked at all.
app/views/features/manage_fields.html.erb
1 <h1><%= _('Manage fields displayed for profiles') %></h1> 1 <h1><%= _('Manage fields displayed for profiles') %></h1>
2 2
  3 +<%= javascript_include_tag "manage-fields.js" %>
  4 +
3 <% tabs = [] %> 5 <% tabs = [] %>
4 <% tabs << {:title => _("Person's fields"), :id => 'person-fields', 6 <% tabs << {:title => _("Person's fields"), :id => 'person-fields',
5 :content => (render :partial => 'manage_person_fields')} %> 7 :content => (render :partial => 'manage_person_fields')} %>
@@ -11,5 +13,3 @@ @@ -11,5 +13,3 @@
11 <% end %> 13 <% end %>
12 14
13 <%= render_tabs(tabs) %> 15 <%= render_tabs(tabs) %>
14 -  
15 -<%= javascript_include_tag "manage-fields.js" %>  
public/javascripts/manage-fields.js
@@ -57,7 +57,7 @@ jQuery(document).ready(function(){ @@ -57,7 +57,7 @@ jQuery(document).ready(function(){
57 } 57 }
58 58
59 var checkbox = jQuery(checkboxes[i+3]).attr("id").split("_") 59 var checkbox = jQuery(checkboxes[i+3]).attr("id").split("_")
60 - jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", allchecked) 60 + jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", allchecked)
61 } 61 }
62 } 62 }
63 63
@@ -74,10 +74,10 @@ jQuery(document).ready(function(){ @@ -74,10 +74,10 @@ jQuery(document).ready(function(){
74 74
75 jQuery("input[type='checkbox']").click(function (){ 75 jQuery("input[type='checkbox']").click(function (){
76 var checkbox = jQuery(this).attr("id").split("_") 76 var checkbox = jQuery(this).attr("id").split("_")
77 - verify_checked(checkbox.first()) 77 + verify_checked(checkbox[0])
78 78
79 if(this.checked == false) { 79 if(this.checked == false) {
80 - jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", false) 80 + jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", false)
81 } 81 }
82 }) 82 })
83 }) 83 })