<%= _('Profile settings for %s').html_safe % profile.name %>
<%= error_messages_for :profile_data %>
<%= labelled_form_for :profile_data, :html => { :id => 'profile-data', :multipart => true } do |f| %>
<% if user.has_permission?('manage_environment_templates', profile.environment) %>
<%= labelled_check_box(_('This profile is a template'), 'profile_data[is_template]', true, @profile.is_template) %>
<% end %>
<%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
<%= _('Change picture') %>
<%= unchangeable_privacy_field @profile %>
<%= f.fields_for :image_builder, @profile.image do |i| %>
<%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)").html_safe % Image.max_size.to_humanreadable %>
<% end %>
<%= _('Privacy options') %>
<%= labelled_check_box _("Allow other users to follow me"), 'profile_data[allow_followers]', true, @profile.allow_followers?, :class => "person-can-be-followed" %>
<% if profile.person? %>
<%= labelled_radio_button _('Public — show my contents to all internet users').html_safe, 'profile_data[public_profile]', true, @profile.public_profile? %>
<%= labelled_radio_button _('Private — show my contents only to friends').html_safe, 'profile_data[public_profile]', false, !@profile.public_profile? %>
<% else %>
<%= labelled_check_box _("Secret — hide the community and all its contents for non members and other people can't join this community unless they are invited to.").html_safe, 'profile_data[secret]', true, profile.secret, :class => "profile-secret-box" %>
<%= labelled_radio_button _('Public — show content of this group to all internet users').html_safe, 'profile_data[public_profile]', true, @profile.public_profile?, :class => "public-community-button" %>
<%= labelled_radio_button _('Private — show content of this group only to members').html_safe, 'profile_data[public_profile]', false, !@profile.public_profile?, :class => "private-community-button" %>
<% end %>
<% if environment.enabled?('allow_change_of_redirection_after_login') %>
<%= render 'redirection_after_login', f: f %>
<% end %>
<%= _('Translations') %>
<%= labelled_check_box(
_('Automaticaly redirect the visitor to the article translated to his/her language'),
'profile_data[redirect_l10n]', true, @profile.redirect_l10n
)%>
<%= _('Suggestions') %>
<%= labelled_check_box(
_('Send me relationship suggestions by email'),
'profile_data[email_suggestions]', true, @profile.email_suggestions
)%>
<%=
safe_join(@plugins.dispatch(:profile_editor_extras).map do |content|
content.kind_of?(Proc) ? self.instance_exec(&content) : content
end, "\n")
%>
<%= select_categories(:profile_data, _('Select the categories of your interest'), 2) %>
<%= button_bar do %>
<%= submit_button('save', _('Save'), :cancel => {:action => 'index'}) %>
<%= button(:back, _('Back to control panel'), :controller => 'profile_editor') %>
<% end %>
<% if user && user.has_permission?('destroy_profile', profile) %>
<%= button_bar(:id => 'delete-profile') do %>
<% if !environment.enabled?('forbid_destroy_profile') || user.is_admin?(environment) %>
<%= button(:remove, _('Delete profile'), {:action => :destroy_profile}) %>
<% end %>
<% if user.is_admin?(environment) %>
<% if profile.visible? %>
<%= button(:remove, _('Deactivate profile'),
{:action => :deactivate_profile, :id=>profile.id},
:id=>'deactivate_profile_button',
:data => {:confirm=>_("Are you sure you want to deactivate this profile?")})
%>
<% else %>
<%= button(:add, _('Activate profile'),
{:action => :activate_profile, :id=>profile.id},
:data => {:confirm=>_("Are you sure you want to activate this profile?")})
%>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= javascript_include_tag 'profile_editor' %>