This repository has been archived on 2023-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
2019-08-14 12:09:20 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module AccountsHelper
|
2019-08-14 12:21:39 +00:00
|
|
|
def account_link_or_none(account)
|
|
|
|
if account.nil?
|
2019-08-28 18:21:35 +00:00
|
|
|
none
|
2019-08-14 12:21:39 +00:00
|
|
|
elsif policy(account).show?
|
|
|
|
link_to account.nickname, account
|
|
|
|
else
|
|
|
|
account.nickname
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-14 12:09:20 +00:00
|
|
|
def staff_account_link_or_none(account)
|
|
|
|
if account.nil?
|
2019-08-28 18:21:35 +00:00
|
|
|
none
|
2019-08-14 12:09:20 +00:00
|
|
|
elsif policy([:staff, account]).show?
|
|
|
|
link_to account.nickname, [:staff, account]
|
|
|
|
elsif policy(account).show?
|
|
|
|
link_to account.nickname, account
|
|
|
|
else
|
|
|
|
account.nickname
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|