edit.html.erb
4.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<h1><%= _('Profile settings for %s') % profile.name %></h1>
<%= 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) %>
<div id="profile-is-template">
<%= labelled_check_box(_('This profile is a template'), 'profile_data[is_template]', true, @profile.is_template) %>
</div>
<% end %>
<%= render :partial => partial_for_class(@profile.class), :locals => { :f => f } %>
<div id="profile_change_picture_title">
<h2><%= _('Change picture') %></h2>
<span><%= unchangeable_privacy_field @profile %></span>
</div>
<div id="profile_change_picture">
<%= f.fields_for :image_builder, @profile.image do |i| %>
<%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
<% end %>
</div>
<h2><%= _('Privacy options') %></h2>
<% if profile.person? %>
<div>
<%= labelled_radio_button _('Public — show my contents to all internet users'), 'profile_data[public_profile]', true, @profile.public_profile? %>
</div>
<div>
<%= labelled_radio_button _('Private — show my contents only to friends'), 'profile_data[public_profile]', false, !@profile.public_profile? %>
</div>
<% else %>
<div>
<%= 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."), 'profile_data[secret]', true, profile.secret, :class => "profile-secret-box" %>
</div>
<div>
<%= labelled_radio_button _('Public — show content of this group to all internet users'), 'profile_data[public_profile]', true, @profile.public_profile?, :class => "public-community-button" %>
</div>
<div>
<%= labelled_radio_button _('Private — show content of this group only to members'), 'profile_data[public_profile]', false, !@profile.public_profile?, :class => "private-community-button" %>
</div>
<% end %>
<% if environment.enabled?('allow_change_of_redirection_after_login') %>
<h2><%= _('Page to redirect after login') %></h2>
<%= select 'profile_data', 'redirection_after_login', Environment.login_redirection_options.map{|key,value|[value,key]}, { :selected => @profile.preferred_login_redirection} %>
<% end %>
<h2><%= _('Translations') %></h2>
<%= labelled_check_box(
_('Automaticaly redirect the visitor to the article translated to his/her language'),
'profile_data[redirect_l10n]', true, @profile.redirect_l10n
)%>
<h2><%= _('Suggestions') %></h2>
<%= labelled_check_box(
_('Send me relationship suggestions by email'),
'profile_data[email_suggestions]', true, @profile.email_suggestions
)%>
<%=
@plugins.dispatch(:profile_editor_extras).map do |content|
content.kind_of?(Proc) ? self.instance_exec(&content) : content
end.join("\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 deactivate this profile?")})
%>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<%= javascript_include_tag 'profile_editor' %>