Class: Locomotive::Liquid::Drops::ContentTypeProxyCollection
Instance Method Summary
collapse
#all, #any, #content_type, #count, #each, #each_with_index, #empty, #first, #last
Constructor Details
Returns a new instance of ContentTypeProxyCollection.
15
16
17
18
|
# File 'lib/locomotive/liquid/drops/content_types.rb', line 15
def initialize(content_type)
@content_type = content_type
@collection = nil
end
|
Instance Method Details
#api ⇒ Object
24
25
26
27
|
# File 'lib/locomotive/liquid/drops/content_types.rb', line 24
def api
Locomotive.log :warn, "[Liquid template] the api for content_types has been deprecated and replaced by public_submission_url instead."
{ 'create' => public_submission_url }
end
|
#before_method(meth) ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/locomotive/liquid/drops/content_types.rb', line 29
def before_method(meth)
klass = @content_type.entries.klass
if (meth.to_s =~ /^group_by_(.+)$/) == 0
klass.send(:group_by_select_option, $1, @content_type.order_by_definition)
elsif (meth.to_s =~ /^(.+)_options$/) == 0
klass.send(:"#{$1}_options").map { |option| option['name'] }
else
Locomotive.log :warn, "[Liquid template] trying to call #{meth} on a content_type object"
end
end
|
#public_submission_url ⇒ Object
20
21
22
|
# File 'lib/locomotive/liquid/drops/content_types.rb', line 20
def public_submission_url
@context.registers[:controller].main_app.locomotive_entry_submissions_path(@content_type.slug)
end
|