28 lines
680 B
Ruby
28 lines
680 B
Ruby
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 = "submit_#{@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
|