Class: RiddlerAdmin::Element
Constant Summary
collapse
- MODEL_KEY =
"el".freeze
- ID_LENGTH =
56_800_235_584 per second
6
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.available_classes ⇒ Object
.default_class ⇒ Object
31
32
33
|
# File 'app/models/riddler_admin/element.rb', line 31
def self.default_class
Elements::Text
end
|
.short_name ⇒ Object
35
36
37
|
# File 'app/models/riddler_admin/element.rb', line 35
def self.short_name
name.demodulize
end
|
Instance Method Details
#content_id ⇒ Object
56
57
58
|
# File 'app/models/riddler_admin/element.rb', line 56
def content_id
id
end
|
#content_type ⇒ Object
52
53
54
|
# File 'app/models/riddler_admin/element.rb', line 52
def content_type
"element"
end
|
#definition_hash(options = nil) ⇒ Object
60
61
62
63
64
65
66
|
# File 'app/models/riddler_admin/element.rb', line 60
def definition_hash options=nil
options ||= {}
hash = serializable_hash options.merge(serializable_hash_options)
hash["type"] = object
hash.delete "include_predicate" if hash["include_predicate"].blank?
hash
end
|
#excluded_attrs ⇒ Object
75
76
77
|
# File 'app/models/riddler_admin/element.rb', line 75
def excluded_attrs
[:created_at, :updated_at, :container_type, :container_id, :position, :url, :text]
end
|
#object ⇒ Object
48
49
50
|
# File 'app/models/riddler_admin/element.rb', line 48
def object
type.demodulize.underscore
end
|
#serializable_hash_options ⇒ Object
68
69
70
71
72
73
|
# File 'app/models/riddler_admin/element.rb', line 68
def serializable_hash_options
{
methods: [:content_type],
except: excluded_attrs
}
end
|
#short_name ⇒ Object
43
44
45
|
# File 'app/models/riddler_admin/element.rb', line 43
def short_name
self.class.short_name
end
|
#step ⇒ Object
79
80
81
82
83
84
85
|
# File 'app/models/riddler_admin/element.rb', line 79
def step
if container.kind_of? ::RiddlerAdmin::Step
container
else
container.step
end
end
|
#to_partial_path(detail = nil) ⇒ Object
39
40
41
|
# File 'app/models/riddler_admin/element.rb', line 39
def to_partial_path detail=nil
[self.class.name.underscore, detail].compact.join "/"
end
|