Module: Para::SeoTools::Helpers::PageHelper
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/para/seo_tools/helpers/page_helper.rb
Instance Method Summary collapse
- #current_seo_tools_page ⇒ Object
-
#seo_tools_page_for(scope_hash = {}) ⇒ Object
Retrieve the first page that matches the given scope conditions.
-
#seo_tools_pages_for(scope_hash = {}) ⇒ Object
Find all the pages with the given scope conditions, merged with the current page ones.
- #seo_tools_scoped_sibling_for(*args) ⇒ Object
- #seo_tools_scoped_siblings_for(path, scope_hash = {}) ⇒ Object
Instance Method Details
#current_seo_tools_page ⇒ Object
19 20 21 22 |
# File 'lib/para/seo_tools/helpers/page_helper.rb', line 19 def current_seo_tools_page RequestStore.store['para.seo_tools.current_seo_tools_page'] ||= seo_tools_page_for({ path: request.path }.merge(seo_tools_scope_for(request))) end |
#seo_tools_page_for(scope_hash = {}) ⇒ Object
Retrieve the first page that matches the given scope conditions
26 27 28 |
# File 'lib/para/seo_tools/helpers/page_helper.rb', line 26 def seo_tools_page_for(scope_hash = {}) seo_tools_pages_for(scope_hash).first end |
#seo_tools_pages_for(scope_hash = {}) ⇒ Object
Find all the pages with the given scope conditions, merged with the current page ones.
33 34 35 |
# File 'lib/para/seo_tools/helpers/page_helper.rb', line 33 def seo_tools_pages_for(scope_hash = {}) Para::SeoTools::Page.scope_with(scope_hash) end |
#seo_tools_scoped_sibling_for(*args) ⇒ Object
37 38 39 |
# File 'lib/para/seo_tools/helpers/page_helper.rb', line 37 def seo_tools_scoped_sibling_for(*args) seo_tools_scoped_siblings_for(*args).first end |
#seo_tools_scoped_siblings_for(path, scope_hash = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/para/seo_tools/helpers/page_helper.rb', line 41 def seo_tools_scoped_siblings_for(path, scope_hash = {}) source_page = if Hash === path scope_hash = path current_seo_tools_page else Para::SeoTools::Page.find_by_path(path) end return Para::SeoTools::Page.none unless source_page scope_hash = scope_hash.merge(seo_tools_scope_for(request)) source_page.siblings.scope_with(scope_hash) end |