Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## school_classes_helper.rb
- def add_classes_link(name)
- link_to_function(name, nil, :id => "btn_add_class") do |page|
- page << "counter = 0"
- page.select('tr.school_class').each do |c|
- page << "counter += 1"
- end
- page << "if(counter < 9) {"
- page.insert_html :bottom, :secTable, :partial => 'school_class', :object => SchoolClass.new
- page << "if(counter==8) {"
- page.hide "btn_add_class"
- page << "}"
- page << "}"
- end
- end
- ## _school_class.html.erb
- ...
- <%= link_to_function( image_tag('buttons/btn_dest.png', :border => '0'), :id => "btn_rem" ) { |page|
- page << "$(this).up('.school_class').remove()"
- page << "counter = 0"
- page.select('tr.school_class').each { |c|
- page << "counter += 1"
- }
- page << "if(counter < 9) {"
- page.show "btn_add_class"
- page << "}"
- } %>
- ...
Add Comment
Please, Sign In to add comment