98 lines
1.9 KiB
Ruby
98 lines
1.9 KiB
Ruby
|
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?
|
||
|
module_app = get_module_app
|
||
|
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
|
||
|
else
|
||
|
false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def active_for_ob_auths?
|
||
|
|
||
|
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
|
||
|
|
||
|
def active_for_category?
|
||
|
module_app = get_module_app
|
||
|
if controller.eql?('admin/categories')
|
||
|
if module_app.nil?
|
||
|
false
|
||
|
else
|
||
|
module_app.id.to_s == @params[:module_app_id] ? true : false
|
||
|
end
|
||
|
else
|
||
|
false
|
||
|
end
|
||
|
end
|
||
|
|
||
|
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
|
||
|
|
||
|
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
|