Merge pull request #188 from warpc/174-invite_system

[Refs #174] Apply approved and rejected filters for register requests
This commit is contained in:
Vladimir Sharshov 2012-02-14 10:35:43 -08:00
commit d47ad1ed88
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] before_filter :find_register_request, :only => [:approve, :reject]
def index 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 end
def new def new

View File

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

View File

@ -5,6 +5,10 @@
%li= link_to t("layout.users.new"), new_user_path %li= link_to t("layout.users.new"), new_user_path
%li.active= link_to t("layout.users.register_requests"), register_requests_path %li.active= link_to t("layout.users.register_requests"), register_requests_path
.content .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 %h2.title
= t("layout.register_request.list_header") = t("layout.register_request.list_header")
.inner .inner
@ -23,7 +27,8 @@
%tr{:class => cycle("odd", "even")} %tr{:class => cycle("odd", "even")}
%td= check_box_tag 'request_ids[]', request.id %td= check_box_tag 'request_ids[]', request.id
%td= request.name %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.interest
%td= request.more %td= request.more
%td= request.created_at %td= request.created_at