Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
120 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
class Admin::OrganizationsController < Admin::BaseController | ||
before_filter :set_valid_filters | ||
before_filter :parse_filter | ||
|
||
load_and_authorize_resource | ||
|
||
def index | ||
@organizations = @organizations.send(@filter) | ||
@organizations = @organizations.includes(:user).order(:name, 'users.email') | ||
end | ||
|
||
def verify | ||
@organization.verify | ||
redirect_to action: :index | ||
redirect_to action: :index, filter: @filter | ||
end | ||
|
||
def reject | ||
@organization.reject | ||
redirect_to action: :index | ||
redirect_to action: :index, filter: @filter | ||
end | ||
|
||
private | ||
def set_valid_filters | ||
@valid_filters = %w{all pending verified rejected} | ||
end | ||
|
||
def parse_filter | ||
@filter = params[:filter] | ||
@filter = 'all' unless @valid_filters.include?(@filter) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters