Commit 3f2d9656ceb288d4d98902aef4e1e413c142fb61

Authored by AntonioTerceiro
1 parent 7ebe26c3

ActionItem70: skeleton for categories management



git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@524 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/environment_admin/categories_controller.rb 0 → 100644
@@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
  1 +class CategoriesController < EnvironmentAdminController
  2 + def index
  3 + @categories = environment.top_level_categories
  4 + end
  5 +end
app/views/categories/_category.rhtml 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +<li>
  2 +<%= category.name %>
  3 +<div>
  4 + <%= link_to _('Add subcategory'), :action => 'new', :parent => category %>
  5 + <%= link_to _('Remove'), { :action => 'remove', :id => category, }, :post => true, :confirm => (category.children.empty? ? (_('Are you sure you want to remove "%s"?') % category.name) : (_('Are you sure you want to remove "%s" and all its subcategories?') % category.name) ) %>
  6 +</div>
  7 +<% unless category.children.empty? %>
  8 + <ul>
  9 + <%= render :partial => 'category', :collection => category.children %>
  10 + </ul>
  11 +<% end %>
  12 +</li>
app/views/categories/index.rhtml 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +<h1><%= _('Categories') %></h1>
  2 +
  3 +<ul>
  4 + <%= render :partial => 'category', :collection => @categories %>
  5 +</ul>
  6 +
test/functional/categories_controller_test.rb 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +require 'categories_controller'
  3 +
  4 +# Re-raise errors caught by the controller.
  5 +class CategoriesController; def rescue_action(e) raise e end; end
  6 +
  7 +class CategoriesControllerTest < Test::Unit::TestCase
  8 + def setup
  9 + @controller = CategoriesController.new
  10 + @request = ActionController::TestRequest.new
  11 + @response = ActionController::TestResponse.new
  12 + end
  13 +
  14 + # Replace this with your real tests.
  15 + def test_truth
  16 + assert true
  17 + end
  18 +end