Module: CamaleonCms::Frontend::ApplicationHelper
- Includes:
- ContentSelectHelper, NavMenuHelper, SeoHelper, SiteHelper
- Included in:
- CamaleonCms::FrontendController
- Defined in:
- app/helpers/camaleon_cms/frontend/application_helper.rb
Instance Method Summary collapse
-
#cama_url_to_fixed(url_to, *args) ⇒ Object
fix for url_to or url_path or any other who need add automatically current locale in the url sample: cama_url_to_fixed("root_url", data: "asdasd", y: 12) => http://localhost/fr?data=asdasd&y=12 note: if current locale is the default language, then locale is not added in the url.
-
#verify_front_visibility(active_record, eager: true) ⇒ Object
add where conditionals to filter private/hidden/expired/drafts/unpublished note: only for post records eager: collection listings (the_posts/the_contents) preload metas, categories, post_tags and the post-type metas up front to avoid N+1.
Methods included from ContentSelectHelper
#each_category_of, #each_post_of, #process_in_block, #the_comments, #the_content, #the_excerpt, #the_field, #the_post, #the_post_type, #the_posts, #the_slug, #the_thumbnail, #the_title, #the_url
Methods included from SeoHelper
#cama_seo_settings, #cama_the_seo
Methods included from NavMenuHelper
#breadcrumb_add, #breadcrumb_draw, #cama_menu_draw_items, #cama_menu_parse_items, #cama_parse_menu_item, #draw_menu, #get_nav_menu
Methods included from SiteHelper
#is_ajax?, #is_category?, #is_home?, #is_page?, #is_post_tag?, #is_post_type?, #is_profile?, #is_search?, #site_current_path, #site_current_url, #the_head
Instance Method Details
#cama_url_to_fixed(url_to, *args) ⇒ Object
fix for url_to or url_path or any other who need add automatically current locale in the url sample: cama_url_to_fixed("root_url", data: "asdasd", y: 12) => http://localhost/fr?data=asdasd&y=12 note: if current locale is the default language, then locale is not added in the url
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/helpers/camaleon_cms/frontend/application_helper.rb', line 27 def cama_url_to_fixed(url_to, *args) = args. _current_site = .delete(:site) || current_site if request.present? if [:locale] == false .delete(:locale) elsif [:locale].blank? && _current_site&.get_languages&.size&.>(1) [:locale] = I18n.locale end if [:locale].present? && _current_site&.get_languages&.first&.to_s == [:locale].to_s [:locale] = nil end end .delete(:format) if PluginRoutes.system_info['skip_format_url'].present? cama_current_site_host_port() unless .key?(:host) send(url_to.tr('-', '_'), *(args << )) end |
#verify_front_visibility(active_record, eager: true) ⇒ Object
add where conditionals to filter private/hidden/expired/drafts/unpublished note: only for post records eager: collection listings (the_posts/the_contents) preload metas, categories, post_tags and the post-type metas up front to avoid N+1. Single-record lookups (the_post, render_post, the_next_post/the_prev_post) pass eager: false so a one-row find is not charged the listing preloads it never reads.
15 16 17 18 19 20 21 |
# File 'app/helpers/camaleon_cms/frontend/application_helper.rb', line 15 def verify_front_visibility(active_record, eager: true) active_record = active_record.visible_frontend active_record = active_record.with_eager if eager r = { active_record: active_record } hooks_run('filter_post', r) r[:active_record] end |