Class: Gallery

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/gallery.rb

Constant Summary collapse

PER_PAGE =
6
ACTIONS =
[ 'show_mini', 'show_long', 'show' ]
RENDER_TITLES =

view name

'index_titles'
RENDER_THUMBS =

view name

'index_thumbs'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.actionsObject

@deprecated, use Gallery::ACTIONS


106
107
108
# File 'lib/gallery.rb', line 106

def self.actions
  [ 'show_mini', 'show_long', 'show' ]
end

.find_by_slug(slug) ⇒ Object


43
44
45
# File 'lib/gallery.rb', line 43

def self.find_by_slug slug
  ::Gallery.where( galleryname: slug ).first
end

.list(conditions = { :is_trash => false }) ⇒ Object


25
26
27
28
# File 'lib/gallery.rb', line 25

def self.list conditions = { :is_trash => false }
  out = self.unscoped.where( conditions ).order_by( :created_at => :desc )
  [['', nil]] + out.map { |item| [ "#{item.created_at.strftime('%Y%m%d')} #{item.name}", item.id ] }
end

Instance Method Details

#is_premiumObject


14
15
16
# File 'lib/gallery.rb', line 14

def is_premium
  premium_tier > 0
end

#premium?Boolean

Returns:

  • (Boolean)

17
# File 'lib/gallery.rb', line 17

def premium?; is_premium; end