Class: ContentsCore::ItemFile

Inherits:
Item show all
Defined in:
app/models/contents_core/item_file.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Item

#as_json, #attr_id, #class_name, #config, #data_type, #on_after_initialize, #on_before_create, #opt_input, #process_data, #set, #to_s, types, #update_data, #validate_item

Class Method Details

.permitted_attributesObject



23
24
25
# File 'app/models/contents_core/item_file.rb', line 23

def self.permitted_attributes
  [ :data_file ]
end

.type_nameObject



27
28
29
# File 'app/models/contents_core/item_file.rb', line 27

def self.type_name
  'file'
end

Instance Method Details

#editableObject



14
15
16
# File 'app/models/contents_core/item_file.rb', line 14

def editable
  ContentsCore.editing ? { 'data-ec-item': self.id, 'data-ec-input': self.opt_input, 'data-ec-type': self.class_name, 'data-ec-block': self.block_id } : {}
end

#initObject



18
19
20
21
# File 'app/models/contents_core/item_file.rb', line 18

def init
  # self.data_file = File.open( ContentsCore::Engine.root.join( 'lib', 'data', 'missing.jpg' ) ) unless self.data
  self
end