Class: Cms::PagePartial

Inherits:
DynamicView
  • Object
show all
Defined in:
app/models/cms/page_partial.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DynamicView

base_path, default_body, #display_name, engine, #file_name, find_by_file_name, form_name, new_with_defaults, #remove_file_from_disk, resource_name, #set_publish_on_save, write_all_to_disk!, #write_file_to_disk

Class Method Details

.display_name(file_name) ⇒ Object



12
13
14
15
# File 'app/models/cms/page_partial.rb', line 12

def self.display_name(file_name)
  name, format, handler = file_name.split('.')
  "#{name.sub(/^_/, '').titleize} (#{format}/#{handler})"
end

.path_elementsObject



21
22
23
# File 'app/models/cms/page_partial.rb', line 21

def self.path_elements
  [Cms::PagePartial]
end

.resource_collection_nameObject



17
18
19
# File 'app/models/cms/page_partial.rb', line 17

def self.resource_collection_name
  "page_partial"
end

Instance Method Details

#file_pathObject



8
9
10
# File 'app/models/cms/page_partial.rb', line 8

def file_path
  File.join(self.class.base_path, "partials", file_name)
end

#prepend_underscoreObject



25
26
27
28
29
# File 'app/models/cms/page_partial.rb', line 25

def prepend_underscore
  if !name.blank? && name[0, 1] != '_'
    self.name = "_#{name}"
  end
end