Commit 27983b880fdb70336ed1fb0623b5cbb9654fb29d
1 parent
cb266362
Exists in
staging
and in
42 other branches
ActionItem498: oops! add view _subcategories.rhtml
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2270 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
1 changed file
with
34 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,34 @@ |
| 1 | +<% if !@current_category.nil? and !@current_category.top_level? %> | |
| 2 | + | |
| 3 | + <p><%= _('Current category:') %></p> | |
| 4 | + <%= hidden_field_tag 'product[product_category_id]', @current_category.id %> | |
| 5 | + <% | |
| 6 | + categories = [@current_category] | |
| 7 | + categories.push(@current_category) while @current_category = @current_category.parent | |
| 8 | + categories.last.name = _('Back') | |
| 9 | + %> | |
| 10 | + <% if categories.size > 1 %> | |
| 11 | + <%= categories.compact.reverse.map{|i| | |
| 12 | + link_to_remote(i.name, | |
| 13 | + :update => "subcategories", | |
| 14 | + :url => { :action => 'update_subcategories', :id => i, :loaded => visual_effect(:highlight, "subcategories") }, | |
| 15 | + :class => 'select-current-category-link')}.join(' → ') | |
| 16 | + %> | |
| 17 | + <% end %> | |
| 18 | + | |
| 19 | +<% end %> | |
| 20 | + | |
| 21 | +<% if @current_category %> | |
| 22 | + <p><%= _('Select a category:') %></p> | |
| 23 | +<% elsif !@categories.empty? %> | |
| 24 | + <p><%= _('Select a subcategory:') %></p> | |
| 25 | +<% end %> | |
| 26 | + | |
| 27 | +<% for category in @categories do %> | |
| 28 | + <%= link_to_remote category.name, { | |
| 29 | + :update => "subcategories", | |
| 30 | + :url => { :action => "update_subcategories", :id => category.id }, | |
| 31 | + :loaded => visual_effect(:highlight, "subcategories") }, | |
| 32 | + :class => 'select-subcategory-link' | |
| 33 | + %> | |
| 34 | +<% end %> | ... | ... |