From 8609c8dec02afba2e887dea499f4151acc52851c Mon Sep 17 00:00:00 2001 From: Fu Matthew Date: Wed, 6 Mar 2013 15:16:20 +0800 Subject: [PATCH] put add admin pages using orbit back end controller --- app/controllers/admin/app_auths_controller.rb | 2 +- app/controllers/admin/infos_controller.rb | 2 +- app/controllers/admin/items_controller.rb | 2 +- .../admin/member_selects_controller.rb | 2 +- .../admin/module_apps_controller.rb | 2 +- .../admin/object_auths_controller.rb | 2 +- .../admin/page_parts_controller.rb | 2 +- app/controllers/admin/purchases_controller.rb | 2 +- app/controllers/admin/roles_controller.rb | 2 +- app/controllers/admin/sites_controller.rb | 2 +- app/controllers/application_controller.rb | 24 ------------------- app/views/admin/purchases/index.html.erb | 4 ++++ 12 files changed, 14 insertions(+), 34 deletions(-) diff --git a/app/controllers/admin/app_auths_controller.rb b/app/controllers/admin/app_auths_controller.rb index 9e980e53d..28a45e9bf 100644 --- a/app/controllers/admin/app_auths_controller.rb +++ b/app/controllers/admin/app_auths_controller.rb @@ -1,4 +1,4 @@ -class Admin::AppAuthsController < ApplicationController +class Admin::AppAuthsController < OrbitBackendController layout "admin" before_filter :authenticate_user! # before_filter :is_admin? ,:only => :index diff --git a/app/controllers/admin/infos_controller.rb b/app/controllers/admin/infos_controller.rb index c35f2246d..5059c88d5 100644 --- a/app/controllers/admin/infos_controller.rb +++ b/app/controllers/admin/infos_controller.rb @@ -1,4 +1,4 @@ -class Admin::InfosController < ApplicationController +class Admin::InfosController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! diff --git a/app/controllers/admin/items_controller.rb b/app/controllers/admin/items_controller.rb index e028ab680..e0a8a445d 100644 --- a/app/controllers/admin/items_controller.rb +++ b/app/controllers/admin/items_controller.rb @@ -1,4 +1,4 @@ -class Admin::ItemsController < ApplicationController +class Admin::ItemsController < OrbitBackendController layout "site_editor" diff --git a/app/controllers/admin/member_selects_controller.rb b/app/controllers/admin/member_selects_controller.rb index c4a4bf423..9d7e6643d 100644 --- a/app/controllers/admin/member_selects_controller.rb +++ b/app/controllers/admin/member_selects_controller.rb @@ -1,4 +1,4 @@ -class Admin::MemberSelectsController < ApplicationController +class Admin::MemberSelectsController < OrbitBackendController layout "new_admin" diff --git a/app/controllers/admin/module_apps_controller.rb b/app/controllers/admin/module_apps_controller.rb index da0294200..c80f7228e 100644 --- a/app/controllers/admin/module_apps_controller.rb +++ b/app/controllers/admin/module_apps_controller.rb @@ -1,4 +1,4 @@ -class Admin::ModuleAppsController < ApplicationController +class Admin::ModuleAppsController < OrbitBackendController before_filter :user_has_manager_privilege?, :only => [ :assign_manager, :remove_manager ] before_filter :user_has_sub_manager_privilege?, :only => [ :assign_sub_manager, :remove_sub_manager ] diff --git a/app/controllers/admin/object_auths_controller.rb b/app/controllers/admin/object_auths_controller.rb index d407d3db0..086ca28c0 100644 --- a/app/controllers/admin/object_auths_controller.rb +++ b/app/controllers/admin/object_auths_controller.rb @@ -1,4 +1,4 @@ -class Admin::ObjectAuthsController < ApplicationController +class Admin::ObjectAuthsController < OrbitBackendController include OrbitCoreLib::PermissionUtility layout "new_admin" before_filter :force_order diff --git a/app/controllers/admin/page_parts_controller.rb b/app/controllers/admin/page_parts_controller.rb index de1e88ea8..f3b37c1e0 100644 --- a/app/controllers/admin/page_parts_controller.rb +++ b/app/controllers/admin/page_parts_controller.rb @@ -1,4 +1,4 @@ -class Admin::PagePartsController < ApplicationController +class Admin::PagePartsController < OrbitBackendController layout "site_editor" diff --git a/app/controllers/admin/purchases_controller.rb b/app/controllers/admin/purchases_controller.rb index 8a0ffdbcc..d1d5039e2 100644 --- a/app/controllers/admin/purchases_controller.rb +++ b/app/controllers/admin/purchases_controller.rb @@ -1,4 +1,4 @@ -class Admin::PurchasesController < ApplicationController +class Admin::PurchasesController < OrbitBackendController require "net/http" require "uri" require 'zip/zip' diff --git a/app/controllers/admin/roles_controller.rb b/app/controllers/admin/roles_controller.rb index ade4aa43e..a71d5ca06 100644 --- a/app/controllers/admin/roles_controller.rb +++ b/app/controllers/admin/roles_controller.rb @@ -1,4 +1,4 @@ -class Admin::RolesController < ApplicationController +class Admin::RolesController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 943134d4a..33f9582f4 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -1,4 +1,4 @@ -class Admin::SitesController < ApplicationController +class Admin::SitesController < OrbitBackendController layout "new_admin" before_filter :authenticate_user! diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 26a14fd45..573b19143 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -59,30 +59,6 @@ class ApplicationController < ActionController::Base redirect_to root_path end - # Check if the current_user is admin,if not redirect - def is_admin? - current_or_guest_user.admin? ? true : auth_failed_in_backend - end - - # def is_manager? - # @module_app.is_manager?(current_or_guest_user) || is_admin? - # end - - # # Check if the current_user is admin - # def is_member? - # if (current_user rescue false) - # return true - # end - # return false - # end - - # def is_guest? - # if session[:guest_user_id] - # return true - # end - # return false - # end - def for_admin_only if is_admin? true diff --git a/app/views/admin/purchases/index.html.erb b/app/views/admin/purchases/index.html.erb index e45d31926..cd9d23e80 100644 --- a/app/views/admin/purchases/index.html.erb +++ b/app/views/admin/purchases/index.html.erb @@ -1,3 +1,7 @@ +<% content_for :side_bar do %> + <%= render :partial => 'layouts/side_bar', :locals => {:link_name => t('site.settings'), :link_url => admin_site_site_info_path(@site), :side_bar_content => 'admin/sites/side_bar'} %> +<% end %> +

<%= t('list.purchase') %>