forked from kandanapp/kandan
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed tabs and spaces intermittently changing -- most of the app is s…
…paces, lets keep it consistent
- Loading branch information
Showing
16 changed files
with
259 additions
and
256 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
module Admin | ||
class AdminController < BaseController | ||
|
||
def index | ||
@settings = Setting.my_settings | ||
@all_users = User.find(:all, :conditions => ["id != ?", current_user.id]) | ||
def index | ||
@settings = Setting.my_settings | ||
@all_users = User.find(:all, :conditions => ["id != ?", current_user.id]) | ||
|
||
@waiting_for_approval_users = [] | ||
@approved_users = [] | ||
@waiting_for_approval_users = [] | ||
@approved_users = [] | ||
|
||
# Iterate over the array to get approved and non-approved users | ||
@all_users.each{|user| user.registration_status.waiting_approval? ? @waiting_for_approval_users.push(user) : @approved_users.push(user) } | ||
end | ||
# Iterate over the array to get approved and non-approved users | ||
@all_users.each{|user| user.registration_status.waiting_approval? ? @waiting_for_approval_users.push(user) : @approved_users.push(user) } | ||
end | ||
|
||
def update | ||
def update | ||
|
||
max_rooms = params[:setting][:max_rooms].to_i | ||
max_rooms = params[:setting][:max_rooms].to_i | ||
public_site = params[:setting][:public_site] == "1" | ||
disable_conn_disconn_activity = params[:setting][:disable_conn_disconn_activity] == "1" | ||
disable_conn_disconn_activity = params[:setting][:disable_conn_disconn_activity] == "1" | ||
|
||
Setting.set_values(:max_rooms => max_rooms, :public_site => public_site, :disable_conn_disconn_activity => disable_conn_disconn_activity) | ||
Setting.set_values(:max_rooms => max_rooms, :public_site => public_site, :disable_conn_disconn_activity => disable_conn_disconn_activity) | ||
|
||
redirect_to :admin_root | ||
end | ||
redirect_to :admin_root | ||
end | ||
|
||
def update_user | ||
user_id = params[:user_id] | ||
action = params[:action_taken].to_s | ||
def update_user | ||
user_id = params[:user_id] | ||
action = params[:action_taken].to_s | ||
|
||
user = User.find(user_id) | ||
user = User.find(user_id) | ||
|
||
case action | ||
when "activate", "approve" | ||
user.activate! | ||
when "suspend" | ||
user.suspend! | ||
end | ||
case action | ||
when "activate", "approve" | ||
user.activate! | ||
when "suspend" | ||
user.suspend! | ||
end | ||
|
||
render :json => user, :status => 200 | ||
end | ||
render :json => user, :status => 200 | ||
end | ||
|
||
def toggle_admin | ||
user_id = params[:user_id] | ||
def toggle_admin | ||
user_id = params[:user_id] | ||
|
||
user = User.find(user_id) | ||
user = User.find(user_id) | ||
|
||
user.is_admin = !user.is_admin? | ||
user.is_admin = !user.is_admin? | ||
|
||
user.save! | ||
user.save! | ||
|
||
render :json => user, :status => 200 | ||
end | ||
render :json => user, :status => 200 | ||
end | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
module Admin | ||
class BaseController < ApplicationController | ||
before_filter :authenticate_admin! | ||
before_filter :authenticate_admin! | ||
|
||
private | ||
|
||
def authenticate_admin! | ||
redirect_to root_url unless current_user.try(:is_admin?) | ||
end | ||
private | ||
|
||
def authenticate_admin! | ||
redirect_to root_url unless current_user.try(:is_admin?) | ||
end | ||
end | ||
end |
Oops, something went wrong.