class SystemController < ApplicationController
before_filter :authenticate_admin!, :except => [:start]
- layout false, :only => :start
- def start
+ #layout :system
+ def start
+ OriginalPicture.all.each do |a|
+ a.lisence_id = 1 if a.lisence_id.blank?
+ a.save
+ end
+ ResourcePicture.all.each do |a|
+ a.lisence_id = 1 if a.lisence_id.blank?
+ a.artist_id = 1 if a.artist_id.blank?
+ a.save
+ end
+ Artist.all.each do |a|
+ a.default_lisence_id = 1 if a.default_lisence_id.blank?
+ a.save
+ end
end
def index
end
+ def browse
+ end
+
+ def auth_token
+ end
+
+ def create_token
+ @admin = current_admin
+ respond_to do |format|
+ if @admin.create_token
+ format.html { redirect_to({:action => :auth_token}, {:notice => 'admin token was successfully created.'}) }
+ else
+ format.html { render action: "auth_token" }
+ end
+ end
+ end
+
+ def delete_token
+ current_admin.delete_token
+ respond_to do |format|
+ format.html { redirect_to :action => :auth_token}
+ end
+ end
+
+ def approve
+ @admin = Admin.find params[:id]
+ respond_to do |format|
+ if @admin.apv
+ format.html { redirect_to({:action => :waiting_list}, {:notice => 'admin was successfully approved.'}) }
+ else
+ format.html { render action: "waiting_list" }
+ end
+ end
+ end
+
def waiting_list
- @newadmins = Admin.find(:all, :conditions => ['activate = 0'])
+ @waits = Admin.find(:all, :conditions => ['approve = 0'])
end
def accept_admin