Module: ScreensHelper

Defined in:
app/helpers/screens_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) screen_owner(screen, tip = true)

return screen owner as a link if they are allowed to read the owner record



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/screens_helper.rb', line 4

def screen_owner(screen, tip=true)
  path = ((screen.owner.is_a? Group) ? group_path(screen.owner.id) : user_path(screen.owner.id))
  if can? :read, screen.owner 
    if tip
      link_to screen.owner.name, path, :title => "#{t('.owner')}"
    else
      link_to screen.owner.name, path
    end
  else
    if tip
      "<span title='#{t('.owner')}'>#{screen.owner.name}</span>".html_safe
    else
      "<span>#{screen.owner.name}</span>".html_safe
    end
  end
end