1
0
Fork 0

Display account link

This commit is contained in:
Alex Kotov 2019-08-14 17:21:39 +05:00
parent d6e61d4fa0
commit 1f9cd376b0
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 11 additions and 1 deletions

View file

@ -1,6 +1,16 @@
# frozen_string_literal: true
module AccountsHelper
def account_link_or_none(account)
if account.nil?
translate :none
elsif policy(account).show?
link_to account.nickname, account
else
account.nickname
end
end
def staff_account_link_or_none(account)
if account.nil?
translate :none

View file

@ -25,7 +25,7 @@
<dl class="mt-3">
<dt><%= Account.human_attribute_name :nickname %></dt>
<dd><%= @account.nickname %></dd>
<dd><%= account_link_or_none @account %></dd>
<dt><%= Account.human_attribute_name :public_name %></dt>
<dd><%= @account.public_name %></dd>