Sha256: fcdb0b9b6c4435295b4cfd40ac644fdb0df47ad56e1a1c51402df673fd17d312

Contents?: true

Size: 1.87 KB

Versions: 9

Compression:

Stored size: 1.87 KB

Contents

module Enjoy
  def self.configuration
    @configuration ||= Configuration.new
  end
  def self.config
    @configuration ||= Configuration.new
  end

  def self.configure
    yield configuration
  end

  class Configuration
    attr_accessor :news_image_styles
    attr_accessor :news_per_page
    attr_accessor :news_excerpt
    attr_accessor :news_content_required

    attr_accessor :error_layout
    attr_accessor :menu_max_depth

    attr_accessor :search_enabled
    attr_accessor :search_per_page
    attr_accessor :search_models

    attr_accessor :contacts_captcha
    attr_accessor :contacts_fields
    attr_accessor :contacts_message_required
    attr_accessor :contacts_captcha_error_message

    attr_accessor :separate_seo_table

    attr_accessor :localize

    attr_accessor :recreate_contact_message_action

    attr_accessor :routes_config

    def initialize
      @news_image_styles = {
          main:  '400x200>',
          thumb: '200x100>'
      }
      @news_per_page = 10
      @news_excerpt = 12
      @news_content_required = true

      @error_layout = 'application'
      @menu_max_depth = 2

      @search_enabled = false
      @search_per_page = 10
      @search_models = []

      @contacts_captcha = false
      @contacts_fields = {}
      @contacts_message_required = true

      @contacts_captcha_error_message = "Код проверки введен неверно"
      @recreate_contact_message_action = "new"

      @localize = false

      @separate_seo_table = false

      @routes_config = {
        use_contacts_path: true,
        use_search_path: true,
        use_news_path: true,
        root_path: "home#index",
        use_slug_path: true,
        use_pages_path: true
      }
    end

    def search_enabled=(val)
      @search_enabled = val
      if @search_enabled
        @search_models << 'Page'
        @search_models << 'News'
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enjoy_cms-0.3.2.1 lib/enjoy/configuration.rb
enjoy_cms-0.3.2 lib/enjoy/configuration.rb
enjoy_cms-0.3.1.2 lib/enjoy/configuration.rb
enjoy_cms-0.3.0.2 lib/enjoy/configuration.rb
enjoy_cms-0.2.1 lib/enjoy/configuration.rb
enjoy_cms-0.2.0.3.2 lib/enjoy/configuration.rb
enjoy_cms-0.2.0.3.1 lib/enjoy/configuration.rb
enjoy_cms-0.2.0.3 lib/enjoy/configuration.rb
enjoy_cms-0.2.0.2 lib/enjoy/configuration.rb