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



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/screens_helper.rb', line 12

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('screens.thumbs.owner')
    else
      link_to screen.owner.name, path
    end
  else
    if tip
       :span, screen.owner.name, :title => t('screens.thumbs.owner')
    else
       :span, screen.owner.name
    end
  end
end

- (Object) set_screen_field_data(screen, field)



3
4
5
6
7
8
9
# File 'app/helpers/screens_helper.rb', line 3

def set_screen_field_data(screen,field)
  @subscriptions = screen.subscriptions.where(:field_id => field.id)
  auth! object: @subscriptions, action: :read

  @field_configs = screen.field_configs.where(:field_id => field.id)
  auth! object: @field_configs, action: :read
end