Class: RiddlerAdmin::Step
Constant Summary
collapse
- MODEL_KEY =
"st".freeze
- ID_LENGTH =
5
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.available_classes ⇒ Object
31
32
33
34
35
36
|
# File 'app/models/riddler_admin/step.rb', line 31
def self.available_classes
[
Steps::Content,
Steps::Variant
]
end
|
.default_class ⇒ Object
38
39
40
|
# File 'app/models/riddler_admin/step.rb', line 38
def self.default_class
Steps::Content
end
|
.short_name ⇒ Object
42
43
44
|
# File 'app/models/riddler_admin/step.rb', line 42
def self.short_name
name.demodulize
end
|
Instance Method Details
#content_id ⇒ Object
63
64
65
|
# File 'app/models/riddler_admin/step.rb', line 63
def content_id
id
end
|
#content_type ⇒ Object
59
60
61
|
# File 'app/models/riddler_admin/step.rb', line 59
def content_type
"step"
end
|
#definition_hash(options = nil) ⇒ Object
71
72
73
74
75
76
77
|
# File 'app/models/riddler_admin/step.rb', line 71
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
86
87
88
|
# File 'app/models/riddler_admin/step.rb', line 86
def excluded_attrs
[:created_at, :updated_at, :title, :preview_enabled, :stepable_type, :stepable_id, :position]
end
|
#object ⇒ Object
55
56
57
|
# File 'app/models/riddler_admin/step.rb', line 55
def object
type.demodulize.underscore
end
|
#published? ⇒ Boolean
67
68
69
|
# File 'app/models/riddler_admin/step.rb', line 67
def published?
content_definitions.any?
end
|
#serializable_hash_options ⇒ Object
79
80
81
82
83
84
|
# File 'app/models/riddler_admin/step.rb', line 79
def serializable_hash_options
{
methods: [:content_type],
except: excluded_attrs
}
end
|
#short_name ⇒ Object
46
47
48
|
# File 'app/models/riddler_admin/step.rb', line 46
def short_name
self.class.short_name
end
|
#to_partial_path(detail = nil) ⇒ Object
50
51
52
|
# File 'app/models/riddler_admin/step.rb', line 50
def to_partial_path detail=nil
[self.class.name.underscore, detail].compact.join "/"
end
|