Commit 6fb030d43d418f61bf354e7825e4bded2fea2945

Authored by JoenioCosta
1 parent 86f07a0e

ActionItem378: admin set organization to closed

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1844 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/my_profile/memberships_controller.rb
... ... @@ -10,6 +10,7 @@ class MembershipsController < MyProfileController
10 10 @to_join = Profile.find(params[:id])
11 11 if request.post? && params[:confirmation]
12 12 @to_join.add_member(profile)
  13 + flash[:notice] = _('%s administrador still needs to accept you as member.') % @to_join.name if @to_join.closed?
13 14 redirect_to @to_join.url
14 15 end
15 16 end
... ...
app/views/profile_editor/_organization.rhtml
... ... @@ -6,3 +6,8 @@
6 6 <%= f.text_field(:economic_activity) %>
7 7 <%= f.text_area(:management_information, :rows => 5) %>
8 8 <%= f.text_area(:description, :rows => 5) if @profile.kind_of?(Community) %>
  9 + <h1><%= _('Moderation options') %></h1>
  10 + <p>
  11 + <%= check_box 'profile_data', 'closed' %>
  12 + <%= _("Closed %s") % @profile.class.name.humanize.downcase %>
  13 + </p>
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -277,4 +277,11 @@ class ProfileEditorControllerTest &lt; Test::Unit::TestCase
277 277 post :edit, :profile => 'test_profile', :profile_data => { :image_builder => { :uploaded_data => fixture_file_upload('/files/rails.png', 'image/png') } }
278 278 assert_not_nil assigns(:profile).image
279 279 end
  280 +
  281 + should 'show field to set closed organization' do
  282 + org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact')
  283 + get :edit, :profile => 'testorg'
  284 + assert_tag :tag => 'input', :attributes => { :type => 'checkbox', :name => 'profile_data[closed]' }
  285 + end
  286 +
280 287 end
... ...