orbit-basic/lib/orbit_category/categorizing.rb

28 lines
682 B
Ruby
Raw Normal View History

module OrbitCategory
module Categorizing
def get_categories_for_index
if is_manager? || is_admin?
@module_app.categories.all
else
@module_app.categories.enabled
end
end
def get_categories_for_form(func_authed_for_sub_manager = "category_#{@module_app.key}")
categories = if is_manager? || is_admin?
@module_app.categories.enabled
elsif is_sub_manager?
@module_app.categories.enabled.authed_for_user(current_user, func_authed_for_sub_manager)
end
if categories.empty?
flash[:alert] = t(:no_category)
redirect_to :action => :index
end
categories
end
end
end