This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
orbit-4-1/lib/orbit_app/helper/renderer.rb

98 lines
1.9 KiB
Ruby
Raw Permalink Normal View History

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
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
false
2012-12-03 10:52:36 +00:00
end
end
def active_for_ob_auths?
2012-12-03 10:52:36 +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
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