forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_merge.html.erb
More file actions
109 lines (109 loc) · 6.13 KB
/
Copy pathadmin_merge.html.erb
File metadata and controls
109 lines (109 loc) · 6.13 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
102
103
104
105
106
107
108
109
<% content_for :page_title do %><%= t('titles.merge_users', 'Merge User Accounts') %><% end %>
<% content_for :stylesheets do %>
<style>
.merge_results {
border-collapse: collapse;
margin: 10px 0;
}
.merge_results td, .merge_results th {
padding-right: 10px;
padding-bottom: 3px;
vertical-align: top;
}
.merge_results .result > td, .merge_results .result > th {
padding: 5px;
}
.merge_results tbody .result > td, .merge_results tbody .result > th {
border-top: 1px solid #ddd;
}
.merge_results .result > td {
border-left: 1px solid #ddd;
}
.merge_results thead .result > td {
font-weight: bold;
}
.merge_results th {
font-weight: bold;
padding-right: 10px;
}
</style>
<% end %>
<div style="margin-top: 10px;">
<% if @other_user %>
<h1><%= t('titles.really_merge', 'Really Merge User Accounts?') %></h1>
<p><strong>
<%= t('no_merge_undo', "This process cannot be undone, so please make sure you're certain before you continue.") %>
</strong></p>
<p>
<%= t('merge_result_explanation', "Are you sure you want to merge the account, %{source_user_name}
(%{source_user_email}) into this account, %{target_user_name} (%{target_user_email})? This
process will have the following end result:",
:source_user_name => @user.name, :source_user_email => @user.email,
:target_user_name => @other_user.name, :target_user_email => @other_user.email) %>
<%= render :partial => 'merge_results', :locals => {:user => @user, :other_user => @other_user} %>
</p>
<%= form_tag user_merge_path(@user, :new_user_id => @other_user.id), :method => :post do %>
<div class="button-container">
<button type="submit" class="btn"><%= t('buttons.merge_user_account', 'Merge User Accounts') %></button>
<a href="<%= dashboard_path %>" class="btn button-secondary"><%= t('#buttons.cancel', 'Cancel') %></a>
</div>
<% end %>
<% else %>
<h1><%= t('titles.merge_users', 'Merge User Accounts') %></h1>
<% if @pending_other_user %>
<%= t('merge_result_explanation_again', "You've selected to merge the user, %{user_name} (%{user_email}) into
the account, %{pending_other_user_name} (%{pending_other_user_email}).
This process will have the following end result:",
:user_name => @user.name, :user_email => @user.email,
:pending_other_user_name => @pending_other_user.name, :pending_other_user_email => @pending_other_user.email) %>
<%= render :partial => 'merge_results', :locals => {:user => @user, :other_user => @pending_other_user} %>
<a class="btn" id="prepare_to_merge" style="width: 6em;" href="<%= user_admin_merge_url(@user.id, :new_user_id => @pending_other_user.id) %>"><%= t('prepare_to_merge', "Prepare to Merge Users") %></a>
<span style="font-size: 0.8em; padding-left: 50px;">
<a class="btn" id="switch_user_positions" style="width: 6em;" href="<%= user_admin_merge_url(@pending_other_user.id, :pending_user_id => @user.id) %>"><%= t('switch_user_positions', "Switch User Positions") %></a>
<a class="btn merge_with_other" style="width: 13em;" href="<%= user_admin_merge_url(@user.id, :clear => 1) %>"><%= t('merge_somone_else', 'Merge Someone Else With %{user_name}', :user_name => @user.name) %></a>
<a class="btn merge_with_other" style="width: 13em;" href="<%= user_admin_merge_url(@pending_other_user.id, :clear => 1) %>"><%= t('merge_somone_else', 'Merge Someone Else With %{user_name}', :user_name => @pending_other_user.name) %></a>
</span>
<% else %>
<p><%= t('merge_user_initial_instructions', "You've selected to merge the user, %{user_name} (%{user_email}) with another account.
You can search for the user you'd like to merge with this user using the form below.", :user_name => @user.name, :user_email => @user.email) %></p>
<table>
<tr>
<td style="vertical-align: top; padding: 10px 30px 10px;">
<h2><%= t('titles.find_user', 'Find a User') %></h2>
<% accounts = @current_user.associated_accounts.sort_by(&:name).uniq.select { |a| a.grants_any_right?(@current_user, session, :manage_user_logins, :read_roster) } %>
<% if accounts.empty? %>
<%= t('no_permission', "You don't have permission to search any accounts") %>
<% else %>
<select id="account_select" style="<%= hidden unless accounts.length > 1%>">
<% accounts.each do |account| %>
<option value="<%= account.id %>"><%= account.name %></option>
<% end %>
</select>
<div style="margin-top: 10px; margin-bottom: 20px;">
<% accounts.each do |account| %>
<div id="account_search_<%= account.id %>" class="account_search" style="display: none;">
<label for="user_name_<%= account.id %>"><%= before_label('name', 'Name') %></label>
<input id="user_name_<%= account.id %>" data-autocomplete-source="<%= account_users_path(account) + '.json' %>" class="user_name" />
</div>
<% end %>
</div>
<div style="margin-top: 20px;">
<span id="selected_name" style="font-weight: bold; padding-right: 10px;"></span>
<a href="#" style="display: none;" rel="<%= user_admin_merge_url(@user.id, :pending_user_id => "{{ id }}") %>" id="select_name" type='button' class='btn btn-small select_button'><%= t 'links.select', "Select" %></a>
</div>
<% end %>
</td>
<td style="vertical-align: top; padding: 10px 10px 10px 30px;">
<h2><%= t('titles.enter_user_id', 'Or Enter a User ID') %></h2>
<%= form_tag user_admin_merge_url(@user.id), {:method => :get} do %>
<label for="manual_user_id"><%= before_label('user_id', 'User ID') %></label>
<input id="manual_user_id" name="pending_user_id" type="text" style="width: 50px;"/>
<button type="submit" class="btn btn-small"><%= t('buttons.go', 'Go') %></button>
<% end %>
</td>
</tr>
</table>
<% js_bundle 'legacy/users_admin_merge' %>
<% end %>
<% end %>
</div>