Class: PagePartial

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DynamicView

base_path, default_body, #display_name, #file_name, find_by_file_name, inherited, new_with_defaults, #remove_file_from_disk, #set_publish_on_save, write_all_to_disk!, #write_file_to_disk

Class Method Details

.display_name(file_name) ⇒ Object



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

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

Instance Method Details

#file_pathObject



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

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

#prepend_underscoreObject



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

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