Class: Gameui::Map

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

Constant Summary collapse

ORDERING_TYPE_ALPHABETIC =
'alphabetic'
ORDERING_TYPE_CUSTOM =
'custom'
ORDERING_TYPE_TIMESTAMP =
'timestamp'
ORDERING_TYPES =
[ ORDERING_TYPE_ALPHABETIC, ORDERING_TYPE_CUSTOM, ORDERING_TYPE_TIMESTAMP ]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

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



40
41
42
43
# File 'lib/gameui/map.rb', line 40

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

Instance Method Details



45
46
47
48
49
50
51
52
53
# File 'lib/gameui/map.rb', line 45

def breadcrumbs
  out = [{ name: self.name, slug: self.slug, link: false }]
  p = self.parent
  while p
    out.push({ name: p.name, slug: p.slug })
    p = p.parent
  end
  out.reverse
end

#mapObject



17
18
19
# File 'lib/gameui/map.rb', line 17

def map
  ::Gameui::Map.where( slug: map_slug ).first
end