Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module PropertiesHelper
- def property_form_javascript
- html = '
- $("#property_kind").change(function(){
- var id = parseInt(this.value)
- var html = ""
- for(var i=0 ; i<categories[id].length ; i++)
- html += "<option value=\"" + categories[id][i].id + "\">" + categories[id][i].name + "</option>\n"
- $("#property_category_id").html(html)
- })
- var categories = []
- '
- Property::KINDS.each_pair do |name, id|
- categories = Category.find_all_by_kind(id, :order => 'name asc').map { |c|
- "{id: #{c.id}, name: '#{c.name}'}"
- }.join(", ")
- html << "categories[#{id}] = [#{categories}];\n"
- end
- html
- end
- end
Add Comment
Please, Sign In to add comment