Class: Folder
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Folder
- Defined in:
- lib/generators/ecm/cms_core/models/templates/folder.rb
Class Method Summary collapse
Instance Method Summary collapse
- #fullname ⇒ Object
- #to_s ⇒ Object
- #tree_label ⇒ Object
- #update_children ⇒ Object
- #update_path ⇒ Object
- #update_path! ⇒ Object
- #update_templates ⇒ Object
Class Method Details
.root_folders ⇒ Object
55 56 57 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 55 def self.root_folders self.roots end |
Instance Method Details
#fullname ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 24 def fullname if self.basename == "/" "/" else "#{self.pathname}#{self.basename}/" end end |
#to_s ⇒ Object
15 16 17 18 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 15 def to_s self.fullname # self.tree_label end |
#tree_label ⇒ Object
20 21 22 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 20 def tree_label "#{'    ' * self.level} |--#{self.basename}".html_safe end |
#update_children ⇒ Object
43 44 45 46 47 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 43 def update_children self.children.each do |folder| folder.update_path! end end |
#update_path ⇒ Object
32 33 34 35 36 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 32 def update_path if self.parent self.pathname = self.parent.fullname end end |
#update_path! ⇒ Object
38 39 40 41 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 38 def update_path! self.update_path self.save end |
#update_templates ⇒ Object
49 50 51 52 53 |
# File 'lib/generators/ecm/cms_core/models/templates/folder.rb', line 49 def update_templates self.templates.each do |template| template.update_pathname! end end |