Class: Effective::Templates::Template
- Inherits:
-
Object
- Object
- Effective::Templates::Template
show all
- Defined in:
- app/models/effective/templates/template.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.definitions(controller) ⇒ Object
This is used by the effective_regions_helper effective_regions_include_tags And ends up in the javascript CKEDITOR.config top level namespace Passing the controller is hacky but it works
8
9
10
11
12
13
14
15
16
17
|
# File 'app/models/effective/templates/template.rb', line 8
def self.definitions(controller)
EffectiveRegions.templates.map do |template|
{
:title => template.title,
:description => template.description,
:image => template.image || "#{template.class_name}.png",
:html => controller.render_to_string(:partial => template.to_partial_path, :object => template, :locals => {:template => template})
}
end
end
|
Instance Method Details
#class_name ⇒ Object
35
36
37
|
# File 'app/models/effective/templates/template.rb', line 35
def class_name
@class_name ||= self.class.name.demodulize.underscore.to_sym
end
|
#description ⇒ Object
23
24
25
|
# File 'app/models/effective/templates/template.rb', line 23
def description
"Insert #{title}"
end
|
#image ⇒ Object
27
28
29
|
# File 'app/models/effective/templates/template.rb', line 27
def image
"#{class_name}.png"
end
|
#title ⇒ Object
19
20
21
|
# File 'app/models/effective/templates/template.rb', line 19
def title
class_name.to_s.humanize
end
|
#to_partial_path ⇒ Object
31
32
33
|
# File 'app/models/effective/templates/template.rb', line 31
def to_partial_path
"effective/templates/#{class_name}"
end
|