Class: Ekylibre::CorporateIdentity::Visual

Inherits:
Object
  • Object
show all
Defined in:
lib/ekylibre/corporate_identity/visual.rb

Class Method Summary collapse

Class Method Details

.file?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/ekylibre/corporate_identity/visual.rb', line 16

def self.file?
  path(:default).exist?
end

.path(name = :default) ⇒ Object


12
13
14
# File 'lib/ekylibre/corporate_identity/visual.rb', line 12

def self.path(name = :default)
  Ekylibre::Tenant.private_directory.join('corporate_identity', 'visuals', "#{name}.jpg")
end

.set_default_background(file) ⇒ Object


4
5
6
7
8
9
10
# File 'lib/ekylibre/corporate_identity/visual.rb', line 4

def self.set_default_background(file)
  dest = Ekylibre::CorporateIdentity::Visual.path(:default)

  FileUtils.mkdir_p dest.dirname

  `convert #{file} #{dest}`
end

.urlObject


20
21
22
# File 'lib/ekylibre/corporate_identity/visual.rb', line 20

def self.url
  '/backend/visuals/default/picture.jpg'
end