Module: Elabs::ContentHelper

Defined in:
app/helpers/elabs/content_helper.rb

Instance Method Summary collapse

Instance Method Details

#first_type_with_content(entity) ⇒ Object



11
12
13
14
15
16
# File 'app/helpers/elabs/content_helper.rb', line 11

def first_type_with_content(entity)
  i[albums articles notes projects uploads].each do |type|
    return type.to_s if entity.respond_to?(type) && entity["#{type}_count"].positive?
  end
  'albums'
end

#show_item?(entity) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/helpers/elabs/content_helper.rb', line 3

def show_item?(entity)
  (entity.sfw? || show_nsfw?) && !entity.locked?
end

#user_is_author_of(entity) ⇒ Object



7
8
9
# File 'app/helpers/elabs/content_helper.rb', line 7

def user_is_author_of(entity)
  current_user&.id && entity.user_id == current_user.id
end