28 lines
637 B
Ruby
28 lines
637 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
|
|
categories = if is_manager? || is_admin?
|
|
@module_app.categories.enabled
|
|
elsif is_sub_manager?
|
|
@module_app.categories.enabled.entries.delete_if{|category| !category.user_can_sub_manage?(current_user)}
|
|
end
|
|
if categories.empty?
|
|
flash[:alert] = t(:no_category)
|
|
redirect_to :action => :index
|
|
end
|
|
categories
|
|
end
|
|
|
|
end
|
|
|
|
end
|