2016-07-21 19:11:15 +08:00
|
|
|
module ProtocolStatusHelper
|
|
|
|
|
|
|
|
def protocol_name(protocol)
|
2017-01-05 23:05:48 +08:00
|
|
|
if protocol_private_for_current_user?(protocol)
|
|
|
|
I18n.t('my_modules.protocols.protocol_status_bar.private_parent')
|
|
|
|
else
|
2017-01-11 22:50:11 +08:00
|
|
|
escape_input(protocol.name)
|
2017-01-05 23:05:48 +08:00
|
|
|
end
|
2016-07-21 19:11:15 +08:00
|
|
|
end
|
|
|
|
|
2020-04-17 01:13:18 +08:00
|
|
|
private
|
2016-07-21 19:11:15 +08:00
|
|
|
|
2020-04-17 01:13:18 +08:00
|
|
|
def protocol_private_for_current_user?(protocol)
|
|
|
|
protocol.in_repository_private? && protocol.added_by != current_user
|
2016-07-21 19:11:15 +08:00
|
|
|
end
|
|
|
|
end
|