cirandas.net

ref: master

app/views/shared/_select_categories.html.erb


<% extend CategoriesHelper %>

<%= _('Select a category and click on the Add button') %>
<% if !@current_category.nil? %> <%= hidden_field_tag "#{object_name}[#{object_name}_category_id]", @current_category.id unless multiple %> <%= hidden_field_tag "#{object_name}[category_ids][]", @current_category.id if multiple %> <%= link_to '', { :action => "update_categories", :category_id => nil, :id => @object, :kind => kind }, { :remote => true, :id => 'cancel-category-button', :class => 'icon-cancel' } %> <% categories = [@current_category] categories.push(@current_category) while @current_category = @current_category.parent %> <%= categories.compact.reverse.map do |i| %> <% link_to i.name, { :action => "update_categories", :category_id => i.id, :id => @object, :kind => kind }, { :id => "select-category-#{i.id}-link", :remote => true, :class => "select-subcategory-link", 'data-id' => i.id } %> <% end.join(' → ').html_safe %> <%= button_to_function_without_text(:add, _('Add'), 'add_category()', :id => 'save-category-button') %> <% end %>
<%= render :partial => 'shared/select_subcategories', :locals => { :object_name => object_name, :categories => @categories, :kind => kind } %>