2012-11-20 07:56:52 +00:00
|
|
|
module Renderer
|
|
|
|
include Rails.application.routes.url_helpers
|
|
|
|
include ActionView::Helpers::UrlHelper
|
|
|
|
include ActionView::Helpers::TagHelper
|
|
|
|
include ActionView::Helpers::RenderingHelper
|
|
|
|
include ActionView::Context
|
|
|
|
include OrbitBasis::RenderAnywhere
|
|
|
|
|
|
|
|
protected
|
|
|
|
def active_for_app_auth?
|
2012-12-07 04:40:47 +00:00
|
|
|
module_app = get_module_app
|
2013-05-02 03:35:48 +00:00
|
|
|
if controller.eql?('admin/module_apps_new_interface')
|
|
|
|
if module_app.nil?
|
|
|
|
false
|
|
|
|
else
|
|
|
|
module_app.id.to_s == @params[:module_app_id] ? true : false
|
|
|
|
end
|
2012-12-03 10:52:36 +00:00
|
|
|
else
|
2013-05-02 03:35:48 +00:00
|
|
|
false
|
2012-12-03 10:52:36 +00:00
|
|
|
end
|
2012-11-20 07:56:52 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def active_for_ob_auths?
|
2012-12-03 10:52:36 +00:00
|
|
|
|
2012-11-20 07:56:52 +00:00
|
|
|
if @params.has_key? :object_auth_id
|
|
|
|
oa = ObjectAuth.find @params[:object_auth_id]
|
|
|
|
check_controller = @params[:controller] == 'admin/object_auths_new_interface'
|
|
|
|
check_object_class = @active_for_object_auth.include? oa.obj_authable_type
|
|
|
|
return (check_controller and check_object_class)
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-05-02 03:35:48 +00:00
|
|
|
def active_for_tag?
|
|
|
|
module_app = get_module_app
|
|
|
|
if controller.eql?('admin/module_tags')
|
|
|
|
if module_app.nil?
|
|
|
|
false
|
|
|
|
else
|
|
|
|
module_app.id.to_s == @params[:module_app_id] ? true : false
|
|
|
|
end
|
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-11-20 07:56:52 +00:00
|
|
|
def current_user
|
|
|
|
current_or_guest_user
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_or_guest_user
|
|
|
|
@current_user
|
|
|
|
end
|
|
|
|
|
|
|
|
def request
|
|
|
|
@request
|
|
|
|
end
|
|
|
|
|
|
|
|
def default_url_options
|
|
|
|
_routes.default_url_options
|
|
|
|
end
|
|
|
|
|
|
|
|
def _routes
|
|
|
|
@request.env["action_dispatch.routes"]
|
|
|
|
end
|
|
|
|
|
|
|
|
def controller
|
|
|
|
@params[:controller]
|
|
|
|
end
|
|
|
|
|
|
|
|
def action
|
|
|
|
@params[:action]
|
|
|
|
end
|
|
|
|
|
|
|
|
def check_user_available_for
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
def display?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|