X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=app%2Fcontrollers%2Fsystem_controller.rb;h=be48d475f0aa8e2a69dd93df723e1d914dd55b5b;hb=665761e56525215946e2547a70c82c603d5047af;hp=8f30dfa9afcb3fc65e3dca7cbf370025c279fc23;hpb=3698d35ebf3394a22a9cf4de1815b92f7f2181fd;p=pettanr%2Fpettanr.git diff --git a/app/controllers/system_controller.rb b/app/controllers/system_controller.rb index 8f30dfa9..be48d475 100644 --- a/app/controllers/system_controller.rb +++ b/app/controllers/system_controller.rb @@ -1,16 +1,70 @@ class SystemController < ApplicationController before_filter :authenticate_admin!, :except => [:start] - layout false, :only => :start - def start + #layout :system + def start end def index end + def import + end + + def reload_manifest + Manifest::load JSON.parse(open(Rails.root + 'public/manifest.json').read) + Manifest.manifest.init + LocalManifest::load JSON.parse(open(Rails.root + 'public/local_manifest.json').read) + LocalManifest.manifest.init + Manifest.manifest.init_after_load_manifest + Manifest.manifest.load_models_manifest + respond_to do |format| + format.html { redirect_to({:action => :index}) } + end + end + + def auth_token + end + + def create_token + @admin = current_admin + respond_to do |format| + if @admin.create_token + flash[:notice] = I18n.t('flash.notice.created', :model => Admin.human_attribute_name(:authentication_token)) + format.html { redirect_to({:action => :auth_token}) } + else + flash[:notice] = I18n.t('flash.notice.not_created', :model => Admin.human_attribute_name(:authentication_token)) + format.html { render action: "auth_token" } + end + end + end + + def delete_token + respond_to do |format| + if current_admin.delete_token + flash[:notice] = I18n.t('flash.notice.destroyed', :model => Admin.human_attribute_name(:authentication_token)) + format.html { redirect_to :action => :auth_token} + else + flash[:notice] = I18n.t('flash.notice.not_destroyed', :model => Admin.human_attribute_name(:authentication_token)) + format.html { render action: "auth_token" } + end + 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