Class: ComfortableMexicanSofa::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Configuration defaults



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 89

def initialize
  @cms_title              = "ComfortableMexicanSofa CMS Engine"
  @admin_base_controller  = "ApplicationController"
  @public_base_controller = "ApplicationController"
  @admin_auth             = "ComfortableMexicanSofa::AccessControl::AdminAuthentication"
  @admin_authorization    = "ComfortableMexicanSofa::AccessControl::AdminAuthorization"
  @public_auth            = "ComfortableMexicanSofa::AccessControl::PublicAuthentication"
  @public_authorization   = "ComfortableMexicanSofa::AccessControl::PublicAuthorization"
  @seed_data_path         = nil
  @admin_route_redirect   = ""
  @enable_sitemap         = true
  @enable_seeds           = false
  @seeds_path             = File.expand_path("db/cms_seeds", Rails.root)
  @revisions_limit        = 25
  @locales                = {
    "ar"    => "عربي",
    "ca"    => "Català",
    "cs"    => "Česky",
    "da"    => "Dansk",
    "de"    => "Deutsch",
    "en"    => "English",
    "es"    => "Español",
    "fi"    => "Suomi",
    "fr"    => "Français",
    "gr"    => "Ελληνικά",
    "hr"    => "Hrvatski",
    "it"    => "Italiano",
    "ja"    => "日本語",
    "nb"    => "Norsk",
    "nl"    => "Nederlands",
    "pl"    => "Polski",
    "pt-BR" => "Português Brasileiro",
    "ru"    => "Русский",
    "sk"    => "Slovensky",
    "sv"    => "Svenska",
    "tr"    => "Türkçe",
    "uk"    => "Українська",
    "zh-CN" => "简体中文",
    "zh-TW" => "正體中文"
  }
  @admin_locale         = nil
  @admin_cache_sweeper  = nil
  @allow_erb            = false
  @allowed_helpers      = nil
  @allowed_partials     = nil
  @hostname_aliases     = nil
  @reveal_cms_partials  = false
  @public_cms_path      = nil
  @page_to_json_options = { methods: [:content], except: [:content_cache] }
end

Instance Attribute Details

#admin_authObject

Module that will handle authentication to access cms-admin area



17
18
19
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 17

def admin_auth
  @admin_auth
end

#admin_authorizationObject

Module that will handle authorization against admin cms resources



20
21
22
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 20

def admin_authorization
  @admin_authorization
end

#admin_base_controllerObject

Controller that is inherited from CmsAdmin::BaseController ‘ApplicationController’ is the default



10
11
12
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 10

def admin_base_controller
  @admin_base_controller
end

#admin_cache_sweeperObject

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



51
52
53
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 51

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`



48
49
50
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 48

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’



30
31
32
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 30

def admin_route_redirect
  @admin_route_redirect
end

#allow_erbBoolean

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

Returns:

  • (Boolean)


55
56
57
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 55

def allow_erb
  @allow_erb
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.



60
61
62
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 60

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.



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

def allowed_partials
  @allowed_partials
end

#allowed_templatesObject

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



68
69
70
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 68

def allowed_templates
  @allowed_templates
end

#cms_titleObject

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



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

def cms_title
  @cms_title
end

#enable_seedsObject

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



34
35
36
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 34

def enable_seeds
  @enable_seeds
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)



74
75
76
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 74

def hostname_aliases
  @hostname_aliases
end

#localesObject

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



44
45
46
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 44

def locales
  @locales
end

#page_to_json_optionsObject

Customize returned content from ‘page.to_json` Default is set to `methods: [:content], except: [:content_cache]` For example: include fragments into json data with `config.page_to_json_options = { include: [:fragments] }`



86
87
88
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 86

def page_to_json_options
  @page_to_json_options
end

#public_authObject

Module that will handle authentication for public pages



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

def public_auth
  @public_auth
end

#public_authorizationObject

Module that will handle authorization against public resources



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

def public_authorization
  @public_authorization
end

#public_base_controllerObject

Controller that Comfy::Cms::BaseController will inherit from ‘ApplicationController’ is the default



14
15
16
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 14

def public_base_controller
  @public_base_controller
end

#public_cms_pathObject

Auto-setting parameter derived from the routes



81
82
83
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 81

def public_cms_path
  @public_cms_path
end

#reveal_cms_partialsObject

Reveal partials that can be overwritten in the admin area. Default is false.



78
79
80
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 78

def reveal_cms_partials
  @reveal_cms_partials
end

#revisions_limitObject

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



40
41
42
# File 'lib/comfortable_mexican_sofa/configuration.rb', line 40

def revisions_limit
  @revisions_limit
end

#seeds_pathObject

Path where seeds can be located.



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

def seeds_path
  @seeds_path
end