Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <%= error_messages_for 'category' %>
- <!--[form:category] Jowy
- <p><label for="category_name">Name</label><br/>
- <%= text_field 'category', 'name' %></p>
- <p><label for="category_parent_id">Parent Category</label><br/>
- <%= render :partial => 'category_select', :locals => {:id => "category_parent_id"} %></p>
- <div id="box"></div>
- <%= javascript_tag("$('category_parent_id').onchange = function(){"+remote_function(:update => :box,:url => {:action => :root_change}, :with => "'id='+$F('category_parent_id')")+"}") %>
- <!--[eoform:category]-->
- <!--[form:photo]-->
- -----------------------------------------------------------------------------------------------------
- ** from _category_select.rhtml partial **
- <%= collection_select(:category, :parent_id,
- @all_categories, :id, :name,{},{:size => 5, :multiple => "multiple", :id => id, :name => id}) %>
- <%= javascript_tag("$('"+id+"').onchange = function(){" + remote_function(
- :url => {:action => :category_text_field },
- :with => "'id='+ $F('"+id+"')")+"}") %>
- ** from categories_controller **
- def category_text_field
- @cat = Category.find(params[:id])
- @all_categories = @cat.children
- render :update do |page|
- page.insert_html :bottom, 'box', render(:partial => "category_select", :locals => {:id => "category[selected_#{@cat.id}]"})
- end
- end
Add Comment
Please, Sign In to add comment