diff --git a/app/controllers/environment_admin/categories_controller.rb b/app/controllers/environment_admin/categories_controller.rb new file mode 100644 index 0000000..bf6ad00 --- /dev/null +++ b/app/controllers/environment_admin/categories_controller.rb @@ -0,0 +1,5 @@ +class CategoriesController < EnvironmentAdminController + def index + @categories = environment.top_level_categories + end +end diff --git a/app/views/categories/_category.rhtml b/app/views/categories/_category.rhtml new file mode 100644 index 0000000..3c2202d --- /dev/null +++ b/app/views/categories/_category.rhtml @@ -0,0 +1,12 @@ +
  • +<%= category.name %> +
    + <%= link_to _('Add subcategory'), :action => 'new', :parent => category %> + <%= 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) ) %> +
    +<% unless category.children.empty? %> + +<% end %> +
  • diff --git a/app/views/categories/index.rhtml b/app/views/categories/index.rhtml new file mode 100644 index 0000000..309e970 --- /dev/null +++ b/app/views/categories/index.rhtml @@ -0,0 +1,6 @@ +

    <%= _('Categories') %>

    + + + diff --git a/test/functional/categories_controller_test.rb b/test/functional/categories_controller_test.rb new file mode 100644 index 0000000..7b7a8bc --- /dev/null +++ b/test/functional/categories_controller_test.rb @@ -0,0 +1,18 @@ +require File.dirname(__FILE__) + '/../test_helper' +require 'categories_controller' + +# Re-raise errors caught by the controller. +class CategoriesController; def rescue_action(e) raise e end; end + +class CategoriesControllerTest < Test::Unit::TestCase + def setup + @controller = CategoriesController.new + @request = ActionController::TestRequest.new + @response = ActionController::TestResponse.new + end + + # Replace this with your real tests. + def test_truth + assert true + end +end -- libgit2 0.21.2