diff --git a/app/views/profile_editor/_organization.rhtml b/app/views/profile_editor/_organization.rhtml index 83a9779..395a311 100644 --- a/app/views/profile_editor/_organization.rhtml +++ b/app/views/profile_editor/_organization.rhtml @@ -63,23 +63,24 @@ <%= labelled_check_box(_('Enable "contact us"'), 'profile_data[enable_contact_us]', "1", @profile.enable_contact_us) if @profile.enterprise? %>

<%= _('Moderation options') %>

-
- <%= _('New members must be approved:')%> -
-
- <%= radio_button 'profile_data', 'closed', 'true', :style => 'float: left' %> -
- <%= _('Before joining this group (a moderator has to accept the member in pending request before member can access the intranet and/or the website).') %> + <% if profile.community? %> +
+ <%= _('New members must be approved:')%>
-
-
- <%= radio_button 'profile_data', 'closed', 'false', :style => 'float: left' %> -
- <%= _('After joining this group (a moderator can always desactivate access for users later).') %> +
+ <%= radio_button 'profile_data', 'closed', 'true', :style => 'float: left' %> +
+ <%= _('Before joining this group (a moderator has to accept the member in pending request before member can access the intranet and/or the website).') %> +
-
- -
+
+ <%= radio_button 'profile_data', 'closed', 'false', :style => 'float: left' %> +
+ <%= _('After joining this group (a moderator can always desactivate access for users later).') %> +
+
+
+ <% end %>
<%= _('New articles posted by members of this group must be approved:')%> diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index 22e18cf..2170050 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -302,31 +302,23 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert_not_nil assigns(:profile).image end - should 'display closed attribute for enterprise when it is set' do - org = Enterprise.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default) + should 'display closed attribute for communities when it is set' do + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default) get :edit, :profile => 'testorg' assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' } assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' } end - should 'display closed attribute for organizations when it is set' do - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => true, :environment => Environment.default) - get :edit, :profile => 'testorg' - - assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' } - assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' } - end - - should 'display closed attribute for organizations when it is set to false' do - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => false) + should 'display closed attribute for communities when it is set to false' do + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => false) get :edit, :profile => 'testorg' assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' } assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' } end - should 'display closed attribute for organizations when it is set to nothing at all' do - org = Organization.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => nil) + should 'display closed attribute for communities when it is set to nothing at all' do + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :closed => nil) get :edit, :profile => 'testorg' assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true', :checked => 'checked' } assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false', :checked => 'checked' } @@ -348,6 +340,22 @@ class ProfileEditorControllerTest < Test::Unit::TestCase assert !org.closed end + should 'not display option to close when it is enterprise' do + org = Enterprise.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default) + get :edit, :profile => 'testorg' + + assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true' } + assert_no_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false' } + end + + should 'display option to close when it is community' do + org = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default) + get :edit, :profile => 'testorg' + + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'true' } + assert_tag :tag => 'input', :attributes => { :type => 'radio', :name => 'profile_data[closed]', :value => 'false' } + end + should 'display manage members options if has permission' do profile = Profile['ze'] community = Community.create!(:name => 'test org', :identifier => 'testorg', :contact_person => 'my contact', :environment => Environment.default) -- libgit2 0.21.2