Sha256: 8bc84213369249acc7dad40d5b1eddc7471f5b89afd48203e1f8f80814805869

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

module RocketCMS
  def self.configuration
    @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 :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

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

      @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
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rocket_cms-0.3.2 lib/rocket_cms/configuration.rb
rocket_cms-0.2.12 lib/rocket_cms/configuration.rb
rocket_cms-0.2.10 lib/rocket_cms/configuration.rb
rocket_cms-0.1.13 lib/rocket_cms/configuration.rb