Name changes: make /user_name_change_requests member+; add reason/status/date.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
class UserNameChangeRequestsController < ApplicationController
|
class UserNameChangeRequestsController < ApplicationController
|
||||||
before_filter :gold_only, :only => [:new, :create, :show]
|
before_filter :member_only, :only => [:index, :show]
|
||||||
before_filter :admin_only, :only => [:index, :approve, :reject]
|
before_filter :gold_only, :only => [:new, :create]
|
||||||
|
before_filter :admin_only, :only => [:approve, :reject]
|
||||||
rescue_from User::PrivilegeError, :with => :access_denied
|
rescue_from User::PrivilegeError, :with => :access_denied
|
||||||
|
|
||||||
def new
|
def new
|
||||||
@@ -29,7 +30,7 @@ class UserNameChangeRequestsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@change_requests = UserNameChangeRequest.order("id desc").paginate(params[:page], :limit => params[:limit])
|
@change_requests = UserNameChangeRequest.visible.order("id desc").paginate(params[:page], :limit => params[:limit])
|
||||||
end
|
end
|
||||||
|
|
||||||
def approve
|
def approve
|
||||||
|
|||||||
@@ -5,15 +5,35 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Desired</th>
|
<th>Request</th>
|
||||||
|
<th>Reason</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Date</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<% @change_requests.each do |change_request| %>
|
<% @change_requests.each do |change_request| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= link_to change_request.original_name, user_path(change_request.user_id) %></td>
|
<td><%= link_to_user change_request.user %></td>
|
||||||
<td><%= change_request.desired_name %></td>
|
<td>
|
||||||
|
<strong><%= change_request.original_name %></strong> ->
|
||||||
|
<strong><%= change_request.desired_name %></strong>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<% if CurrentUser.is_admin? || CurrentUser.user == change_request.user %>
|
||||||
|
<%= change_request.change_reason %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= change_request.status %>
|
||||||
|
<% if change_request.approved? %>
|
||||||
|
by <%= link_to_user change_request.approver %>
|
||||||
|
<% elsif change_request.rejected? %>
|
||||||
|
for reason: <%= link_to change_request.rejection_reason %>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td><%= compact_time change_request.created_at %></td>
|
||||||
<td><%= link_to "view", user_name_change_request_path(change_request) %></td>
|
<td><%= link_to "view", user_name_change_request_path(change_request) %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user