Module: Entity
- Defined in:
- app/models/entity.rb
Defined Under Namespace
Modules: ClassMethods
Classes: EntityTypeNotSpecifiedError
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'app/models/entity.rb', line 50
def self.included(base)
base.extend ClassMethods
base.after_save do |entity|
Cartoonist::Entity.hooks_with(:after_entity_save).each do |hook|
hook.after_entity_save entity
end
end
end
|
Instance Method Details
#entity_absolute_url ⇒ Object
38
39
40
|
# File 'app/models/entity.rb', line 38
def entity_absolute_url
"http://#{Setting[:domain]}#{entity_relative_url}" if entity_relative_url
end
|
#entity_description ⇒ Object
14
15
16
|
# File 'app/models/entity.rb', line 14
def entity_description
self.class.entity_description.call self
end
|
#entity_edit_url ⇒ Object
42
43
44
|
# File 'app/models/entity.rb', line 42
def entity_edit_url
self.class.entity_edit_url.call self if self.class.entity_edit_url
end
|
#entity_label ⇒ Object
6
7
8
|
# File 'app/models/entity.rb', line 6
def entity_label
self.class.entity_label
end
|
#entity_localized_label ⇒ Object
10
11
12
|
# File 'app/models/entity.rb', line 10
def entity_localized_label
self.class.entity_localized_label
end
|
#entity_relative_preview_url ⇒ Object
26
27
28
29
30
31
32
|
# File 'app/models/entity.rb', line 26
def entity_relative_preview_url
if self.class.entity_preview_url
self.class.entity_preview_url.call self
else
entity_relative_url
end
end
|
#entity_relative_previewable_url(preview) ⇒ Object
18
19
20
21
22
23
24
|
# File 'app/models/entity.rb', line 18
def entity_relative_previewable_url(preview)
if preview
entity_relative_preview_url
else
entity_relative_url
end
end
|
#entity_relative_url ⇒ Object
34
35
36
|
# File 'app/models/entity.rb', line 34
def entity_relative_url
self.class.entity_url.call self if self.class.entity_url
end
|
#entity_type ⇒ Object
2
3
4
|
# File 'app/models/entity.rb', line 2
def entity_type
self.class.entity_type
end
|
#search_url ⇒ Object
46
47
48
|
# File 'app/models/entity.rb', line 46
def search_url
entity_relative_preview_url
end
|