diff --git a/app/views/manage_products/_subcategories.rhtml b/app/views/manage_products/_subcategories.rhtml new file mode 100644 index 0000000..c6f58ac --- /dev/null +++ b/app/views/manage_products/_subcategories.rhtml @@ -0,0 +1,34 @@ +<% if !@current_category.nil? and !@current_category.top_level? %> + +
<%= _('Current category:') %>
+ <%= hidden_field_tag 'product[product_category_id]', @current_category.id %> + <% + categories = [@current_category] + categories.push(@current_category) while @current_category = @current_category.parent + categories.last.name = _('Back') + %> + <% if categories.size > 1 %> + <%= categories.compact.reverse.map{|i| + link_to_remote(i.name, + :update => "subcategories", + :url => { :action => 'update_subcategories', :id => i, :loaded => visual_effect(:highlight, "subcategories") }, + :class => 'select-current-category-link')}.join(' → ') + %> + <% end %> + +<% end %> + +<% if @current_category %> +<%= _('Select a category:') %>
+<% elsif !@categories.empty? %> +<%= _('Select a subcategory:') %>
+<% end %> + +<% for category in @categories do %> + <%= link_to_remote category.name, { + :update => "subcategories", + :url => { :action => "update_subcategories", :id => category.id }, + :loaded => visual_effect(:highlight, "subcategories") }, + :class => 'select-subcategory-link' + %> +<% end %> -- libgit2 0.21.2