Class: Locomotive::ContentTypeService
- Inherits:
-
Struct
- Object
- Struct
- Locomotive::ContentTypeService
- Defined in:
- app/services/locomotive/content_type_service.rb
Instance Attribute Summary collapse
-
#site ⇒ Object
Returns the value of attribute site.
Instance Method Summary collapse
Instance Attribute Details
#site ⇒ Object
Returns the value of attribute site
2 3 4 |
# File 'app/services/locomotive/content_type_service.rb', line 2 def site @site end |
Instance Method Details
#find_by_slug(slug) ⇒ Object
20 21 22 |
# File 'app/services/locomotive/content_type_service.rb', line 20 def find_by_slug(slug) site.content_types.by_id_or_slug(slug) end |
#list ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/services/locomotive/content_type_service.rb', line 4 def list site .content_types .order_by(:'display_settings.position'.asc, :name.asc) .pluck(:_id, :name, :slug, :number_of_entries, :display_settings) .map do |(_id, name, slug, number_of_entries, display_settings)| Locomotive::ContentType.new( _id: _id, name: name, slug: slug, number_of_entries: number_of_entries, display_settings: display_settings ) end end |
#update(content_type, attributes = {}) ⇒ Object
24 25 26 |
# File 'app/services/locomotive/content_type_service.rb', line 24 def update(content_type, attributes = {}) content_type.update_attributes(attributes) end |