Module: EffectivePages
- Includes:
- EffectiveGem
- Defined in:
- lib/effective_pages.rb,
lib/effective_pages/engine.rb,
lib/effective_pages/version.rb,
lib/generators/effective_pages/install_generator.rb
Defined Under Namespace
Modules: Generators Classes: Engine
Constant Summary collapse
- VERSION =
'3.14.0'.freeze
Class Method Summary collapse
- .banners? ⇒ Boolean
- .carousels? ⇒ Boolean
- .config_keys ⇒ Object
- .layouts ⇒ Object
- .max_menu_depth ⇒ Object
- .menus? ⇒ Boolean
- .sidebars? ⇒ Boolean
- .templates ⇒ Object
Class Method Details
.banners? ⇒ Boolean
59 60 61 |
# File 'lib/effective_pages.rb', line 59 def self. !! end |
.carousels? ⇒ Boolean
63 64 65 |
# File 'lib/effective_pages.rb', line 63 def self.carousels? carousels.kind_of?(Array) && carousels.present? end |
.config_keys ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/effective_pages.rb', line 8 def self.config_keys [ :pages_table_name, :page_banners_table_name, :page_sections_table_name, :page_segments_table_name, :alerts_table_name, :carousel_items_table_name, :permalinks_table_name, :tags_table_name, :taggings_table_name, :pages_path, :excluded_pages, :layouts_path, :excluded_layouts, :site_og_image, :site_og_image_width, :site_og_image_height, :site_title, :site_title_suffix, :fallback_meta_description, :google_analytics_code, :silence_missing_page_title_warnings, :silence_missing_meta_description_warnings, :silence_missing_canonical_url_warnings, :use_effective_roles, :layout, :max_menu_depth, :banners_hint_text, :carousels_hint_text, :banners_force_randomize, # Booleans :banners, :sidebars, # Hashes :menus, :carousels ] end |
.layouts ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/effective_pages.rb', line 39 def self.layouts return [] if layouts_path.blank? view_paths = defined?(Tenant) ? Tenant.view_paths : ApplicationController.view_paths view_paths.map { |path| Dir[File.join(path, layouts_path, '**')] }.flatten.map do |file| name = File.basename(file).split('.').first next if name.starts_with?('_') next if name.include?('mailer') next if Array(EffectivePages.excluded_layouts).map { |str| str.to_s }.include?(name) name end.compact.sort end |
.max_menu_depth ⇒ Object
53 54 55 56 57 |
# File 'lib/effective_pages.rb', line 53 def self. depth = config[:max_menu_depth] || 2 raise('only depths 2 and 3 are supported') unless [2, 3].include?(depth) depth end |
.menus? ⇒ Boolean
67 68 69 |
# File 'lib/effective_pages.rb', line 67 def self. .kind_of?(Array) && .present? end |
.sidebars? ⇒ Boolean
71 72 73 |
# File 'lib/effective_pages.rb', line 71 def self. !! end |
.templates ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/effective_pages.rb', line 28 def self.templates view_paths = defined?(Tenant) ? Tenant.view_paths : ApplicationController.view_paths view_paths.map { |path| Dir[File.join(path, pages_path, '**')] }.flatten.map do |file| name = File.basename(file).split('.').first next if name.starts_with?('_') next if Array(EffectivePages.excluded_pages).map { |str| str.to_s }.include?(name) name end.compact.sort end |