Class: Locomotive::ContentTypeService

Inherits:
Struct
  • Object
show all
Defined in:
app/services/locomotive/content_type_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#siteObject

Returns the value of attribute site

Returns:

  • (Object)

    the current value of 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



10
11
12
# File 'app/services/locomotive/content_type_service.rb', line 10

def find_by_slug(slug)
  site.content_types.by_id_or_slug(slug)
end

#listObject



4
5
6
7
8
# File 'app/services/locomotive/content_type_service.rb', line 4

def list
  site.content_types
    .only(:_id, :name, :slug, :number_of_entries, :display_settings)
    .order_by(:'display_settings.position'.asc, :name.asc).to_a
end

#update(content_type, attributes = {}) ⇒ Object



14
15
16
# File 'app/services/locomotive/content_type_service.rb', line 14

def update(content_type, attributes = {})
  content_type.update_attributes(attributes)
end