Commit 0fc7cb994ae48456132eb768774368cca7966e49

Authored by JoenioCosta
1 parent 9a696e6e

ActionItem428: add skel to administrator enable / disable enterprises


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1992 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/admin/enterprises_controller.rb 0 → 100644
... ... @@ -0,0 +1,7 @@
  1 +class EnterprisesController < AdminController
  2 +
  3 + def index
  4 + @enterprises = Enterprise.find(:all)
  5 + end
  6 +
  7 +end
... ...
app/helpers/enterprises_helper.rb 0 → 100644
... ... @@ -0,0 +1,2 @@
  1 +module EnterprisesHelper
  2 +end
... ...
app/views/enterprises/index.rhtml 0 → 100644
... ... @@ -0,0 +1,22 @@
  1 +<h1><%= _("%s's enterprises") % environment.name %></h1>
  2 +
  3 +<table>
  4 +<% for enterprise in @enterprises %>
  5 + <tr>
  6 + <td> <%= image_tag(profile_icon(enterprise)) %> </td>
  7 + <td>
  8 + <%= _('Name: %s') % link_to(enterprise.name, enterprise.url) %> <br/>
  9 + <%#= _('Description: %s') % enterprise.description + '<br/>' if enterprise.kind_of?(Community) %>
  10 + <%= _('Created at: %s') % show_date(enterprise.created_at) %> <br/>
  11 + <%= _('Actions: %s') % link_to(_('Manage'), enterprise.admin_url) %> <br/>
  12 +
  13 + </td>
  14 + </tr>
  15 +<% end %>
  16 +</table>
  17 +
  18 +<% button_bar do %>
  19 + <%#= button :add, _('Register a new Enterprise'), :controller => 'enterprise_registration' %>
  20 + <%#= button :add, _('Create a new community'), :action => 'new_community' %>
  21 + <%#= button :back, _('Go back'), :controller => 'profile_editor' %>
  22 +<% end %>
... ...
test/functional/admin_panel_controller_test.rb
... ... @@ -69,8 +69,12 @@ class AdminPanelControllerTest &lt; Test::Unit::TestCase
69 69 should 'sanitize description with white_list' do
70 70 post :site_info, :environment => { :description => "This <strong>is</strong> <scrypt>alert('alow')</script>my new environment" }
71 71 assert_redirected_to :action => 'index'
72   - #assert_sanitized Environment.default.description
73 72 assert_equal "This <strong>is</strong> alert('alow')my new environment", Environment.default.description
74 73 end
75 74  
  75 + should 'link to manage enterprises' do
  76 + get :index
  77 + assert_tag :tag => 'a', :attributes => { :href => '/admin/enterprises' }
  78 + end
  79 +
76 80 end
... ...
test/functional/enterprises_controller_test.rb 0 → 100644
... ... @@ -0,0 +1,8 @@
  1 +require File.dirname(__FILE__) + '/../test_helper'
  2 +
  3 +class EnterprisesControllerTest < ActionController::TestCase
  4 + # Replace this with your real tests.
  5 + def test_truth
  6 + assert true
  7 + end
  8 +end
... ...