[noosfero/noosfero][master] manage_field: fix Javascript

Antonio Terceiro gitlab at gitlab.com
Wed Apr 15 12:36:56 BRT 2015


Antonio Terceiro pushed to master at Noosfero / noosfero


Commits:
9082d6c1 by Antonio Terceiro at 2015-04-15T12:33:16Z
manage_field: fix Javascript

I am pretty sure that those calls to .first() an .last() on Javascript
arrays never worked at all.

- - - - -


2 changed files:

- app/views/features/manage_fields.html.erb
- public/javascripts/manage-fields.js


Changes:

=====================================
app/views/features/manage_fields.html.erb
=====================================
--- a/app/views/features/manage_fields.html.erb
+++ b/app/views/features/manage_fields.html.erb
@@ -1,5 +1,7 @@
 <h1><%= _('Manage fields displayed for profiles') %></h1>
 
+<%= javascript_include_tag "manage-fields.js" %>
+
 <% tabs = [] %>
 <% tabs << {:title => _("Person's fields"), :id => 'person-fields',
   :content => (render :partial => 'manage_person_fields')} %>
@@ -11,5 +13,3 @@
 <% end %>
 
 <%= render_tabs(tabs) %>
-
-<%= javascript_include_tag "manage-fields.js" %>

=====================================
public/javascripts/manage-fields.js
=====================================
--- a/public/javascripts/manage-fields.js
+++ b/public/javascripts/manage-fields.js
@@ -57,7 +57,7 @@ jQuery(document).ready(function(){
       }
 
       var checkbox = jQuery(checkboxes[i+3]).attr("id").split("_")
-      jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", allchecked)
+      jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", allchecked)
     }
   }
 
@@ -74,10 +74,10 @@ jQuery(document).ready(function(){
 
   jQuery("input[type='checkbox']").click(function (){
     var checkbox = jQuery(this).attr("id").split("_")
-    verify_checked(checkbox.first())
+    verify_checked(checkbox[0])
 
     if(this.checked == false) {
-      jQuery("#" + checkbox.first() + "_" + checkbox.last()).attr("checked", false)
+      jQuery("#" + checkbox[0] + "_" + checkbox[checkbox.length-1]).attr("checked", false)
     }
   })
 })


View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/9082d6c16a222374caa57f987e0af3faab52d26d
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150415/9c13cb8b/attachment.html>


More information about the Noosfero-dev mailing list