Class: Video

Inherits:
Object
  • Object
show all
Includes:
Ish::PremiumItem, Ish::Utils, Mongoid::Document, Mongoid::Paperclip, Mongoid::Paranoia, Mongoid::Timestamps, Mongoid::Votable
Defined in:
lib/video.rb

Constant Summary collapse

PER_PAGE =
6

Constants included from Mongoid::Votable

Mongoid::Votable::VOTE_POINT

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Mongoid::Votable

#down_voter_ids, #down_votes_count, #up_voter_ids, #up_votes_count, #vote, #vote_value, #votes_count, #votes_point

Methods included from Ish::Utils

#export

Methods included from Ish::PremiumItem

included, #is_premium

Class Method Details

.listObject



53
54
55
# File 'lib/video.rb', line 53

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

Instance Method Details

#export_fieldsObject



87
88
89
# File 'lib/video.rb', line 87

def export_fields
  %w| name descr |
end

#is_trashObject



23
24
25
26
27
28
29
# File 'lib/video.rb', line 23

def is_trash
  if deleted_at
    true
  else
    self[:is_trash]
  end
end

#publishedObject



33
34
35
# File 'lib/video.rb', line 33

def published
  where({ :is_public => true, :is_trash => false }).order_by({ :created_at => :desc })
end

#subheadObject

still need it… 2023-03-24



20
# File 'lib/video.rb', line 20

field :subhead