socialforge/app/helpers/shares_helper.rb

16 lines
463 B
Ruby

module SharesHelper
def options_from_select_project(user)
@membership = user.memberships.all(:conditions => Project.visible_condition(User.current))
@option = []
@membership.each do |membership|
unless(membership.project.project_type==1)
#可被用户引用的项目
if user.allowed_to?(:quote_project, membership.project)
@option << membership.project
end
end
end
options_for_select(@option)
end
end