Guest User

Untitled

a guest
May 24th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. ## school_classes_helper.rb
  2.  
  3. def add_classes_link(name)
  4. link_to_function(name, nil, :id => "btn_add_class") do |page|
  5. page << "counter = 0"
  6. page.select('tr.school_class').each do |c|
  7. page << "counter += 1"
  8. end
  9. page << "if(counter < 9) {"
  10. page.insert_html :bottom, :secTable, :partial => 'school_class', :object => SchoolClass.new
  11. page << "if(counter==8) {"
  12. page.hide "btn_add_class"
  13. page << "}"
  14. page << "}"
  15. end
  16. end
  17.  
  18. ## _school_class.html.erb
  19.  
  20. ...
  21.  
  22. <%= link_to_function( image_tag('buttons/btn_dest.png', :border => '0'), :id => "btn_rem" ) { |page|
  23. page << "$(this).up('.school_class').remove()"
  24. page << "counter = 0"
  25. page.select('tr.school_class').each { |c|
  26. page << "counter += 1"
  27. }
  28. page << "if(counter < 9) {"
  29. page.show "btn_add_class"
  30. page << "}"
  31. } %>
  32.  
  33. ...
Add Comment
Please, Sign In to add comment