Usability tweaks, creating merges, fixing issues
This commit is contained in:
@@ -28,7 +28,13 @@
|
||||
<% if !@cards.blank? %>
|
||||
<% @cards.each do |card| %>
|
||||
<tr>
|
||||
<td><%= link_to card.user.name, card %></td>
|
||||
<td>
|
||||
<% if card.user.nil? %>
|
||||
n/a
|
||||
<% else %>
|
||||
<%= link_to card.user.name , card %>
|
||||
<% end %>
|
||||
</td>
|
||||
<td><%= card.name %></td>
|
||||
<td><%= card.id %></td>
|
||||
<td><%= card.card_number %></td>
|
||||
|
||||
95
app/views/users/_user_summary.html.erb
Normal file
95
app/views/users/_user_summary.html.erb
Normal file
@@ -0,0 +1,95 @@
|
||||
<% user ||= @user #unless @user.blank? %>
|
||||
|
||||
<p>
|
||||
<b>Name:</b>
|
||||
<%= user.name %>
|
||||
</p>
|
||||
|
||||
<% if current_user.admin? then %>
|
||||
<p>
|
||||
<b>Email:</b>
|
||||
<%= user.email %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Orientation?</b>
|
||||
<%= user.orientation.strftime("%B %d %Y") unless user.orientation.blank? %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<p>
|
||||
<b>Waiver?</b>
|
||||
<%= user.waiver.strftime("%B %d %Y") unless user.waiver.blank? %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b>Current Member?</b>
|
||||
<%= raw(user.member_status_symbol) %>
|
||||
</p>
|
||||
|
||||
<% if current_user.admin? then %>
|
||||
<p>
|
||||
<b>Desired Member Level:</b>
|
||||
<%= user.member_level %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Payment Method:</b>
|
||||
<%= user.payment_method %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Payee:</b>
|
||||
<%= user.payee %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Phone:</b>
|
||||
<%= user.phone %>
|
||||
</p>
|
||||
<% end %>
|
||||
<p>
|
||||
<b>Current Skills:</b>
|
||||
<%= simple_format user.current_skills %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Desired Skills:</b>
|
||||
<%= simple_format user.desired_skills %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Card:</b>
|
||||
<% if current_user.admin? then %>
|
||||
<% user.cards.each do |c| %>
|
||||
<%= link_to c.card_number, c %><%= "," unless c == user.cards.last %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= unless user.cards.blank? then raw("✓") end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<b>Certifications:</b>
|
||||
<ul>
|
||||
<% user.certifications.each do |certification| %>
|
||||
<li><%= link_to certification.name, certification %></li>
|
||||
<% end %>
|
||||
<% if user.certifications.blank? %><li>n/a</li><% end %>
|
||||
</ul>
|
||||
|
||||
<% if current_user.admin? then %>
|
||||
<p>
|
||||
<b>Payments:</b>
|
||||
<ul>
|
||||
<% user.payments.each do |payment| %>
|
||||
<li><%= payment.date %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<% if current_user.admin? then %>
|
||||
<p>
|
||||
<b>Created:</b>
|
||||
<%= user.created_at %>
|
||||
</p>
|
||||
<p>
|
||||
<b>Last signed in:</b>
|
||||
<%= user.current_sign_in_at %>
|
||||
</p>
|
||||
<% end %>
|
||||
@@ -3,6 +3,9 @@
|
||||
<% if can? :create, User %>
|
||||
<%= link_to 'New User', new_user_path %>
|
||||
<% end %>
|
||||
<% if can? :manage, User %>
|
||||
| <%= link_to 'Merge Users', users_merge_path %>
|
||||
<% end %>
|
||||
<table>
|
||||
<col />
|
||||
<col />
|
||||
|
||||
48
app/views/users/merge_view.html.erb
Normal file
48
app/views/users/merge_view.html.erb
Normal file
@@ -0,0 +1,48 @@
|
||||
<style type="text/css">
|
||||
#user_to_merge_details, #user_to_keep_details,
|
||||
#user_to_merge_details p, #user_to_keep_details p {
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h1>Merging users</h1>
|
||||
|
||||
<%= form_tag('/users/merge', :method => :post) do %>
|
||||
<b>Everything except the email, password, name, id, hidden, and blank values will be moved to the "user to keep" UNLESS there is a value already there. The "user to merge" will be deleted.</b>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="field">
|
||||
<%= label_tag :user_to_keep, "User to Keep" %><br />
|
||||
<%= collection_select(:user, :to_keep, @users, :id, :name_with_email_and_visibility, :include_blank => true) %>
|
||||
</div>
|
||||
<div id="user_to_keep_details"></div>
|
||||
</td>
|
||||
<td style="font-size: 16px">◀◀</td>
|
||||
<td>
|
||||
<div class="field">
|
||||
<%= label_tag :user_to_merge, "User to Merge" %><br />
|
||||
<%= collection_select(:user, :to_merge, @users, :id, :name_with_email_and_visibility, :include_blank => true) %>
|
||||
</div>
|
||||
<div id="user_to_merge_details"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<hr/>
|
||||
<div class="actions">
|
||||
<%= submit_tag "Merge" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= link_to 'Back', users_path %>
|
||||
|
||||
<script>
|
||||
$("#user_to_keep").change(function(event,handler){
|
||||
$("#user_to_keep_details").load("/user_summary/"+event.target.value);
|
||||
});
|
||||
$("#user_to_merge").change(function(event,handler){
|
||||
$("#user_to_merge_details").load("/user_summary/"+event.target.value);
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user