orbit-basic/app/helpers/admin_helper.rb

21 lines
653 B
Ruby

module AdminHelper
def show_parent_items_link
@parent_items = @parent_item.ancestors.map{ |i| i }
link_to('/' , admin_items_path) + ( @parent_items.map{ |i| link_to(i.name, admin_items_path(:parent_id=>i.id) ) } << @parent_item.name ).join("/").html_safe
end
# Check if the current_user is manager in current module app
def is_manager?
@module_app.is_manager?(current_or_guest_user) || is_admin?
end
# Check if the current_user is sub manager in current module app
def is_sub_manager?
@module_app.is_sub_manager?(current_or_guest_user)|| is_admin?
end
def is_admin?
current_or_guest_user.admin?
end
end