Class: ComfyPress::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/comfypress/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Configuration defaults



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/comfypress/configuration.rb', line 67

def initialize
  @cms_title            = 'ComfyPress CMS Engine'
  @admin_auth           = 'ComfyPress::HttpAuth'
  @public_auth          = 'ComfyPress::DummyAuth'
  @seed_data_path       = nil
  @admin_route_redirect = ''
  @enable_sitemap       = true
  @upload_file_options  = { }
  @enable_fixtures      = false
  @fixtures_path        = File.expand_path('db/cms_fixtures', Rails.root)
  @revisions_limit      = 25
  @locales              = {
    'en'    => 'English',
    'fr'    => 'Français',
    'es'    => 'Español',
    'pt-BR' => 'Português Brasileiro',
    'zh-CN' => '简体中文',
    'ja'    => '日本語',
    'sv'    => 'Svenska',
    'ru'    => 'Русский',
    'pl'    => 'Polski',
    'de'    => 'Deutsch'
  }
  @admin_locale         = nil
  @database_config      = nil
  @admin_cache_sweeper  = nil
  @allow_irb            = false
  @allowed_helpers      = nil
  @allowed_partials     = nil
  @hostname_aliases     = nil
end

Instance Attribute Details

#admin_authObject

Module that will handle authentication to access cms-admin area



9
10
11
# File 'lib/comfypress/configuration.rb', line 9

def admin_auth
  @admin_auth
end

#admin_cache_sweeperObject

A class that is included as a sweeper to admin base controller if it’s set



46
47
48
# File 'lib/comfypress/configuration.rb', line 46

def admin_cache_sweeper
  @admin_cache_sweeper
end

#admin_localeObject

Admin interface will respect the locale of the site being managed. However you can force it to English by setting this to ‘:en`



37
38
39
# File 'lib/comfypress/configuration.rb', line 37

def admin_locale
  @admin_locale
end

#admin_route_redirectObject

When arriving at /cms-admin you may chose to redirect to arbirtary path, for example ‘/cms-admin/users’



16
17
18
# File 'lib/comfypress/configuration.rb', line 16

def admin_route_redirect
  @admin_route_redirect
end

#allow_irbObject

Not allowing irb code to be run inside page content. False by default.



49
50
51
# File 'lib/comfypress/configuration.rb', line 49

def allow_irb
  @allow_irb
end

#allowed_helpersObject

Whitelist of all helper methods that can be used via {cms:helper} tag. By default all helpers are allowed except ‘eval`, `send`, `call` and few others. Empty array will prevent rendering of all helpers.



54
55
56
# File 'lib/comfypress/configuration.rb', line 54

def allowed_helpers
  @allowed_helpers
end

#allowed_partialsObject

Whitelist of partials paths that can be used via {cms:partial} tag. All partials are accessible by default. Empty array will prevent rendering of all partials.



58
59
60
# File 'lib/comfypress/configuration.rb', line 58

def allowed_partials
  @allowed_partials
end

#cms_titleObject

Don’t like ComfyPress? Set it to whatever you like. :(



6
7
8
# File 'lib/comfypress/configuration.rb', line 6

def cms_title
  @cms_title
end

#database_configObject

Database prefix. If you want to keep your comfortable mexican sofa tables in a location other than the default databases add a database_config. Setting this to ‘cms` will look for a cms_#Rails.env database definition in your database.yml file



43
44
45
# File 'lib/comfypress/configuration.rb', line 43

def database_config
  @database_config
end

#enable_fixturesObject

With each page load, files will be synched with the database. Database entries are destroyed if there’s no corresponding file. Fixtures are disabled by default.



23
24
25
# File 'lib/comfypress/configuration.rb', line 23

def enable_fixtures
  @enable_fixtures
end

#fixtures_pathObject

Path where fixtures can be located.



26
27
28
# File 'lib/comfypress/configuration.rb', line 26

def fixtures_path
  @fixtures_path
end

#hostname_aliasesObject

Site aliases, if you want to have aliases for your site. Good for harmonizing production env with dev/testing envs. e.g. config.site_aliases = => ‘host.inv’, ‘host_a.com’ => [‘host.lvh.me’, ‘host.dev’] Default is nil (not used)



64
65
66
# File 'lib/comfypress/configuration.rb', line 64

def hostname_aliases
  @hostname_aliases
end

#localesObject

Locale definitions. If you want to define your own locale merge => ‘Locale Title’ with this.



33
34
35
# File 'lib/comfypress/configuration.rb', line 33

def locales
  @locales
end

#public_authObject

Module that will handle authentication for public pages



12
13
14
# File 'lib/comfypress/configuration.rb', line 12

def public_auth
  @public_auth
end

#revisions_limitObject

Number of revisions kept. Default is 25. If you wish to disable: set this to 0.



29
30
31
# File 'lib/comfypress/configuration.rb', line 29

def revisions_limit
  @revisions_limit
end

#upload_file_optionsObject

Upload settings



19
20
21
# File 'lib/comfypress/configuration.rb', line 19

def upload_file_options
  @upload_file_options
end