Commit b17cbf221f90477b52622fdef03e4917dc3f12fe

Authored by Francisco Júnior
1 parent cde7fd7c

add option to hide community

app/controllers/my_profile/profile_editor_controller.rb
@@ -21,6 +21,7 @@ class ProfileEditorController < MyProfileController @@ -21,6 +21,7 @@ class ProfileEditorController < MyProfileController
21 Profile.transaction do 21 Profile.transaction do
22 Image.transaction do 22 Image.transaction do
23 begin 23 begin
  24 + params[:profile_data][:visible] = params[:profile_data][:visible] == '0'
24 @plugins.dispatch(:profile_editor_transaction_extras) 25 @plugins.dispatch(:profile_editor_transaction_extras)
25 @profile_data.update_attributes!(params[:profile_data]) 26 @profile_data.update_attributes!(params[:profile_data])
26 redirect_to :action => 'index', :profile => profile.identifier 27 redirect_to :action => 'index', :profile => profile.identifier
app/models/community.rb
1 class Community < Organization 1 class Community < Organization
2 2
3 - attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :address_reference, :district, :tag_list, :language 3 + attr_accessible :accessor_id, :accessor_type, :role_id, :resource_id, :resource_type, :address_reference, :district, :tag_list, :language, :visible
4 after_destroy :check_invite_member_for_destroy 4 after_destroy :check_invite_member_for_destroy
5 5
6 def self.type_name 6 def self.type_name
app/views/profile_editor/edit.html.erb
@@ -33,6 +33,10 @@ @@ -33,6 +33,10 @@
33 </div> 33 </div>
34 <% else %> 34 <% else %>
35 <div> 35 <div>
  36 + <%= labelled_check_box _('Hidden &mdash; show content of this group only to administrators'), 'profile_data[visible]', false, !@profile.visible %>
  37 + </div>
  38 + <br />
  39 + <div>
36 <%= labelled_radio_button _('Public &mdash; show content of this group to all internet users'), 'profile_data[public_profile]', true, @profile.public_profile? %> 40 <%= labelled_radio_button _('Public &mdash; show content of this group to all internet users'), 'profile_data[public_profile]', true, @profile.public_profile? %>
37 </div> 41 </div>
38 <div> 42 <div>