Class: Locomotive::Site
- Inherits:
-
Object
- Object
- Locomotive::Site
- Includes:
- Extensions::Shared::Seo, Extensions::Site::Locales, Extensions::Site::Timezone, Mongoid::Document
- Defined in:
- app/models/locomotive/site.rb
Instance Method Summary collapse
- #accounts ⇒ Object
- #admin_memberships ⇒ Object
-
#all_pages_in_once ⇒ Object
methods ##.
- #fetch_page(path, logged_in) ⇒ Object
- #is_admin?(account) ⇒ Boolean
-
#name ⇒ Object
validations ##.
-
#ordered_pages(conditions = {}) ⇒ Criteria
Get all the pages in the right order: depth and position, both ASC.
-
#pages ⇒ Object
associations ##.
Methods included from Extensions::Site::SubdomainDomains
enable_subdomain_n_domains_if_multi_sites
Methods included from Extensions::Site::FirstInstallation
Methods included from Extensions::Site::Timezone
Methods included from Extensions::Site::Locales
#default_locale, #default_locale_was, #each_locale, #is_default_locale?, #locale_fallbacks, #locales=, #localized?, #localized_page_fullpath, #prefix_default_locale?, #with_default_locale
Instance Method Details
#accounts ⇒ Object
58 59 60 |
# File 'app/models/locomotive/site.rb', line 58 def accounts Account.criteria.in(_id: self.memberships.map(&:account_id)) end |
#admin_memberships ⇒ Object
62 63 64 |
# File 'app/models/locomotive/site.rb', line 62 def admin_memberships self.memberships.find_all { |m| m.admin? } end |
#all_pages_in_once ⇒ Object
methods ##
40 41 42 |
# File 'app/models/locomotive/site.rb', line 40 def all_pages_in_once Page.quick_tree(self) end |
#fetch_page(path, logged_in) ⇒ Object
54 55 56 |
# File 'app/models/locomotive/site.rb', line 54 def fetch_page(path, logged_in) Locomotive::Page.fetch_page_from_path self, path, logged_in end |
#is_admin?(account) ⇒ Boolean
66 67 68 |
# File 'app/models/locomotive/site.rb', line 66 def is_admin?(account) self.memberships.detect { |m| m.admin? && m.account_id == account._id } end |
#name ⇒ Object
validations ##
14 |
# File 'app/models/locomotive/site.rb', line 14 field :name |
#ordered_pages(conditions = {}) ⇒ Criteria
Get all the pages in the right order: depth and position, both ASC.
50 51 52 |
# File 'app/models/locomotive/site.rb', line 50 def ordered_pages(conditions = {}) self.pages.unscoped.where(conditions || {}).order_by_depth_and_position end |
#pages ⇒ Object
associations ##
18 |
# File 'app/models/locomotive/site.rb', line 18 has_many :pages, class_name: 'Locomotive::Page', validate: false, autosave: false |