Apply approved and rejected filters for register requests. Tune abilities. Link to user profile if user have already registered. Refs #174

This commit is contained in:
Pavel Chipiga 2012-02-14 20:15:52 +02:00
parent a53f627f5f
commit 2c493cdbb7
3 changed files with 9 additions and 2 deletions

View File

@ -5,7 +5,7 @@ class RegisterRequestsController < ApplicationController
before_filter :find_register_request, :only => [:approve, :reject]
def index
@register_requests = @register_requests.unprocessed.paginate(:page => params[:page])
@register_requests = @register_requests.send((params[:scope] || 'unprocessed').to_sym).paginate(:page => params[:page])
end
def new

View File

@ -17,6 +17,8 @@ class Ability
cannot :destroy, Subscribe
cannot :create, Subscribe
cannot :create, RegisterRequest
cannot :approve, RegisterRequest, :approved => true
cannot :reject, RegisterRequest, :rejected => true
else
# Shared rights between guests and registered users
can :forbidden, Platform

View File

@ -5,6 +5,10 @@
%li= link_to t("layout.users.new"), new_user_path
%li.active= link_to t("layout.users.register_requests"), register_requests_path
.content
%div{:style => 'float: right; margin: 20px'}
= link_to t("layout.register_request.approved"), register_requests_path(:scope => :approved)
\|
= link_to t("layout.register_request.rejected"), register_requests_path(:scope => :rejected)
%h2.title
= t("layout.register_request.list_header")
.inner
@ -23,7 +27,8 @@
%tr{:class => cycle("odd", "even")}
%td= check_box_tag 'request_ids[]', request.id
%td= request.name
%td= request.email
- @user = User.find_by_email(request.email) if request.approved
%td= link_to_if @user, request.email, @user
%td= request.interest
%td= request.more
%td= request.created_at