friends.rhtml
4.11 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
<% if profile.person? %>
<h1><%= _('Invite your friends') %></h1>
<% else %>
<h1><%= _('Invite your friends to join %s') % profile.name %></h1>
<% end %>
<% unless @contacts %>
<h2><%= _('Step 1 of 2: Select address book') %></h2>
<% form_tag do %>
<%= hidden_field_tag(:step, 1) %>
<%= [
radio_button_tag(:import_from, "manual", @import_from == "manual", :onclick => 'hide_invite_friend_login_password()') + content_tag('label', _('Manually (empty field)'), :for => "import_from_manual"),
radio_button_tag(:import_from, "gmail", @import_from == "gmail", :onclick => 'show_invite_friend_login_password()') + content_tag('label', 'Gmail', :for => 'import_from_gmail'),
radio_button_tag(:import_from, "yahoo", @import_from == "yahoo", :onclick => 'show_invite_friend_login_password()') + content_tag('label', 'Yahoo', :for => "import_from_yahoo"),
radio_button_tag(:import_from, "hotmail", @import_from == "hotmail", :onclick => 'show_invite_friend_login_password()') + content_tag('label', 'Hotmail', :for => "import_from_hotmail")
].join("\n<br/>\n") %>
<script type="text/javascript">
function hide_invite_friend_login_password() {
$('invite-friends-login-password').hide();
}
function show_invite_friend_login_password() {
$('invite-friends-login-password').show();
$('login').focus();
}
</script>
<div id='invite-friends-login-password' <%= "style='display: none;'" if (@import_from == 'manual') %>>
<%= labelled_form_field(_("Username") + ":", text_field_tag(:login, @login)) %>
<%= labelled_form_field(_("Password") + ":", password_field_tag(:password)) %>
</div>
<% button_bar do %>
<%= submit_button(:forward, _("Next")) %>
<% end %>
<p><%= _("We won't store your password or contact anyone without your permission.") %></p>
<% end %>
<% else %>
<h2><%= _('Step 2 of 2: Selecting Friends') %></h2>
<p>
<%= _('Indicate which friends you want to invite.') %>
</p>
<% form_tag do %>
<%= hidden_field_tag(:step, 2) %>
<%= hidden_field_tag(:import_from, @import_from) %>
<div>
<%= labelled_form_field(_('Enter one e-mail address per line:'), text_area_tag(:manual_import_addresses, (@manual_import_addresses || ''), :cols => 72, :rows => 5)) %>
</div>
<% if @import_from != 'manual' %>
<div>
<%= link_to_function _('Check all'), "$$('input.contact_to_invite').each(function(checkbox) { checkbox.checked = true; });" %>
<%= link_to_function _('Uncheck all'), "$$('input.contact_to_invite').each(function(checkbox) { checkbox.checked = false; });" %>
<% friend_pos = 0 %>
<div id='contacts-list'>
<% @contacts.each do |contact| %>
<% friend_pos += 1 %>
<p>
<%= hidden_field_tag("webmail_friends[]", contact.to_yaml) %>
<%= check_box_tag("webmail_import_addresses[]", contact[2],
(!@webmail_import_addresses || @webmail_import_addresses.include?(contact[2])),
:id => "contacts_to_invite_#{friend_pos}",
:class => "contact_to_invite" )
%>
<label for="<%= "contacts_to_invite_#{friend_pos}" %>"><%= "#{contact[0]} (#{contact[1]})" %></label>
</p>
<% end %>
</div>
</div>
<% end -%>
<br/>
<%= link_to_function(_('Personalize invitation mail'), nil) do |page|
page['invitation-mail_template'].show
end %>
<div id='invitation-mail_template' style='display:none'>
<%= h _("Now enter an invitation message. You must keep the <url> code in your invitation text. When your friends receive the invitation e-mail, <url> will be replaced by a link that they need to click to activate their account. <user> and <friend> codes will be replaced by your name and friend name, but they are optional.") %>
<%= labelled_form_field(_('Invitation text:'), text_area_tag(:mail_template, @mail_template, :cols => 72, :rows => 8)) %>
</div>
<% button_bar do %>
<%= submit_button(:ok, _("Invite my friends!")) %>
<% end %>
<% end %>
<% end %>